2010/5/31 Fernando Guimarães Ferreira <fernando...@poli.ufrj.br>:
> Hi,
> I'm using scipy under MacOS Snow Leopard v:0.7.2 with python 2.6.2
> For some reason, I can't load matlab files using scipy.io.matlab.loadmat:
> scipy.io.matlab.loadmat('all_data.mat')
...
> 317 getter = self.current_getter(byte_count)
> TypeError: Expecting miMATRIX type here, got 1296630016
>
> Can't understand why...
I don't know either I'm afraid. Can you try the latest version? Is
there some way you can get me the .mat file so I can debug the problem
in more detail?
Best,
Matthew
_______________________________________________
SciPy-User mailing list
SciPy...@scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user
Vincent
Works for me with a recent trunk of scipy.
In [1]: from scipy import io
In [2]: dta = io.loadmat('./teste.mat')
In [3]: dta['x']
Out[3]: array([[0, 1, 3, 0, 1, 3, 4, 5, 7, 7]], dtype=uint8)
In [4]: from scipy import __version__ as v
In [5]: v
Out[5]: '0.9.0.dev6447'
Skipper
2010/5/31 Fernando Guimarães Ferreira <fernando...@poli.ufrj.br>:
> In the last email I meant python 2.6.5
> The mat file is attached... This is a test, there is just an array 'x' with
> few elements..
It works for me with 0.7.2. I wonder what's going on?
[mb312@blair ~/tmp]$ uname -a
Darwin blair 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb 26 11:58:09
PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386
[mb312@blair ~/tmp]$ ipython
Python 2.6.4 (r264:75706, Dec 22 2009, 14:55:30)
Type "copyright", "credits" or "license" for more information.
IPython 0.11.alpha1.bzr.r1223 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
In [1]: import scipy
In [2]: scipy.__version__
Out[2]: '0.7.2'
In [3]: import scipy.io.matlab
In [4]: scipy.io.matlab.loadmat('/Users/mb312/Downloads/teste.mat')
/Users/mb312/usr/local/lib/python2.6/site-packages/scipy/io/matlab/mio.py:84:
FutureWarning: Using struct_as_record default value (False) This will
change to True in future versions
return MatFile5Reader(byte_stream, **kwargs)
Out[4]:
{'__globals__': [],
'__header__': 'MATLAB 5.0 MAT-file, Platform: MACI, Created on: Mon
May 31 21:06:09 2010',
'__version__': '1.0',
'x': array([[0, 1, 3, 0, 1, 3, 4, 5, 7, 7]], dtype=uint8)}
But I thought I had fixed that on the SVN ???
What version of numpy do you have? I can't imagine it makes a
difference, but still.
Did you run the scipy tests? Did the scipy.io.matlab tests pass?
Best,
Matthew
You did but I assume that only applied to csv (type?) files.
I was thinking that they may have a "similar" problem with this mat
file. But I tried to clearly say I have no idea.
Vincent
>> But I thought I had fixed that on the SVN ???
>
> You did but I assume that only applied to csv (type?) files.
> I was thinking that they may have a "similar" problem with this mat
> file. But I tried to clearly say I have no idea.
Actually the .mat files are a custom binary format by matlab - we
don't use the genfromtxt stuff to load them...
Matthew
In [7]: mt.loadmat('teste.mat')
/Library/Frameworks/EPD64.framework/Versions/6.1/lib/python2.6/site-packages/scipy/io/matlab/mio.py:99:
FutureWarning: Using struct_as_record default value (False) This will
change to True in future versions
return MatFile5Reader(byte_stream, **kwargs)
Out[7]:
{'__globals__': [],
'__header__': 'MATLAB 5.0 MAT-file, Platform: MACI, Created on: Mon
May 31 21:06:09 2010',
'__version__': '1.0',
'x': array([[0, 1, 3, 0, 1, 3, 4, 5, 7, 7]], dtype=uint8)}
======================================================================
ERROR: test_decomp.test_lapack_misaligned(<function solve
at 0x2cc5410>, (array([[ 1.734e-255, 8.189e-217,
4.025e-178, 1.903e-139, 9.344e-101,
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/data/home/nwagner/local/lib/python2.5/site-packages/nose-0.11.1-py2.5.egg/nose/case.py",
line 183, in runTest
self.test(*self.arg)
File
"/data/home/nwagner/local/lib/python2.5/site-packages/scipy/linalg/tests/test_decomp.py",
line 1071, in check_lapack_misaligned
func(*a,**kwargs)
File
"/data/home/nwagner/local/lib/python2.5/site-packages/scipy/linalg/basic.py",
line 49, in solve
a1, b1 = map(asarray_chkfinite,(a,b))
File
"/data/home/nwagner/local/lib/python2.5/site-packages/numpy/lib/function_base.py",
line 528, in asarray_chkfinite
"array must not contain infs or NaNs")
ValueError: array must not contain infs or NaNs
======================================================================
ERROR: Ticket #1124.
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/data/home/nwagner/local/lib/python2.5/site-packages/scipy/signal/tests/test_signaltools.py",
line 287, in test_none
signal.medfilt(None)
File
"/data/home/nwagner/local/lib/python2.5/site-packages/scipy/signal/signaltools.py",
line 317, in medfilt
return sigtools._order_filterND(volume,domain,order)
ValueError: order_filterND not available for this type
======================================================================
ERROR: test_mpmath.test_expi_complex
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/data/home/nwagner/local/lib/python2.5/site-packages/nose-0.11.1-py2.5.egg/nose/case.py",
line 183, in runTest
self.test(*self.arg)
File
"/data/home/nwagner/local/lib/python2.5/site-packages/numpy/testing/decorators.py",
line 146, in skipper_func
return f(*args, **kwargs)
File
"/data/home/nwagner/local/lib/python2.5/site-packages/scipy/special/tests/test_mpmath.py",
line 46, in test_expi_complex
dataset = np.array(dataset, dtype=np.complex_)
TypeError: a float is required
----------------------------------------------------------------------
Ran 4625 tests in 166.157s
FAILED (KNOWNFAIL=12, SKIP=17, errors=3)
<nose.result.TextTestResult run=4625 errors=3 failures=0>