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

Method test_ptp

numpy/ma/tests/test_core.py:4165–4177  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4163 assert_(result is output)
4164
4165 def test_ptp(self):
4166 # Tests ptp on MaskedArrays.
4167 _, X, _, m, mx, mX, _, _, _, _ = self._create_data()
4168 (n, m) = X.shape
4169 assert_equal(mx.ptp(), np.ptp(mx.compressed()))
4170 rows = np.zeros(n, float)
4171 cols = np.zeros(m, float)
4172 for k in range(m):
4173 cols[k] = np.ptp(mX[:, k].compressed())
4174 for k in range(n):
4175 rows[k] = np.ptp(mX[k].compressed())
4176 assert_equal(mX.ptp(0), cols)
4177 assert_equal(mX.ptp(1), rows)
4178
4179 def test_add_object(self):
4180 x = masked_array(['a', 'b'], mask=[1, 0], dtype=object)

Callers

nothing calls this directly

Calls 4

_create_dataMethod · 0.95
assert_equalFunction · 0.90
ptpMethod · 0.45
compressedMethod · 0.45

Tested by

no test coverage detected