MCPcopy Index your code
hub / github.com/numpy/numpy / test_1d_with_missing

Method test_1d_with_missing

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

Source from the content-addressed store, hash-verified

1421 corrcoef(x, rowvar=False))
1422
1423 def test_1d_with_missing(self):
1424 # Test corrcoef 1 1D variable w/missing values
1425 x = self._create_data()[0]
1426 x[-1] = masked
1427 x -= x.mean()
1428 nx = x.compressed()
1429 assert_almost_equal(np.corrcoef(nx, rowvar=False),
1430 corrcoef(x, rowvar=False))
1431 try:
1432 corrcoef(x, allow_masked=False)
1433 except ValueError:
1434 pass
1435 # 2 1D variables w/ missing values
1436 nx = x[1:-1]
1437 assert_almost_equal(np.corrcoef(nx, nx[::-1]), corrcoef(x, x[::-1]))
1438 assert_almost_equal(np.corrcoef(nx, nx[::-1], rowvar=False),
1439 corrcoef(x, x[::-1], rowvar=False))
1440
1441 def test_2d_with_missing(self):
1442 # Test corrcoef on 2D variable w/ missing value

Callers

nothing calls this directly

Calls 5

_create_dataMethod · 0.95
assert_almost_equalFunction · 0.90
corrcoefFunction · 0.90
meanMethod · 0.45
compressedMethod · 0.45

Tested by

no test coverage detected