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

Method test_2d_waxis

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

Source from the content-addressed store, hash-verified

973 assert_equal(median(z.T, axis=1), np.zeros(p))
974
975 def test_2d_waxis(self):
976 # Tests median w/ 2D arrays and different axis.
977 x = masked_array(np.arange(30).reshape(10, 3))
978 x[:3] = x[-3:] = masked
979 assert_equal(median(x), 14.5)
980 assert_(type(np.ma.median(x)) is not MaskedArray)
981 assert_equal(median(x, axis=0), [13.5, 14.5, 15.5])
982 assert_(type(np.ma.median(x, axis=0)) is MaskedArray)
983 assert_equal(median(x, axis=1), [0, 0, 0, 10, 13, 16, 19, 0, 0, 0])
984 assert_(type(np.ma.median(x, axis=1)) is MaskedArray)
985 assert_equal(median(x, axis=1).mask, [1, 1, 1, 0, 0, 0, 0, 1, 1, 1])
986
987 def test_3d(self):
988 # Tests median w/ 3D

Callers

nothing calls this directly

Calls 4

assert_equalFunction · 0.90
medianFunction · 0.90
reshapeMethod · 0.80
assert_Function · 0.50

Tested by

no test coverage detected