[Numpy-svn] r5332 - in trunk/numpy/ma: . tests

numpy-svn@scip... numpy-svn@scip...
Wed Jul 2 16:46:13 CDT 2008


Author: pierregm
Date: 2008-07-02 16:46:01 -0500 (Wed, 02 Jul 2008)
New Revision: 5332

Modified:
   trunk/numpy/ma/core.py
   trunk/numpy/ma/tests/test_extras.py
Log:
Corrected a goof in .reshape()

Modified: trunk/numpy/ma/core.py
===================================================================
--- trunk/numpy/ma/core.py	2008-07-02 03:15:46 UTC (rev 5331)
+++ trunk/numpy/ma/core.py	2008-07-02 21:46:01 UTC (rev 5332)
@@ -2016,9 +2016,9 @@
         """
         result = self._data.reshape(*s).view(type(self))
         result._update_from(self)
-        if result._mask is not nomask:
-            result._mask = self._mask.copy()
-            result._mask.shape = result.shape
+        mask = self._mask
+        if mask is not nomask:
+            result._mask = mask.reshape(*s)
         return result
     #
     def resize(self, newshape, refcheck=True, order=False):

Modified: trunk/numpy/ma/tests/test_extras.py
===================================================================
--- trunk/numpy/ma/tests/test_extras.py	2008-07-02 03:15:46 UTC (rev 5331)
+++ trunk/numpy/ma/tests/test_extras.py	2008-07-02 21:46:01 UTC (rev 5332)
@@ -51,9 +51,9 @@
         assert_equal(average(y, axis=1), 
                      [average(x,axis=0), average(x,axis=0) * 2.0])
         assert_equal(average(y, None, weights=w2), 20./6.)
-        assert_equal(average(y, axis=0, weights=w2), 
+        assert_equal(average(y, axis=0, weights=w2),
                      [0.,1.,2.,3.,4.,10.])
-        assert_equal(average(y, axis=1), 
+        assert_equal(average(y, axis=1),
                      [average(x,axis=0), average(x,axis=0) * 2.0])
         m1 = zeros(6)
         m2 = [0,0,1,1,0,0]



More information about the Numpy-svn mailing list