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

Method test_period

numpy/lib/tests/test_function_base.py:2246–2262  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2244 assert_(np.all(diff(unwrap(rand(10) * 100)) < np.pi))
2245
2246 def test_period(self):
2247 # check that unwrap removes jumps greater that 255
2248 assert_array_equal(unwrap([1, 1 + 256], period=255), [1, 2])
2249 # check that unwrap maintains continuity
2250 assert_(np.all(diff(unwrap(rand(10) * 1000, period=255)) < 255))
2251 # check simple case
2252 simple_seq = np.array([0, 75, 150, 225, 300])
2253 wrap_seq = np.mod(simple_seq, 255)
2254 assert_array_equal(unwrap(wrap_seq, period=255), simple_seq)
2255 # check custom discont value
2256 uneven_seq = np.array([0, 75, 150, 225, 300, 430])
2257 wrap_uneven = np.mod(uneven_seq, 250)
2258 no_discont = unwrap(wrap_uneven, period=250)
2259 assert_array_equal(no_discont, [0, 75, 150, 225, 300, 180])
2260 sm_discont = unwrap(wrap_uneven, period=250, discont=140)
2261 assert_array_equal(sm_discont, [0, 75, 150, 225, 300, 430])
2262 assert sm_discont.dtype == wrap_uneven.dtype
2263
2264
2265@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 6

assert_array_equalFunction · 0.90
unwrapFunction · 0.90
assert_Function · 0.90
diffFunction · 0.90
randFunction · 0.85
allMethod · 0.45

Tested by

no test coverage detected