[Scipy-svn] r2986 - in trunk/Lib/sandbox/maskedarray: . tests

scipy-svn@scip... scipy-svn@scip...
Fri May 11 21:04:58 CDT 2007


Author: pierregm
Date: 2007-05-11 21:04:48 -0500 (Fri, 11 May 2007)
New Revision: 2986

Modified:
   trunk/Lib/sandbox/maskedarray/core.py
   trunk/Lib/sandbox/maskedarray/tests/test_subclassing.py
   trunk/Lib/sandbox/maskedarray/testutils.py
Log:
MaskedArray
core      : fixed a bug w/ subok=False that prevented the mask to be inherited
testutils : fixed assert_array_compare to force the compared elements to pure ndarray

TimeSeries
tseries   : fixed the 'filled' method
          : allows 2D arrays to be passed to convert (thx to David Huard for the inspiration)
          : added David Huards function/method split
tdates    : guess_freq : returns FR_UND when only one element

Modified: trunk/Lib/sandbox/maskedarray/core.py
===================================================================
--- trunk/Lib/sandbox/maskedarray/core.py	2007-05-11 22:29:57 UTC (rev 2985)
+++ trunk/Lib/sandbox/maskedarray/core.py	2007-05-12 02:04:48 UTC (rev 2986)
@@ -996,7 +996,7 @@
         if not isinstance(data, MaskedArray): 
             _data = _data.view(cls)
         elif not subok:
-            _data = _data.view(cls)
+            _data = data.view(cls)
         else:
             _data = _data.view(type(data))
         # Backwards compat .......

Modified: trunk/Lib/sandbox/maskedarray/tests/test_subclassing.py
===================================================================
--- trunk/Lib/sandbox/maskedarray/tests/test_subclassing.py	2007-05-11 22:29:57 UTC (rev 2985)
+++ trunk/Lib/sandbox/maskedarray/tests/test_subclassing.py	2007-05-12 02:04:48 UTC (rev 2986)
@@ -134,10 +134,12 @@
         mxsub = masked_array(xsub, subok=False)
         assert not isinstance(mxsub, MSubArray)
         assert isinstance(mxsub, MaskedArray)
+        assert_equal(mxsub._mask, m)
         #
         mxsub = masked_array(xsub, subok=True)
         assert isinstance(mxsub, MSubArray)
         assert_equal(mxsub.info, xsub.info)
+        assert_equal(mxsub._mask, xsub._mask)
         
         
 ################################################################################

Modified: trunk/Lib/sandbox/maskedarray/testutils.py
===================================================================
--- trunk/Lib/sandbox/maskedarray/testutils.py	2007-05-11 22:29:57 UTC (rev 2985)
+++ trunk/Lib/sandbox/maskedarray/testutils.py	2007-05-12 02:04:48 UTC (rev 2986)
@@ -117,8 +117,8 @@
     yf = filled(y)
     m = mask_or(getmask(x), getmask(y))
     
-    x = masked_array(xf, copy=False, mask=m).filled(fill_value)
-    y = masked_array(yf, copy=False, mask=m).filled(fill_value)
+    x = masked_array(xf, copy=False, subok=False, mask=m).filled(fill_value)
+    y = masked_array(yf, copy=False, subok=False, mask=m).filled(fill_value)
     
     if ((x is masked) and not (y is masked)) or \
         ((y is masked) and not (x is masked)):



More information about the Scipy-svn mailing list