MCPcopy Create free account
hub / github.com/numpy/numpy / check_clump

Method check_clump

numpy/ma/tests/test_extras.py:110–124  ·  view source on GitHub ↗
(self, f)

Source from the content-addressed store, hash-verified

108 assert_equal(test, control)
109
110 def check_clump(self, f):
111 for i in range(1, 7):
112 for j in range(2**i):
113 k = np.arange(i, dtype=int)
114 ja = np.full(i, j, dtype=int)
115 a = masked_array(2**k)
116 a.mask = (ja & (2**k)) != 0
117 s = 0
118 for sl in f(a):
119 s += a.data[sl].sum()
120 if f == clump_unmasked:
121 assert_equal(a.compressed().sum(), s)
122 else:
123 a.mask = ~a.mask
124 assert_equal(a.compressed().sum(), s)
125
126 def test_clump_masked(self):
127 # Test clump_masked

Callers 2

test_clump_maskedMethod · 0.95
test_clump_unmaskedMethod · 0.95

Calls 4

assert_equalFunction · 0.90
fFunction · 0.85
sumMethod · 0.45
compressedMethod · 0.45

Tested by

no test coverage detected