[Scipy-svn] r3237 - branches/0.5.2.x/Lib/io

scipy-svn@scip... scipy-svn@scip...
Tue Aug 14 16:33:54 CDT 2007


Author: jarrod.millman
Date: 2007-08-14 16:33:51 -0500 (Tue, 14 Aug 2007)
New Revision: 3237

Modified:
   branches/0.5.2.x/Lib/io/mio5.py
Log:
Fix mio5 for new behavior of rank-0 record arrays as per revision 2893.


Modified: branches/0.5.2.x/Lib/io/mio5.py
===================================================================
--- branches/0.5.2.x/Lib/io/mio5.py	2007-08-14 20:53:46 UTC (rev 3236)
+++ branches/0.5.2.x/Lib/io/mio5.py	2007-08-14 21:33:51 UTC (rev 3237)
@@ -157,7 +157,7 @@
         tag = ndarray(shape=(),
                       dtype=self.dtypes['tag_full'],
                       buffer = raw_tag)
-        mdtype = tag['mdtype']
+        mdtype = tag['mdtype'].item()
         byte_count = mdtype >> 16
         if byte_count: # small data element format
             if byte_count > 4:
@@ -168,7 +168,7 @@
             return ndarray(shape=(el_count,),
                            dtype=dt,
                            buffer=raw_tag[4:])
-        byte_count = tag['byte_count']
+        byte_count = tag['byte_count'].item()
         if mdtype == miMATRIX:
             return self.current_getter(byte_count).get_array()
         if mdtype in self.codecs: # encoded char data
@@ -193,8 +193,8 @@
     def matrix_getter_factory(self):
         ''' Returns reader for next matrix at top level '''
         tag = self.read_dtype(self.dtypes['tag_full'])
-        mdtype = tag['mdtype']
-        byte_count = tag['byte_count']
+        mdtype = tag['mdtype'].item()
+        byte_count = tag['byte_count'].item()
         next_pos = self.mat_stream.tell() + byte_count
         if mdtype == miCOMPRESSED:
             getter = Mat5ZArrayReader(self, byte_count).matrix_getter_factory()
@@ -507,7 +507,7 @@
         ''' Read in mat 5 file header '''
         hdict = {}
         hdr = self.read_dtype(self.dtypes['file_header'])
-        hdict['__header__'] = hdr['description'].strip(' \t\n\000')
+        hdict['__header__'] = hdr['description'].item().strip(' \t\n\000')
         v_major = hdr['version'] >> 8
         v_minor = hdr['version'] & 0xFF
         hdict['__version__'] = '%d.%d' % (v_major, v_minor)



More information about the Scipy-svn mailing list