(self)
| 957 | np.ma.median(array([1,2,3],mask=[0,1,0])).shape ) |
| 958 | |
| 959 | def test_2d(self): |
| 960 | # Tests median w/ 2D |
| 961 | (n, p) = (101, 30) |
| 962 | x = masked_array(np.linspace(-1., 1., n),) |
| 963 | x[:10] = x[-10:] = masked |
| 964 | z = masked_array(np.empty((n, p), dtype=float)) |
| 965 | z[:, 0] = x[:] |
| 966 | idx = np.arange(len(x)) |
| 967 | for i in range(1, p): |
| 968 | np.random.shuffle(idx) |
| 969 | z[:, i] = x[idx] |
| 970 | assert_equal(median(z[:, 0]), 0) |
| 971 | assert_equal(median(z), 0) |
| 972 | assert_equal(median(z, axis=0), np.zeros(p)) |
| 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. |
nothing calls this directly
no test coverage detected