MCPcopy Index your code
hub / github.com/numpy/numpy / check_clump

Method check_clump

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

Source from the content-addressed store, hash-verified

145 assert_equal(test, control)
146
147 def check_clump(self, f):
148 for i in range(1, 7):
149 for j in range(2**i):
150 k = np.arange(i, dtype=int)
151 ja = np.full(i, j, dtype=int)
152 a = masked_array(2**k)
153 a.mask = (ja & (2**k)) != 0
154 s = 0
155 for sl in f(a):
156 s += a.data[sl].sum()
157 if f == clump_unmasked:
158 assert_equal(a.compressed().sum(), s)
159 else:
160 a.mask = ~a.mask
161 assert_equal(a.compressed().sum(), s)
162
163 def test_clump_masked(self):
164 # Test clump_masked

Callers 2

test_clump_maskedMethod · 0.95
test_clump_unmaskedMethod · 0.95

Calls 4

assert_equalFunction · 0.90
fFunction · 0.50
sumMethod · 0.45
compressedMethod · 0.45

Tested by

no test coverage detected