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

scipy-svn at scipy.org scipy-svn at scipy.org
Tue Jan 30 20:24:29 CST 2007


Author: pierregm
Date: 2007-01-30 20:24:25 -0600 (Tue, 30 Jan 2007)
New Revision: 2655

Modified:
   trunk/Lib/sandbox/maskedarray/core.py
   trunk/Lib/sandbox/maskedarray/extras.py
   trunk/Lib/sandbox/maskedarray/mrecords.py
Log:
tcore: fixed a pb with m/m when m has some zeros
textras: fixed syntax errors in mediff1d
trecords: commented out __array_wrap__ for now

Modified: trunk/Lib/sandbox/maskedarray/core.py
===================================================================
--- trunk/Lib/sandbox/maskedarray/core.py	2007-01-30 23:03:57 UTC (rev 2654)
+++ trunk/Lib/sandbox/maskedarray/core.py	2007-01-31 02:24:25 UTC (rev 2655)
@@ -73,9 +73,6 @@
 from numpy.lib.shape_base import expand_dims as n_expand_dims
 import warnings
 
-import logging
-logging.basicConfig(level=logging.DEBUG,
-                    format='%(name)-15s %(levelname)s %(message)s',)
 
 
 MaskType = bool_
@@ -845,12 +842,12 @@
     _defaulthardmask = False
     #TODO: There some reorganization to do round here
     def __new__(cls, data=None, mask=nomask, dtype=None, copy=False, fill_value=None,
-                keep_mask=True, small_mask=True, hard_mask=False, flag=None):
+                keep_mask=True, small_mask=True, hard_mask=False, flag=None,
+                **options):
         """array(data, dtype=None, copy=True, mask=nomask, fill_value=None)
         
 If `data` is already a ndarray, its dtype becomes the default value of dtype.
         """  
-#        logging.debug("__new__ received %s" % type(data))
         if flag is not None:
             warnings.warn("The flag 'flag' is now called 'small_mask'!",
                           DeprecationWarning)
@@ -923,7 +920,7 @@
         cls._fill_value = fill_value
         cls._defaulthardmask = hard_mask
         cls._defaultmask = mask
-#        logging.debug("__new__ returned %s as %s" % (type(_data), cls))
+        cls._defaultoptions = options
         return numeric.asanyarray(_data).view(cls)
     #..................................
     def __array_wrap__(self, obj, context=None):
