[Scipy-svn] r2483 - trunk/Lib/sandbox/maskedarray

scipy-svn at scipy.org scipy-svn at scipy.org
Wed Jan 3 15:31:21 CST 2007


Author: pierregm
Date: 2007-01-03 15:31:12 -0600 (Wed, 03 Jan 2007)
New Revision: 2483

Modified:
   trunk/Lib/sandbox/maskedarray/CHANGELOG
   trunk/Lib/sandbox/maskedarray/core.py
   trunk/Lib/sandbox/maskedarray/extras.py
Log:
cf changelog

Modified: trunk/Lib/sandbox/maskedarray/CHANGELOG
===================================================================
--- trunk/Lib/sandbox/maskedarray/CHANGELOG	2007-01-03 20:26:24 UTC (rev 2482)
+++ trunk/Lib/sandbox/maskedarray/CHANGELOG	2007-01-03 21:31:12 UTC (rev 2483)
@@ -1,3 +1,7 @@
+#2007-01-02 : Extras
+#           : - Made sure that apply_along_axis output the proper fill_value 
+#           : Core
+#           : - Can use dtypes for the definition of default_fill_value
 #2006-12-30 : Core
 #			: - Cleaned up setitem/setslice w/ hard_mask=True
 #			: - Fixed masked_unary/binary_operations to work with subclasses of MaskedArray

Modified: trunk/Lib/sandbox/maskedarray/core.py
===================================================================
--- trunk/Lib/sandbox/maskedarray/core.py	2007-01-03 20:26:24 UTC (rev 2482)
+++ trunk/Lib/sandbox/maskedarray/core.py	2007-01-03 21:31:12 UTC (rev 2483)
@@ -163,6 +163,8 @@
         return default_filler['S']
     elif isinstance(obj, complex):
         return default_filler['c']
+    elif isinstance(obj, numeric.dtype):
+        return default_filler[obj.kind]
     else:
         return default_filler['O']
 

Modified: trunk/Lib/sandbox/maskedarray/extras.py
===================================================================
--- trunk/Lib/sandbox/maskedarray/extras.py	2007-01-03 20:26:24 UTC (rev 2482)
+++ trunk/Lib/sandbox/maskedarray/extras.py	2007-01-03 21:31:12 UTC (rev 2483)
@@ -231,12 +231,14 @@
             outarr[tuple(i.tolist())] = res
             dtypes.append(asarray(res).dtype)
             k += 1
+    max_dtypes = numeric.dtype(numeric.asarray(dtypes).max())
     if not hasattr(arr, '_mask'):
-        return numeric.asarray(outarr, dtype=max(dtypes))
+        result = numeric.asarray(outarr, dtype=max_dtypes)
     else:
-        return outarr.astype(max(dtypes))
+        result = core.asarray(outarr, dtype=max_dtypes)
+        result.fill_value = core.default_fill_value(result)
+    return result
 
-
 def average (a, axis=None, weights=None, returned = 0):
     """average(a, axis=None weights=None, returned=False)
 



More information about the Scipy-svn mailing list