MCPcopy Create free account
hub / github.com/numpy/numpy / test_2d_with_missing

Method test_2d_with_missing

numpy/ma/tests/test_extras.py:1388–1405  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1386 corrcoef(x, x[::-1], ddof=2))
1387
1388 def test_2d_with_missing(self):
1389 # Test corrcoef on 2D variable w/ missing value
1390 x = self.data
1391 x[-1] = masked
1392 x = x.reshape(3, 4)
1393
1394 test = corrcoef(x)
1395 control = np.corrcoef(x)
1396 assert_almost_equal(test[:-1, :-1], control[:-1, :-1])
1397 with suppress_warnings() as sup:
1398 sup.filter(DeprecationWarning, "bias and ddof have no effect")
1399 # ddof and bias have no or negligible effect on the function
1400 assert_almost_equal(corrcoef(x, ddof=-2)[:-1, :-1],
1401 control[:-1, :-1])
1402 assert_almost_equal(corrcoef(x, ddof=3)[:-1, :-1],
1403 control[:-1, :-1])
1404 assert_almost_equal(corrcoef(x, bias=1)[:-1, :-1],
1405 control[:-1, :-1])
1406
1407
1408class TestPolynomial:

Callers

nothing calls this directly

Calls 5

corrcoefFunction · 0.90
assert_almost_equalFunction · 0.90
suppress_warningsClass · 0.90
reshapeMethod · 0.80
filterMethod · 0.80

Tested by

no test coverage detected