@@ -932,10 +929,8 @@
         """
 #        mclass = self.__class__
         #..........
-#        logging.debug("__wrap__ received %s w/ context:%ss" % (type(obj),context))
         if context is None:
 #            return mclass(obj, mask=self._mask, copy=False)
-#            logging.debug("__wrap__ received nocontext")
             return MaskedArray(obj, mask=self._mask, copy=False,
                                dtype=obj.dtype,
                                fill_value=self.fill_value, )
@@ -956,7 +951,6 @@
                 if m.shape != dshape:
                     m = reduce(mask_or, [getmaskarray(arg) for arg in args])
 #        return mclass(obj, copy=False, mask=m)
-#        logging.debug("__wrap__ context %s" % context)
         return MaskedArray(obj, copy=False, mask=m,)
 #                           dtype=obj.dtype, fill_value=self._fill_value)
     #........................
@@ -965,16 +959,13 @@
         """Finalizes the masked array.
         """
         #
-#        logging.debug("__finalize__ received %s" % type(obj))
         if isinstance(obj, MaskedArray):
             # We came here from a MaskedArray
-#            logging.debug("__finalize__ recieved data %s" % obj)
-#            logging.debug("__finalize__ recieved data._data %s" % obj._data)
-#            logging.debug("__finalize__ recieved data.base %s" % obj.base)
             self._data = obj._data
             self._mask = obj._mask
             self._hardmask = obj._hardmask
             self._fill_value = obj._fill_value
+            self.options = obj.options
         else:
             # We came here from a .view()
             if hasattr(obj,'_data') and hasattr(obj, '_mask'):
@@ -988,23 +979,22 @@
             # Set the instance default
             self._hardmask = self._defaulthardmask
             self.fill_value = self._fill_value
+            self.options = self._defaultoptions
             # Reset the class default
             MaskedArray._defaultmask = nomask
             MaskedArray._defaulthardmask = False
             MaskedArray._fill_value = None
-#            logging.debug("__finalize__: obj has _mask %s" % hasattr(obj,'_data'))
 #        #
-#        logging.debug("__finalize__ returned %s" % type(self))       
         return    
     #............................................
-    def __getitem__(self, index):
+    def __getitem__(self, indx):
         """x.__getitem__(y) <==> x[y]
 Returns the item described by i. Not a copy as in previous versions.
         """
-        if getmask(index) is not nomask:
+        if getmask(indx) is not nomask:
             msg = "Masked arrays must be filled before they can be used as indices!"
             raise IndexError, msg
-        dout = self._data[index]
+        dout = self._data[indx]
         m = self._mask
         scalardout = (len(numeric.shape(dout))==0)
         # 
@@ -1013,15 +1003,17 @@
                 return dout
             else:
                 return self.__class__(dout, mask=nomask, keep_mask=True,
-                                      fill_value=self._fill_value)
+                                      fill_value=self._fill_value,
+                                      **self.options)
         #....
-        mi = m[index]
+        mi = m[indx]
         if mi.size == 1:
             if mi:
                 return masked
             return dout
         else:
-            return self.__class__(dout, mask=mi, fill_value=self._fill_value)
+            return self.__class__(dout, mask=mi, fill_value=self._fill_value,
+                                  **self.options)
     #........................
     def __setitem__(self, index, value):
         """x.__setitem__(i, y) <==> x[i]=y
@@ -1088,9 +1080,11 @@
         m = self._mask
         dout = self._data[i:j]
         if m is nomask:
-            return self.__class__(dout, fill_value=self._fill_value)
+            return self.__class__(dout, fill_value=self._fill_value,
+                                  **self.options)
         else:
-            return self.__class__(dout, mask=m[i:j], fill_value=self._fill_value)
+            return self.__class__(dout, mask=m[i:j], fill_value=self._fill_value,
+                                  **self.options)
     #........................
     def __setslice__(self, i, j, value):
         """x.__setslice__(i, j, value) <==> x[i:j]=value
@@ -1161,10 +1155,6 @@
         """
         if masked_print_option.enabled():
             f = masked_print_option
-            # XXX: Without the following special case masked
-            # XXX: would print as "[--]", not "--". Can we avoid
-            # XXX: checks for masked by choosing a different value
-            # XXX: for the masked singleton? 2005-01-05 -- sasha
             if self is masked:
                 return str(f)
             m = self._mask
@@ -1222,7 +1212,7 @@
 the absolute of the inital `_data`.
         """
         return self.__class__(self._data.__abs__(), mask=self._mask,
-                              fill_value = self._fill_value,)
+                              fill_value = self._fill_value, **self.options)
     #
     def __neg__(self):
         """x.__abs__() <==> neg(x)
@@ -1230,7 +1220,7 @@
 the negative of the inital `_data`."""
         try:
             return self.__class__(self._data.__neg__(), mask=self._mask,
-                                  fill_value = self._fill_value,)
+                                  fill_value = self._fill_value, **self.options)
         except MAError:
             return negative(self)
     #
@@ -1323,11 +1313,12 @@
         if tc == self._data.dtype:
             return self
         try:
-            return self.__class__(self, mask=self._mask, dtype=tc, copy=True)
+            return self.__class__(self, mask=self._mask, dtype=tc, copy=True,
+                                  **self.options)
         except:
 #            d = self._data.astype(tc) 
             return self.__class__(self._data.astype(tc), mask=self._mask, 
-                                  dtype=tc)
+                                  dtype=tc, **self.options)
 #        
 #        
     #............................................
@@ -1344,10 +1335,12 @@
         """
         if self._mask is nomask:
             return masked_array(self._data.ravel(), mask=nomask, copy=False,
-                                fill_value = self._fill_value)
+                                fill_value = self._fill_value,
+                                **self.options)
         else:
             return masked_array(self._data.ravel(), mask=self._mask.ravel(),
-                                copy=False, fill_value = self._fill_value)
+                                copy=False, fill_value = self._fill_value,
+                                **self.options)
     #
     def _set_flat (self, value):
         "x.flat = value"
