[SciPy-user] Memory error loading .mat file

Robin robince@gmail....
Tue Feb 12 09:56:28 CST 2008


Hello,

I am having trouble loading a matlab file with latest SVN's on
Windows. The matlab file is about 350MB on disk. The machine has 2gb
of ram. The same code loads the file OK on a mac os x system (same
scipy version) with 2gb ram and also on a ubuntu 64 bit linux system.

Is this a bug, or do I just need more RAM on windows? Is there
anything I can do to get the data to load.

Thanks,

Robin

-----

In [1]: numpy.__version__
Out[1]: '1.0.5.dev4788'

In [2]: scipy.__version__
Out[2]: '0.7.0.dev3920'

In [6]: d = ds.LudtkeData()
---------------------------------------------------------------------------
<type 'exceptions.MemoryError'>           Traceback (most recent call last)

C:\phd\maxent\python\<ipython console> in <module>()

C:\phd\maxent\python\datasource.py in __init__(self, feature)
     34         Load data, with selected output feature"""
     35         data = sio.loadmat(
---> 36                 '..\ludtke_data\parameters.mat')
     37         # skip first 2 blank variables
     38         self.input = data['param'][2:,:]

C:\Python25\Lib\site-packages\scipy\io\matlab\mio.py in loadmat(file_name, mdict
, appendmat, basename, **kwargs)
     94     '''
     95     MR = mat_reader_factory(file_name, appendmat, **kwargs)
---> 96     matfile_dict = MR.get_variables()
     97     if mdict is not None:
     98         mdict.update(matfile_dict)

C:\Python25\Lib\site-packages\scipy\io\matlab\miobase.py in get_variables(self,
variable_names)
    268         mdict['__globals__'] = []
    269         while not self.end_of_stream():
--> 270             getter = self.matrix_getter_factory()
    271             name = getter.name
    272             if variable_names and name not in variable_names:

C:\Python25\Lib\site-packages\scipy\io\matlab\mio5.py in matrix_getter_factory(s
elf)
    531
    532     def matrix_getter_factory(self):
--> 533         return self._array_reader.matrix_getter_factory()
    534
    535     def guess_byte_order(self):

C:\Python25\Lib\site-packages\scipy\io\matlab\mio5.py in matrix_getter_factory(s
elf)
    238         next_pos = self.mat_stream.tell() + byte_count
    239         if mdtype == miCOMPRESSED:
--> 240             getter = Mat5ZArrayReader(self, byte_count).matrix_getter_fa
ctory()
    241         elif not mdtype == miMATRIX:
    242             raise TypeError, \

C:\Python25\Lib\site-packages\scipy\io\matlab\mio5.py in __init__(self, array_re
ader, byte_count)
    290         data = array_reader.mat_stream.read(byte_count)
    291         super(Mat5ZArrayReader, self).__init__(
--> 292             StringIO(zlib.decompress(data)),
    293             array_reader.dtypes,
    294             array_reader.processor_func,

<type 'exceptions.MemoryError'>:

In [7]:


More information about the SciPy-user mailing list