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

Method test_2d_waxis

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

Source from the content-addressed store, hash-verified

1061 assert_equal(median(z.T, axis=1), np.zeros(p))
1062
1063 def test_2d_waxis(self):
1064 # Tests median w/ 2D arrays and different axis.
1065 x = masked_array(np.arange(30).reshape(10, 3))
1066 x[:3] = x[-3:] = masked
1067 assert_equal(median(x), 14.5)
1068 assert_(type(np.ma.median(x)) is not MaskedArray)
1069 assert_equal(median(x, axis=0), [13.5, 14.5, 15.5])
1070 assert_(type(np.ma.median(x, axis=0)) is MaskedArray)
1071 assert_equal(median(x, axis=1), [0, 0, 0, 10, 13, 16, 19, 0, 0, 0])
1072 assert_(type(np.ma.median(x, axis=1)) is MaskedArray)
1073 assert_equal(median(x, axis=1).mask, [1, 1, 1, 0, 0, 0, 0, 1, 1, 1])
1074
1075 def test_3d(self):
1076 # Tests median w/ 3D

Callers

nothing calls this directly

Calls 4

assert_equalFunction · 0.90
medianFunction · 0.90
assert_Function · 0.85
reshapeMethod · 0.80

Tested by

no test coverage detected