@@ -1359,15 +1352,8 @@
     #............................................
     def _get_real(self):
         "Returns the real part of a complex array."
-        return masked_array(self._data.real, mask=self.mask,
-                            fill_value = self._fill_value)
-#        if self.mask is nomask:
-#            return masked_array(self._data.real, mask=nomask,
-#                            fill_value = self.fill_value)
-#        else:
-#            return masked_array(self._data.real, mask=self.mask,
-#                            fill_value = self.fill_value)
-
+        return self.__class__(self._data.real, mask=self.mask,
+                              fill_value = self._fill_value, **self.options)
     def _set_real (self, value):
         "Sets the real part of a complex array to `value`."
         y = self.real
@@ -1377,8 +1363,8 @@
 
     def _get_imaginary(self):
         "Returns the imaginary part of a complex array."
-        return masked_array(self._data.imag, mask=nomask,
-                            fill_value = self._fill_value)
+        return self.__class__(self._data.imag, mask=self.mask,
+                              fill_value = self._fill_value, **self.options)
 
     def _set_imaginary (self, value):
         "Sets the imaginary part of a complex array to `value`."
@@ -1524,10 +1510,10 @@
         if self._mask is not nomask:
             return self.__class__(self._data.reshape(*s), 
                                   mask=self._mask.reshape(*s),
-                                  fill_value=self.fill_value)
+                                  fill_value=self.fill_value, **self.options)
         else:
             return self.__class__(self._data.reshape(*s),
-                                  fill_value=self.fill_value)
+                                  fill_value=self.fill_value, **self.options)
     #
     def repeat(self, repeats, axis=None):
         """Repeat elements of `a` `repeats` times along `axis`.
@@ -1547,7 +1533,8 @@
         if m is not nomask:
             m = fromnumeric.repeat(m, repeats, axis)
         d = fromnumeric.repeat(f, repeats, axis)
-        return self.__class__(d, mask=m, fill_value=self.fill_value)
+        return self.__class__(d, mask=m, fill_value=self.fill_value, 
+                              **self.options)
     #
     def resize(self, newshape, refcheck=True, order=False):
         """Attempts to modify size and shape of self inplace.  
@@ -1608,7 +1595,7 @@
         d = filled(self, True).all(axis)
         m = self._mask.all(axis)
         return self.__class__(d, mask=m, dtype=bool_,
-                              fill_value=self._fill_value,)
+                              fill_value=self._fill_value, **self.options)
     def any(self, axis=None):
         """a.any(axis) returns True if some or all entries along the axis are True.
     Returns False otherwise. If axis is None, uses the flatten array.
@@ -1618,7 +1605,7 @@
         d = filled(self, False).any(axis)
         m = self._mask.all(axis)
         return self.__class__(d, mask=m, dtype=bool_,
-                              fill_value=self._fill_value) 
+                              fill_value=self._fill_value, **self.options) 
     def nonzero(self):
         """a.nonzero() returns a tuple of arrays
 
@@ -1632,7 +1619,7 @@
         transpose(a.nonzero())
     instead. The result of this is always a 2d array, with a row for
     each non-zero element."""
-        return self.filled(0).nonzero()
+        return numeric.asarray(self.filled(0)).nonzero()
     #............................................
     def trace(self, offset=0, axis1=0, axis2=1, dtype=None, out=None):
         """a.trace(offset=0, axis1=0, axis2=1, dtype=None, out=None)
