diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-01-06 05:22:27 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-01-06 05:22:27 +0000 |
commit | 4ac586f3122cefbbced1a890185645709d219a73 (patch) | |
tree | 3a14a34c28bcd220d43e1958670f9457fcbc8635 /numpy/core/ma.py | |
parent | 842f9779b63236828785322b5d4a7fc53950a404 (diff) | |
download | numpy-4ac586f3122cefbbced1a890185645709d219a73.tar.gz |
Fix-up so that masked array returns masked array when ufunc does the adding.
Diffstat (limited to 'numpy/core/ma.py')
-rw-r--r-- | numpy/core/ma.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/numpy/core/ma.py b/numpy/core/ma.py index df71ee825..063baa455 100644 --- a/numpy/core/ma.py +++ b/numpy/core/ma.py @@ -526,6 +526,7 @@ class MaskedArray (object): such as when printing and in method/function filled(). The fill_value is not used for computation within this module. """ + __array_priority__ = 10.1 def __init__(self, data, dtype=None, copy=True, fortran=False, mask=None, fill_value=None): """array(data, dtype=None, copy=True, fortran=False, mask=None, fill_value=None) @@ -607,6 +608,12 @@ class MaskedArray (object): else: return self._data + def __array_wrap__ (self, array): + """Special hook for ufuncs. Converts to Masked array with + the same mask as self.""" + return MaskedArray(array, copy=False, mask=self._mask, + fill_value = self._fill_value) + def _get_shape(self): "Return the current shape." return self._data.shape |