[Numpy-svn] r6327 - trunk/numpy/lib

numpy-svn at scipy.org numpy-svn at scipy.org
Mon Jan 19 04:01:43 EST 2009


Author: pierregm
Date: 2009-01-19 03:01:24 -0600 (Mon, 19 Jan 2009)
New Revision: 6327

Modified:
   trunk/numpy/lib/arraysetops.py
Log:
* replace np.asarray by np.asanyarray in unique1d


Modified: trunk/numpy/lib/arraysetops.py
===================================================================
--- trunk/numpy/lib/arraysetops.py	2009-01-19 08:53:53 UTC (rev 6326)
+++ trunk/numpy/lib/arraysetops.py	2009-01-19 09:01:24 UTC (rev 6327)
@@ -52,13 +52,19 @@
         If provided, this number will be taked onto the beginning of the
         returned differences.
 
+    Notes
+    -----
+    When applied to masked arrays, this function drops the mask information
+    if the `to_begin` and/or `to_end` parameters are used
+
+
     Returns
     -------
     ed : array
         The differences. Loosely, this will be (ary[1:] - ary[:-1]).
 
     """
-    ary = np.asarray(ary).flat
+    ary = np.asanyarray(ary).flat
     ed = ary[1:] - ary[:-1]
     arrays = [ed]
     if to_begin is not None:
@@ -132,7 +138,7 @@
                       "the output was (indices, unique_arr), but "
                       "has now been reversed to be more consistent.")
 
-    ar = np.asarray(ar1).flatten()
+    ar = np.asanyarray(ar1).flatten()
     if ar.size == 0:
         if return_inverse and return_index:
             return ar, np.empty(0, np.bool), np.empty(0, np.bool)




More information about the Numpy-svn mailing list