diff options
author | pierregm <pierregm@localhost> | 2010-04-27 16:55:09 +0000 |
---|---|---|
committer | pierregm <pierregm@localhost> | 2010-04-27 16:55:09 +0000 |
commit | 1e659b5ab591d47449b73481f2335a7a850495b7 (patch) | |
tree | 654bc5294ba7bcadd214383a6caad55508dc0009 /numpy/ma/tests | |
parent | 56647963b940e56571ae9638e7c5f77ed58aadbb (diff) | |
download | numpy-1e659b5ab591d47449b73481f2335a7a850495b7.tar.gz |
Fixed .var for arrays with 1 more valid value than ddofs
Diffstat (limited to 'numpy/ma/tests')
-rw-r--r-- | numpy/ma/tests/test_core.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py index 014af2d73..f95d621db 100644 --- a/numpy/ma/tests/test_core.py +++ b/numpy/ma/tests/test_core.py @@ -199,7 +199,7 @@ class TestMaskedArray(TestCase): err_status_ini = np.geterr() try: np.seterr(invalid='ignore') - data = masked_array(np.sqrt([-1., 0., 1.]), mask=[0, 0, 1]) + data = masked_array([np.nan, 0., 1.], mask=[0, 0, 1]) data_fixed = fix_invalid(data) assert_equal(data_fixed._data, [data.fill_value, 0., 1.]) assert_equal(data_fixed._mask, [1., 0., 1.]) @@ -2707,6 +2707,19 @@ class TestMaskedArrayMathMethods(TestCase): self.assertTrue(np.isnan(nout)) + def test_varstd_ddof(self): + a = array([[1, 1, 0], [1, 1, 0]], mask=[[0, 0, 1], [0, 0, 1]]) + test = a.std(axis=0, ddof=0) + assert_equal(test.filled(0), [0, 0, 0]) + assert_equal(test.mask, [0, 0, 1]) + test = a.std(axis=0, ddof=1) + assert_equal(test.filled(0), [0, 0, 0]) + assert_equal(test.mask, [0, 0, 1]) + test = a.std(axis=0, ddof=2) + assert_equal(test.filled(0), [0, 0, 0]) + assert_equal(test.mask, [1, 1, 1]) + + def test_diag(self): "Test diag" x = arange(9).reshape((3, 3)) |