(self)
| 3690 | array([[10, 30], [40, 60]], mask=[[0, 1], [1, 0]])) |
| 3691 | |
| 3692 | def test_take_masked_indices(self): |
| 3693 | # Test take w/ masked indices |
| 3694 | a = np.array((40, 18, 37, 9, 22)) |
| 3695 | indices = np.arange(3)[None,:] + np.arange(5)[:, None] |
| 3696 | mindices = array(indices, mask=(indices >= len(a))) |
| 3697 | # No mask |
| 3698 | test = take(a, mindices, mode='clip') |
| 3699 | ctrl = array([[40, 18, 37], |
| 3700 | [18, 37, 9], |
| 3701 | [37, 9, 22], |
| 3702 | [9, 22, 22], |
| 3703 | [22, 22, 22]]) |
| 3704 | assert_equal(test, ctrl) |
| 3705 | # Masked indices |
| 3706 | test = take(a, mindices) |
| 3707 | ctrl = array([[40, 18, 37], |
| 3708 | [18, 37, 9], |
| 3709 | [37, 9, 22], |
| 3710 | [9, 22, 40], |
| 3711 | [22, 40, 40]]) |
| 3712 | ctrl[3, 2] = ctrl[4, 1] = ctrl[4, 2] = masked |
| 3713 | assert_equal(test, ctrl) |
| 3714 | assert_equal(test.mask, ctrl.mask) |
| 3715 | # Masked input + masked indices |
| 3716 | a = array((40, 18, 37, 9, 22), mask=(0, 1, 0, 0, 0)) |
| 3717 | test = take(a, mindices) |
| 3718 | ctrl[0, 1] = ctrl[1, 0] = masked |
| 3719 | assert_equal(test, ctrl) |
| 3720 | assert_equal(test.mask, ctrl.mask) |
| 3721 | |
| 3722 | def test_tolist(self): |
| 3723 | # Tests to list |
nothing calls this directly
no test coverage detected