[SciPy-User] can anyone confirm this bug in scipy.io.savemat on the latest version of scipy?

George Dahl gdahl@cs.toronto....
Mon Oct 4 19:52:52 CDT 2010


Hi everyone,

The code snippet I have pasted below exhibits what I believe to be
incorrect behavior on the version of scipy I happen to have installed
('0.8.0.dev6113'). Basically, scipy.io.savemat doesn't respect the
dtype of the arrays it saves and everything gets saved as float64 for
me.

So files holding arrays of, for example, dtype=int8 balloon to a huge
size when written to disk by scipy.io.savemat.

#########################
import numpy as num
from scipy.io import loadmat, savemat

x = num.random.random_integers(64, size=(100,))
x = x.astype(num.int8)
savemat("garb.mat", {'x':x})
d = loadmat("garb.mat")
print d['x'].dtype, "should be int8"
##########################


Can anyone else confirm that this happens on the latest version of scipy?


- George


More information about the SciPy-User mailing list