|
| 1 | +import naive |
| 2 | +import numpy as np |
| 3 | +import numpy.testing as npt |
| 4 | +import pytest |
| 5 | + |
| 6 | +from stumpy import maamp, mstump |
| 7 | + |
| 8 | +test_data = [ |
| 9 | + (np.array([[584, -11, 23, 79, 1001, 0, -19]], dtype=np.float64), 3), |
| 10 | + (np.random.uniform(-1000, 1000, [5, 20]).astype(np.float64), 5), |
| 11 | +] |
| 12 | + |
| 13 | + |
| 14 | +@pytest.mark.parametrize("T, m", test_data) |
| 15 | +def test_mmparray_mstump(T, m): |
| 16 | + excl_zone = int(np.ceil(m / 4)) |
| 17 | + |
| 18 | + ref_P, ref_I = naive.mstump(T, m, excl_zone) |
| 19 | + comp = mstump(T, m) |
| 20 | + |
| 21 | + npt.assert_almost_equal(ref_P, comp.P_) |
| 22 | + npt.assert_almost_equal(ref_I, comp.I_) |
| 23 | + |
| 24 | + |
| 25 | +@pytest.mark.parametrize("T, m", test_data) |
| 26 | +def test_mmparray_maamp(T, m): |
| 27 | + excl_zone = int(np.ceil(m / 4)) |
| 28 | + |
| 29 | + for p in [1.0, 2.0, 3.0]: |
| 30 | + ref_P, ref_I = naive.maamp(T, m, excl_zone, p=p) |
| 31 | + comp = maamp(T, m, p=p) |
| 32 | + |
| 33 | + npt.assert_almost_equal(ref_P, comp.P_) |
| 34 | + npt.assert_almost_equal(ref_I, comp.I_) |
0 commit comments