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

scipy-svn@scip... scipy-svn@scip...
Wed May 16 18:12:40 CDT 2007


Author: pierregm
Date: 2007-05-16 18:12:32 -0500 (Wed, 16 May 2007)
New Revision: 3013

Modified:
   trunk/Lib/sandbox/maskedarray/core.py
   trunk/Lib/sandbox/maskedarray/tests/test_core.py
Log:
maskedarray.core : fixed the setting of the mask in getitem when _smallmask is True

Modified: trunk/Lib/sandbox/maskedarray/core.py
===================================================================
--- trunk/Lib/sandbox/maskedarray/core.py	2007-05-16 20:01:46 UTC (rev 3012)
+++ trunk/Lib/sandbox/maskedarray/core.py	2007-05-16 23:12:32 UTC (rev 3013)
@@ -1146,11 +1146,12 @@
                 self._mask = make_mask_none(self.shape)
                 self._mask[indx] = valmask
         elif not self._hardmask:
-            self._mask = self._mask.copy()
+            _mask = self._mask.copy()
             if valmask is nomask:
-                self._mask[indx] = False
+                _mask[indx] = False
             else:
-                self._mask[indx] = valmask
+                _mask[indx] = valmask
+            self._set_mask(_mask)
         elif hasattr(indx, 'dtype') and (indx.dtype==bool_):
             indx = indx * umath.logical_not(self._mask)
         else:

Modified: trunk/Lib/sandbox/maskedarray/tests/test_core.py
===================================================================
--- trunk/Lib/sandbox/maskedarray/tests/test_core.py	2007-05-16 20:01:46 UTC (rev 3012)
+++ trunk/Lib/sandbox/maskedarray/tests/test_core.py	2007-05-16 23:12:32 UTC (rev 3013)
@@ -1092,6 +1092,19 @@
         xh[0:1] = 999    
         assert_equal(xh._data,[999,1,2,3,4])
         
+    def check_smallmask(self):
+        "Checks the behaviour of _smallmask"
+        a = arange(10)
+        a[1] = masked
+        a[1] = 1
+        assert_equal(a._mask, nomask)
+        a = arange(10)
+        a._smallmask = False
+        a[1] = masked
+        a[1] = 1    
+        assert_equal(a._mask, zeros(10))
+    
+        
     def check_sort(self):
         "Test sort"
         x = array([1,4,2,3],mask=[0,1,0,0],dtype=N.uint8)



More information about the Scipy-svn mailing list