[Scipy-svn] r2527 - trunk/Lib/sandbox/maskedarray

scipy-svn at scipy.org scipy-svn at scipy.org
Wed Jan 10 16:29:18 CST 2007


Author: pierregm
Date: 2007-01-10 16:29:16 -0600 (Wed, 10 Jan 2007)
New Revision: 2527

Modified:
   trunk/Lib/sandbox/maskedarray/mrecords.py
Log:
Corrected a bug w/ missingchar in fromtextfile

Modified: trunk/Lib/sandbox/maskedarray/mrecords.py
===================================================================
--- trunk/Lib/sandbox/maskedarray/mrecords.py	2007-01-10 19:13:48 UTC (rev 2526)
+++ trunk/Lib/sandbox/maskedarray/mrecords.py	2007-01-10 22:29:16 UTC (rev 2527)
@@ -447,7 +447,7 @@
         if isinstance(reclist, recarray):
             arrlist = [reclist.field(i) for i in range(len(reclist.dtype))]
             if names is None:
-                names = nrec.dtype.names
+                names = reclist.dtype.names
         else:
             obj = numeric.array(reclist,dtype=object)
             arrlist = [numeric.array(obj[...,i].tolist()) 
@@ -568,7 +568,7 @@
         line = f.readline()
         firstline = line[:line.find(commentchar)].strip()
         _varnames = firstline.split(delimitor)
-        print "_VARNAMES:%s-"%_varnames, len(_varnames)
+        logging.debug("_VARNAMES:%s-%s"% (_varnames,len(_varnames)))
         if len(_varnames) > 1:
             break
     if varnames is None:
@@ -593,7 +593,7 @@
     mdescr = [(n,f) for (n,f) in zip(varnames, vartypes)]
     # Get the data and the mask .................
     # We just need a list of masked_arrays. It's easier to create it like that:
-    _mask = (_variables.T == '')
+    _mask = (_variables.T == missingchar)
     _datalist = [masked_array(a,mask=m,dtype=t)
                      for (a,m,t) in zip(_variables.T, _mask, vartypes)]
     return fromarrays(_datalist, dtype=mdescr)



More information about the Scipy-svn mailing list