diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2016-08-29 22:10:10 +0200 |
---|---|---|
committer | Sebastian Berg <sebastian@sipsolutions.net> | 2016-09-02 10:10:55 +0200 |
commit | f078cb484aa46dd6834c92ac25c587fa36cd727a (patch) | |
tree | e4830c9b2e036daee0c7b7cfc785decadc8fa383 /numpy | |
parent | 9bf7d1475468e16b7dcac93eb85338930f16ea4d (diff) | |
download | numpy-f078cb484aa46dd6834c92ac25c587fa36cd727a.tar.gz |
ENH: Masked array simplify copying back of unchanged values
Also silences a spurious warning during tests (the multiplication
could give a warning).
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/ma/core.py | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py index b01656ec9..b1e48c156 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -1032,12 +1032,7 @@ class _MaskedBinaryOperation: if m is not nomask and m.any(): # any errors, just abort; impossible to guarantee masked values try: - np.copyto(result, 0, casting='unsafe', where=m) - # avoid using "*" since this may be overlaid - masked_da = umath.multiply(m, da) - # only add back if it can be cast safely - if np.can_cast(masked_da.dtype, result.dtype, casting='safe'): - result += masked_da + np.copyto(result, da, casting='unsafe', where=m) except: pass |