(self, axis)
| 1130 | ] |
| 1131 | ) |
| 1132 | def test_keepdims_out(self, axis): |
| 1133 | mask = np.zeros((3, 5, 7, 11), dtype=bool) |
| 1134 | # Randomly set some elements to True: |
| 1135 | w = np.random.random((4, 200)) * np.array(mask.shape)[:, None] |
| 1136 | w = w.astype(np.intp) |
| 1137 | mask[tuple(w)] = np.nan |
| 1138 | d = masked_array(np.ones(mask.shape), mask=mask) |
| 1139 | if axis is None: |
| 1140 | shape_out = (1,) * d.ndim |
| 1141 | else: |
| 1142 | axis_norm = normalize_axis_tuple(axis, d.ndim) |
| 1143 | shape_out = tuple( |
| 1144 | 1 if i in axis_norm else d.shape[i] for i in range(d.ndim)) |
| 1145 | out = masked_array(np.empty(shape_out)) |
| 1146 | result = median(d, axis=axis, keepdims=True, out=out) |
| 1147 | assert result is out |
| 1148 | assert_equal(result.shape, shape_out) |
| 1149 | |
| 1150 | def test_single_non_masked_value_on_axis(self): |
| 1151 | data = [[1., 0.], |
nothing calls this directly
no test coverage detected