Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions tests/test_mpdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ def test_mpdist_vect(T_A, T_B):
T_subseq_isconstant = naive.rolling_isconstant(T_B, m)
μ_Q, σ_Q = naive.compute_mean_std(T_A, m)
M_T, Σ_T = naive.compute_mean_std(T_B, m)
comp_mpdist_vect = _mpdist_vect(
cmp_mpdist_vect = _mpdist_vect(
T_A, T_B, m, μ_Q, σ_Q, M_T, Σ_T, Q_subseq_isconstant, T_subseq_isconstant
)

npt.assert_almost_equal(ref_mpdist_vect, comp_mpdist_vect)
npt.assert_allclose(cmp_mpdist_vect, ref_mpdist_vect, atol=1.5e-07)


@pytest.mark.parametrize("T_A, T_B", test_data)
Expand All @@ -67,7 +67,7 @@ def test_mpdist_vect_percentage(T_A, T_B, percentage):
T_subseq_isconstant = naive.rolling_isconstant(T_B, m)
μ_Q, σ_Q = naive.compute_mean_std(T_A, m)
M_T, Σ_T = naive.compute_mean_std(T_B, m)
comp_mpdist_vect = _mpdist_vect(
cmp_mpdist_vect = _mpdist_vect(
T_A,
T_B,
m,
Expand All @@ -80,7 +80,7 @@ def test_mpdist_vect_percentage(T_A, T_B, percentage):
percentage=percentage,
)

npt.assert_almost_equal(ref_mpdist_vect, comp_mpdist_vect)
npt.assert_allclose(cmp_mpdist_vect, ref_mpdist_vect, atol=1.5e-07)


@pytest.mark.parametrize("T_A, T_B", test_data)
Expand All @@ -93,20 +93,20 @@ def test_mpdist_vect_k(T_A, T_B, k):
T_subseq_isconstant = naive.rolling_isconstant(T_B, m)
μ_Q, σ_Q = naive.compute_mean_std(T_A, m)
M_T, Σ_T = naive.compute_mean_std(T_B, m)
comp_mpdist_vect = _mpdist_vect(
cmp_mpdist_vect = _mpdist_vect(
T_A, T_B, m, μ_Q, σ_Q, M_T, Σ_T, Q_subseq_isconstant, T_subseq_isconstant, k=k
)

npt.assert_almost_equal(ref_mpdist_vect, comp_mpdist_vect)
npt.assert_allclose(cmp_mpdist_vect, ref_mpdist_vect, atol=1.5e-07)


@pytest.mark.parametrize("T_A, T_B", test_data)
def test_mpdist(T_A, T_B):
m = 3
ref_mpdist = naive.mpdist(T_A, T_B, m)
comp_mpdist = mpdist(T_A, T_B, m)
cmp_mpdist = mpdist(T_A, T_B, m)

npt.assert_almost_equal(ref_mpdist, comp_mpdist)
npt.assert_allclose(cmp_mpdist, ref_mpdist, atol=1.5e-07)


@pytest.mark.parametrize("T_A, T_B", test_data)
Expand All @@ -125,35 +125,35 @@ def test_mpdist_with_isconstant(T_A, T_B):
T_A_subseq_isconstant=T_A_subseq_isconstant,
T_B_subseq_isconstant=T_B_subseq_isconstant,
)
comp_mpdist = mpdist(
cmp_mpdist = mpdist(
T_A,
T_B,
m,
T_A_subseq_isconstant=T_A_subseq_isconstant,
T_B_subseq_isconstant=T_B_subseq_isconstant,
)

npt.assert_almost_equal(ref_mpdist, comp_mpdist)
npt.assert_allclose(cmp_mpdist, ref_mpdist, atol=1.5e-07)


@pytest.mark.parametrize("T_A, T_B", test_data)
@pytest.mark.parametrize("percentage", percentage)
def test_mpdist_percentage(T_A, T_B, percentage):
m = 3
ref_mpdist = naive.mpdist(T_A, T_B, m, percentage=percentage)
comp_mpdist = mpdist(T_A, T_B, m, percentage=percentage)
cmp_mpdist = mpdist(T_A, T_B, m, percentage=percentage)

npt.assert_almost_equal(ref_mpdist, comp_mpdist)
npt.assert_allclose(cmp_mpdist, ref_mpdist, atol=1.5e-07)


@pytest.mark.parametrize("T_A, T_B", test_data)
@pytest.mark.parametrize("k", k)
def test_mpdist_k(T_A, T_B, k):
m = 3
ref_mpdist = naive.mpdist(T_A, T_B, m, k=k)
comp_mpdist = mpdist(T_A, T_B, m, k=k)
cmp_mpdist = mpdist(T_A, T_B, m, k=k)

npt.assert_almost_equal(ref_mpdist, comp_mpdist)
npt.assert_allclose(cmp_mpdist, ref_mpdist, atol=1.5e-07)


@pytest.mark.filterwarnings("ignore:numpy.dtype size changed")
Expand All @@ -165,9 +165,9 @@ def test_mpdisted(T_A, T_B, dask_cluster):
with Client(dask_cluster) as dask_client:
m = 3
ref_mpdist = naive.mpdist(T_A, T_B, m)
comp_mpdist = mpdisted(dask_client, T_A, T_B, m)
cmp_mpdist = mpdisted(dask_client, T_A, T_B, m)

npt.assert_almost_equal(ref_mpdist, comp_mpdist)
npt.assert_allclose(cmp_mpdist, ref_mpdist, atol=1.5e-07)


@pytest.mark.filterwarnings("ignore:numpy.dtype size changed")
Expand All @@ -191,7 +191,7 @@ def test_mpdisted_with_isconstant(T_A, T_B, dask_cluster):
T_A_subseq_isconstant=T_A_subseq_isconstant,
T_B_subseq_isconstant=T_B_subseq_isconstant,
)
comp_mpdist = mpdisted(
cmp_mpdist = mpdisted(
dask_client,
T_A,
T_B,
Expand All @@ -200,7 +200,7 @@ def test_mpdisted_with_isconstant(T_A, T_B, dask_cluster):
T_B_subseq_isconstant=T_B_subseq_isconstant,
)

npt.assert_almost_equal(ref_mpdist, comp_mpdist)
npt.assert_allclose(cmp_mpdist, ref_mpdist, atol=1.5e-07)


@pytest.mark.parametrize("T_A, T_B", test_data)
Expand All @@ -225,8 +225,8 @@ def test_mpdist_vect_with_isconstant(T_A, T_B):
T_subseq_isconstant = T_B_subseq_isconstant
μ_Q, σ_Q = naive.compute_mean_std(T_A, m)
M_T, Σ_T = naive.compute_mean_std(T_B, m)
comp_mpdist_vect = _mpdist_vect(
cmp_mpdist_vect = _mpdist_vect(
T_A, T_B, m, μ_Q, σ_Q, M_T, Σ_T, Q_subseq_isconstant, T_subseq_isconstant
)

npt.assert_almost_equal(ref_mpdist_vect, comp_mpdist_vect)
npt.assert_allclose(cmp_mpdist_vect, ref_mpdist_vect, atol=1.5e-07)
Loading