[SciPy-user] scipy.io.loadmat bug?
nvf at MIT.EDU
Tue Jun 14 16:35:46 CDT 2005
There are parts of a Matlab pipeline I don't want to port to Python, but
I'd like to use Python for some post-processing. I am trying to load a
MatlabR14-generated .mat file into python using scipy.io.loadmat. With
the following code:
from scipy.io import loadmat
I get the following error:
Traceback (most recent call last):
File "mattest.py", line 2, in ?
File "/usr/lib/python2.3/site-packages/scipy/io/mio.py", line 692, in
thisdict = _loadv5(fid,basename)
File "/usr/lib/python2.3/site-packages/scipy/io/mio.py", line 631, in
el, varname = _get_element(fid)
File "/usr/lib/python2.3/site-packages/scipy/io/mio.py", line 611, in
raise ValueError, "Unknown data type: %d" % raw_tag
ValueError: Unknown data type: 15
(I modified mio.py to return the value of raw_tag in the ValueError
I've verified that my MAT file opens in matlab and it has the following
header (copied and pasted from the first line of 'less
H1H2_DARM_ERR_avetfcoh.mat'): MATLAB 5.0 MAT-file, Platform: GLNX86,
Created on: Thu Jun 9 17:38:55 2005
Digging into the Mathworks documentation on the MAT-file format, I see
that data type 15 (in the last line of the Traceback) stands for
Compressed data, which the mio.py source code claims to support, but yet
lacks handling for data type 15 (it stops at 14). It uses some other
criterion for determining that a file is compressed.
Does anyone know anything more on this subject? Is this a bug or has
MatlabR14 just decided to change the rules of that game?
Any help would be appreciated. Thanks.
More information about the SciPy-user