(self)
| 5319 | _test_index(-2) # All element masked |
| 5320 | |
| 5321 | def test_setitem(self): |
| 5322 | # Issue 4866: check that one can set individual items in [record][col] |
| 5323 | # and [col][record] order |
| 5324 | ndtype = np.dtype([('a', float), ('b', int)]) |
| 5325 | ma = np.ma.MaskedArray([(1.0, 1), (2.0, 2)], dtype=ndtype) |
| 5326 | ma['a'][1] = 3.0 |
| 5327 | assert_equal(ma['a'], np.array([1.0, 3.0])) |
| 5328 | ma[1]['a'] = 4.0 |
| 5329 | assert_equal(ma['a'], np.array([1.0, 4.0])) |
| 5330 | # Issue 2403 |
| 5331 | mdtype = np.dtype([('a', bool), ('b', bool)]) |
| 5332 | # soft mask |
| 5333 | control = np.array([(False, True), (True, True)], dtype=mdtype) |
| 5334 | a = np.ma.masked_all((2,), dtype=ndtype) |
| 5335 | a['a'][0] = 2 |
| 5336 | assert_equal(a.mask, control) |
| 5337 | a = np.ma.masked_all((2,), dtype=ndtype) |
| 5338 | a[0]['a'] = 2 |
| 5339 | assert_equal(a.mask, control) |
| 5340 | # hard mask |
| 5341 | control = np.array([(True, True), (True, True)], dtype=mdtype) |
| 5342 | a = np.ma.masked_all((2,), dtype=ndtype) |
| 5343 | a.harden_mask() |
| 5344 | a['a'][0] = 2 |
| 5345 | assert_equal(a.mask, control) |
| 5346 | a = np.ma.masked_all((2,), dtype=ndtype) |
| 5347 | a.harden_mask() |
| 5348 | a[0]['a'] = 2 |
| 5349 | assert_equal(a.mask, control) |
| 5350 | |
| 5351 | def test_setitem_scalar(self): |
| 5352 | # 8510 |
nothing calls this directly
no test coverage detected