@@ -1658,13 +1645,14 @@
 #            if axis is None:
 #                return self._data.sum(None, dtype=dtype)
             return self.__class__(self._data.sum(axis, dtype=dtype),
-                                  mask=nomask, fill_value=self.fill_value)
+                                  mask=nomask, fill_value=self.fill_value,
+                                  **self.options)
         else:
 #            if axis is None:
 #                return self.filled(0).sum(None, dtype=dtype)
             return self.__class__(self.filled(0).sum(axis, dtype=dtype),
                                   mask=self._mask.all(axis),
-                                  fill_value=self.fill_value)
+                                  fill_value=self.fill_value, **self.options)
             
     def cumsum(self, axis=None, dtype=None):
         """a.cumprod(axis=None, dtype=None)
@@ -1676,12 +1664,13 @@
 #            if axis is None:
 #                return self._data.cumsum(None, dtype=dtype)
             return self.__class__(self._data.cumsum(axis=axis, dtype=dtype),
-                                  fill_value=self.fill_value)
+                                  fill_value=self.fill_value, **self.options)
         else:
 #            if axis is None:
 #                return self.filled(0).cumsum(None, dtype=dtype)
             return self.__class__(self.filled(0).cumsum(axis=axis, dtype=dtype),
-                                  mask=self._mask, fill_value=self.fill_value)
+                                  mask=self._mask, fill_value=self.fill_value,
+                                  **self.options)
         
     def prod(self, axis=None, dtype=None):
         """a.prod(axis=None, dtype=None)
@@ -1693,14 +1682,16 @@
 #            if axis is None:
 #                return self._data.prod(None, dtype=dtype)
             return self.__class__(self._data.prod(axis, dtype=dtype),
-                                  mask=nomask, fill_value=self.fill_value)
+                                  mask=nomask, fill_value=self.fill_value,
+                                  **self.options)
 #            return self.__class__(self._data.prod(axis=axis, dtype=dtype))
         else:
 #            if axis is None:
 #                return self.filled(1).prod(None, dtype=dtype)
             return self.__class__(self.filled(1).prod(axis=axis, dtype=dtype),
                                   mask=self._mask.all(axis),
-                                  fill_value=self.fill_value)
+                                  fill_value=self.fill_value,
+                                  **self.options)
     product = prod
             
     def cumprod(self, axis=None, dtype=None):
@@ -1713,13 +1704,14 @@
 #            if axis is None:
 #                return self._data.cumprod(None, dtype=dtype)
             return self.__class__(self._data.cumprod(axis=axis, dtype=dtype),
-                                  mask=nomask, fill_value=self.fill_value,)
+                                  mask=nomask, fill_value=self.fill_value,
+                                  **self.options)
         else:
 #            if axis is None:
 #                return self.filled(1).cumprod(None, dtype=dtype)
             return self.__class__(self.filled(1).cumprod(axis=axis, dtype=dtype),
                                   mask=self._mask,
-                                  fill_value=self.fill_value)        
+                                  fill_value=self.fill_value, **self.options)        
             
     def mean(self, axis=None, dtype=None):
         """a.mean(axis=None, dtype=None)
@@ -1738,7 +1730,8 @@
 #            if axis is None:
 #                return self._data.mean(axis=None, dtype=dtype)
             return self.__class__(self._data.mean(axis=axis, dtype=dtype),
-                                  mask=nomask, fill_value=self.fill_value)
+                                  mask=nomask, fill_value=self.fill_value,
+                                  **self.options)
         else:
             dsum = fromnumeric.sum(self.filled(0), axis=axis, dtype=dtype)
             cnt = self.count(axis=axis)
@@ -1746,7 +1739,7 @@
             if axis is None and mask:
                 return masked
             return self.__class__(dsum*1./cnt, mask=mask,
-                                  fill_value=self.fill_value,)
+                                  fill_value=self.fill_value, **self.options)
     
     def anom(self, axis=None, dtype=None):
         """a.anom(axis=None, dtype=None)
