[Numpy-svn] r4720 - in branches/maskedarray/numpy/ma: . tests

numpy-svn@scip... numpy-svn@scip...
Thu Jan 10 13:33:27 CST 2008


Author: stefan
Date: 2008-01-10 13:33:10 -0600 (Thu, 10 Jan 2008)
New Revision: 4720

Modified:
   branches/maskedarray/numpy/ma/core.py
   branches/maskedarray/numpy/ma/tests/test_core.py
Log:
Fix concatenation.  Closes ticket #642.


Modified: branches/maskedarray/numpy/ma/core.py
===================================================================
--- branches/maskedarray/numpy/ma/core.py	2008-01-10 19:09:35 UTC (rev 4719)
+++ branches/maskedarray/numpy/ma/core.py	2008-01-10 19:33:10 UTC (rev 4720)
@@ -2769,6 +2769,7 @@
     for x in arrays:
         if getmask(x) is not nomask:
             break
+    else:
         return data
     # OK, so we have to concatenate the masks
     dm = numpy.concatenate([getmaskarray(a) for a in arrays], axis)

Modified: branches/maskedarray/numpy/ma/tests/test_core.py
===================================================================
--- branches/maskedarray/numpy/ma/tests/test_core.py	2008-01-10 19:09:35 UTC (rev 4719)
+++ branches/maskedarray/numpy/ma/tests/test_core.py	2008-01-10 19:33:10 UTC (rev 4720)
@@ -1366,7 +1366,19 @@
         x[1] = masked
         x['f'] = 17
 
+    def test_concat(self):
+         x=zeros(2)
+         y=array(ones(2),mask=[False,True])
 
+         z = concatenate((x,y))
+         assert_array_equal(z,[0,0,1,1])
+         assert_array_equal(z.mask,[False,False,False,True])
+
+         z = concatenate((y,x))
+         assert_array_equal(z,[1,1,0,0])
+         assert_array_equal(z.mask,[False,True,False,False])
+
+
 #..............................................................................
 
 ###############################################################################



More information about the Numpy-svn mailing list