(self, axis)
| 1042 | ] |
| 1043 | ) |
| 1044 | def test_keepdims_out(self, axis): |
| 1045 | mask = np.zeros((3, 5, 7, 11), dtype=bool) |
| 1046 | # Randomly set some elements to True: |
| 1047 | w = np.random.random((4, 200)) * np.array(mask.shape)[:, None] |
| 1048 | w = w.astype(np.intp) |
| 1049 | mask[tuple(w)] = np.nan |
| 1050 | d = masked_array(np.ones(mask.shape), mask=mask) |
| 1051 | if axis is None: |
| 1052 | shape_out = (1,) * d.ndim |
| 1053 | else: |
| 1054 | axis_norm = normalize_axis_tuple(axis, d.ndim) |
| 1055 | shape_out = tuple( |
| 1056 | 1 if i in axis_norm else d.shape[i] for i in range(d.ndim)) |
| 1057 | out = masked_array(np.empty(shape_out)) |
| 1058 | result = median(d, axis=axis, keepdims=True, out=out) |
| 1059 | assert result is out |
| 1060 | assert_equal(result.shape, shape_out) |
| 1061 | |
| 1062 | def test_single_non_masked_value_on_axis(self): |
| 1063 | data = [[1., 0.], |
nothing calls this directly
no test coverage detected