@@ -1770,7 +1763,7 @@
 #                return self._data.var(axis=None, dtype=dtype)
             return self.__class__(self._data.var(axis=axis, dtype=dtype),
                                   mask=nomask,
-                                  fill_value=self.fill_value)
+                                  fill_value=self.fill_value, **self.options)
         else:
             cnt = self.count(axis=axis)
             danom = self.anom(axis=axis, dtype=dtype)
@@ -1781,7 +1774,7 @@
                 return dvar
             return self.__class__(dvar, 
                                   mask=mask_or(self._mask.all(axis), (cnt==1)),
-                                  fill_value=self.fill_value)
+                                  fill_value=self.fill_value, **self.options)
             
     def std(self, axis=None, dtype=None):
         """a.std(axis=None, dtype=None)
@@ -1799,7 +1792,7 @@
                 return sqrt(dvar)
         return self.__class__(sqrt(dvar._data), mask=dvar._mask,
                               dtype = self.dtype,
-                              fill_value=self.fill_value,)
+                              fill_value=self.fill_value, **self.options)
     #............................................
     def argsort(self, axis=None, fill_value=None, kind='quicksort'):
         """Returns an array of indices that sort 'a' along the specified axis.
@@ -2061,8 +2054,9 @@
                 # a pure ndarray.
                 #Oh, and we better make a copy!
                 if isinstance(other, ndarray):
-                    if target is other:
+                    if target is other or target is base:
                         # We don't want to modify other: let's copy target, then
+                        # Same if target us base, instead...
                         target = target.copy()
                     target[:] = numeric.where(fromnumeric.asarray(domain), 
                                               self.fill_other, target)
