diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2013-04-27 17:13:00 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-04-27 17:13:00 -0700 |
commit | a8805f65d25e7268a722da47d490167d99e1559f (patch) | |
tree | 06479320aa579fddb485c9c99b1625c53c0888a3 | |
parent | 0d9eac4bb25d43f3908efc54fd59348345e06c54 (diff) | |
parent | abaf953637e92a622c1b0d797ec77f05a7c6e600 (diff) | |
download | numpy-a8805f65d25e7268a722da47d490167d99e1559f.tar.gz |
Merge pull request #3265 from jamestwebber/patch-2
Update masked array copy to preserve array order
-rw-r--r-- | numpy/ma/core.py | 4 | ||||
-rw-r--r-- | numpy/ma/tests/test_core.py | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py index e1e848206..38076e8b3 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -3438,12 +3438,12 @@ class MaskedArray(ndarray): return np.asanyarray(fill_value) # if m.dtype.names: - result = self._data.copy() + result = self._data.copy('K') _recursive_filled(result, self._mask, fill_value) elif not m.any(): return self._data else: - result = self._data.copy() + result = self._data.copy('K') try: np.copyto(result, fill_value, where=m) except (TypeError, AttributeError): diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py index f14891087..263a9735a 100644 --- a/numpy/ma/tests/test_core.py +++ b/numpy/ma/tests/test_core.py @@ -537,6 +537,15 @@ class TestMaskedArray(TestCase): assert_equal(test, control) + def test_filled_w_f_order(self): + "Test filled w/ F-contiguous array" + a = array(np.array([(0, 1, 2), (4, 5, 6)], order='F'), + mask=np.array([(0, 0, 1), (1, 0, 0)], order='F'), + order='F') # this is currently ignored + self.assertTrue(a.flags['F_CONTIGUOUS']) + self.assertTrue(a.filled(0).flags['F_CONTIGUOUS']) + + def test_optinfo_propagation(self): "Checks that _optinfo dictionary isn't back-propagated" x = array([1, 2, 3, ], dtype=float) |