@@ -2073,7 +2067,8 @@
         m = mask_or(m_self, m_other)      
         method = getattr(base, self.methodname)       
         return instance.__class__(method(target, *args), mask=m,
-                                  fill_value=instance.fill_value)
+                                  fill_value=instance.fill_value,
+                                  **instance.options)
 #......................................
 class _compamethods(object):
     """Defines comparison methods (eq, ge, gt...).
@@ -2112,8 +2107,7 @@
         target = filled(other, self.fill_other)
         method = getattr(base, self.methodname)      
         return instance.__class__(method(target, *args), mask=m,
-#                                  fill_value=instance.fill_value
-                                  )  
+                                  **instance.options)  
 #..........................................................
 MaskedArray.__add__ = _arithmethods('__add__')
 MaskedArray.__radd__ = _arithmethods('__add__')
@@ -2256,8 +2250,9 @@
     #
     def __call__(self, *args, **params):
         methodname = self._name
-        (d, m) = (self.obj._data, self.obj._mask)
-        (t, f) = (self.obj.dtype, self.obj._fill_value)
+        obj = self.obj
+        (d, m) = (obj._data, obj._mask)
+        (t, f) = (obj.dtype, obj._fill_value)
         C = self.obj.__class__
         if m is nomask:
             return C(getattr(d,methodname).__call__(*args, **params),
@@ -2265,10 +2260,10 @@
         elif self._onmask:
             return C(getattr(d,methodname).__call__(*args, **params),
                      mask=getattr(m,methodname)(*args, **params),
-                     dtype=t, fill_value=f)
+                     dtype=t, fill_value=f, **obj.options)
         else:
             return C(getattr(d,methodname).__call__(*args, **params), mask=m,
-                     dtype=t, fill_value=f) 
+                     dtype=t, fill_value=f, **obj.options) 
 #......................................
 MaskedArray.conj = MaskedArray.conjugate = _arraymethod('conjugate') 
 MaskedArray.copy = _arraymethod('copy') 
@@ -3017,3 +3012,15 @@
 MaskedArray.__dumps__ = dumps
 
 ################################################################################
+
+if __name__ == '__main__':
+    if 1:
+        a = masked_array([0,0])
+        b = a/a
+        assert (b._mask == [1,1]).all()
+        assert (a._data == [0,0]).all()
+    if 1:
+        a = arange(4)
+        a[1:-1] = masked
+        b = a[:-5]
+

Modified: trunk/Lib/sandbox/maskedarray/extras.py
===================================================================
--- trunk/Lib/sandbox/maskedarray/extras.py	2007-01-30 23:03:57 UTC (rev 2654)
+++ trunk/Lib/sandbox/maskedarray/extras.py	2007-01-31 02:24:25 UTC (rev 2655)
@@ -449,7 +449,7 @@
 #...............................................................................
 def mediff1d(array, to_end=None, to_begin=None):
     """Array difference with prefixed and/or appended value."""
-    a = MA.masked_array(array, copy=True)
+    a = masked_array(array, copy=True)
     if a.ndim > 1:
         a.reshape((a.size,))
     (d, m, n) = (a._data, a._mask, a.size-1)
@@ -460,30 +460,30 @@
         dm = m[1:]-m[:-1]
     #
     if to_end is not None:
-        to_end = MA.asarray(to_end)
+        to_end = asarray(to_end)
         nend = to_end.size
         if to_begin is not None:
-            to_begin = MA.asarray(to_begin)
+            to_begin = asarray(to_begin)
             nbegin = to_begin.size
-            r_data = N.empty((n+nend+nbegin,), dtype=a.dtype)
-            r_mask = N.zeros((n+nend+nbegin,), dtype=bool_)
+            r_data = numeric.empty((n+nend+nbegin,), dtype=a.dtype)
+            r_mask = numeric.zeros((n+nend+nbegin,), dtype=bool_)
             r_data[:nbegin] = to_begin._data
             r_mask[:nbegin] = to_begin._mask
             r_data[nbegin:-nend] = dd
             r_mask[nbegin:-nend] = dm
         else:
-            r_data = N.empty((n+nend,), dtype=a.dtype)
-            r_mask = N.zeros((n+nend,), dtype=bool_)
+            r_data = numeric.empty((n+nend,), dtype=a.dtype)
+            r_mask = numeric.zeros((n+nend,), dtype=bool_)
             r_data[:-nend] = dd
             r_mask[:-nend] = dm
         r_data[-nend:] = to_end._data
         r_mask[-nend:] = to_end._mask
     #
     elif to_begin is not None:
-        to_begin = MA.asarray(to_begin)
+        to_begin = asarray(to_begin)
         nbegin = to_begin.size
-        r_data = N.empty((n+nbegin,), dtype=a.dtype)
-        r_mask = N.zeros((n+nbegin,), dtype=bool_)
+        r_data = numeric.empty((n+nbegin,), dtype=a.dtype)
+        r_mask = numeric.zeros((n+nbegin,), dtype=bool_)
         r_data[:nbegin] = to_begin._data
         r_mask[:nbegin] = to_begin._mask
         r_data[nbegin:] = dd

Modified: trunk/Lib/sandbox/maskedarray/mrecords.py
===================================================================
--- trunk/Lib/sandbox/maskedarray/mrecords.py	2007-01-30 23:03:57 UTC (rev 2654)
+++ trunk/Lib/sandbox/maskedarray/mrecords.py	2007-01-31 02:24:25 UTC (rev 2655)
@@ -35,8 +35,6 @@
 from maskedarray.core import default_fill_value, masked_print_option
 
 import warnings
-import logging
-logging.basicConfig(level=logging.DEBUG,
                     format='%(name)-15s %(levelname)s %(message)s',)
 
 reserved_fields = ['_data','_mask','_fieldmask', 'dtype']
@@ -130,7 +128,6 @@
         shape = numeric.asarray(data[0]).shape
         if isinstance(shape, int):
             shape = (shape,)
-#        logging.debug('__new__: shape: %s' % str(shape))
         # Construct the _data recarray ..........
         if isinstance(data, record):
             _data = numeric.asarray(data).view(recarray)
@@ -145,7 +142,6 @@
                 _data[n] = numeric.asarray(v).view(ndarray)
                 _fieldmask[n] = getmaskarray(v)
         
-#        logging.debug('__new__: _fieldmask: %s' % _fieldmask)
         # Set filling value .....................
         if fill_value is None:
             cls._fill_value = [default_fill_value(numeric.dtype(d[1]))
@@ -159,7 +155,6 @@
         return _data.view(cls)
         
     def __array_finalize__(self,obj):
-#        logging.debug("__array_finalize__ received %s" % type(obj))      
         if isinstance(obj, MaskedRecords):
             self.__dict__.update(_data=obj._data,
                                  _fieldmask=obj._fieldmask,
@@ -182,11 +177,9 @@
                                 )
             MaskedRecords._defaultfieldmask = nomask
             MaskedRecords._defaulthardmask = False
-#        logging.debug("__array_finalize__ exit ")  
         return
     #......................................................
     def __getattribute__(self, attr):
-#        logging.debug('__getattribute__ %s' % attr)
         try:
             # Returns a generic attribute
             return object.__getattribute__(self,attr)
@@ -194,7 +187,6 @@
             # OK, so attr must be a field name
             pass
         # Get the list of fields ......
-#        logging.debug('__getattribute__ %s listfield' % attr)
         _names = self.dtype.names
         _local = self.__dict__
         _mask = _local['_fieldmask']
@@ -204,21 +196,18 @@
             obj._mask = make_mask(_mask.__getattribute__(attr))
             return obj
         elif attr == '_mask':
-#            logging.debug('__getattribute__ return mask')
             if self.size > 1:
                 return _mask.view((bool_, len(self.dtype))).all(1)
             return _mask.view((bool_, len(self.dtype)))
         raise AttributeError,"No attribute '%s' !" % attr
             
     def __setattr__(self, attr, val):
-#        logging.debug('__setattribute__ %s' % attr)
         newattr = attr not in self.__dict__
         try:
             # Is attr a generic attribute ?
             ret = object.__setattr__(self, attr, val)
         except:
             # Not a generic attribute: exit if it's not a valid field
-#            logging.debug('__setattribute__ %s' % attr)
             fielddict = self.dtype.names or {}
             if attr not in fielddict:
                 exctype, value = sys.exc_info()[:2]
@@ -259,7 +248,6 @@
     def __getitem__(self, indx):
         """Returns all the fields sharing the same fieldname base.
     The fieldname base is either `_data` or `_mask`."""
-#        logging.debug('__getitem__(%s)' % indx)
         _localdict = self.__dict__
         # We want a field ........
         if isinstance(indx, str):           
@@ -341,7 +329,6 @@
         """Returns a view of the mrecarray."""
         try:
             if issubclass(obj, ndarray):
-#                logging.debug('direct view as %s' % obj)
                 return ndarray.view(self, obj)
         except TypeError:
             pass
@@ -464,7 +451,6 @@
     # Define formats from scratch ...............
     if formats is None and dtype is None:
         formats = _getformats(arraylist)
-#    logging.debug("fromarrays: formats",formats)
     # Define the dtype ..........................
     if dtype is not None:
         descr = numeric.dtype(dtype)
@@ -627,7 +613,6 @@
         line = f.readline()
         firstline = line[:line.find(commentchar)].strip()
         _varnames = firstline.split(delimitor)
-#        logging.debug("_VARNAMES:%s-%s"% (_varnames,len(_varnames)))
         if len(_varnames) > 1:
             break
     if varnames is None:
@@ -648,7 +633,6 @@
             vartypes = _guessvartypes(_variables[0])
     # Construct the descriptor ..................
     mdescr = [(n,f) for (n,f) in zip(varnames, vartypes)]
-#    logging.debug("fromtextfile: descr: %s" % mdescr)
     # 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 == missingchar)



More information about the Scipy-svn mailing list