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
64 changes: 32 additions & 32 deletions tests/test_maamped.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ def test_maamped(T, m, dask_cluster):
excl_zone = int(np.ceil(m / 4))

ref_P, ref_I = naive.maamp(T, m, excl_zone)
comp_P, comp_I = maamped(dask_client, T, m)
cmp_P, cmp_I = maamped(dask_client, T, m)

npt.assert_almost_equal(ref_P, comp_P)
npt.assert_almost_equal(ref_I, comp_I)
npt.assert_allclose(cmp_P, ref_P, atol=1.5e-07)
npt.assert_allclose(cmp_I, ref_I, atol=1.5e-07)


@pytest.mark.filterwarnings("ignore:\\s+Port 8787 is already in use:UserWarning")
Expand All @@ -63,10 +63,10 @@ def test_maamped_include(T, m, dask_cluster):
excl_zone = int(np.ceil(m / 4))

ref_P, ref_I = naive.maamp(T, m, excl_zone, include)
comp_P, comp_I = maamped(dask_client, T, m, include)
cmp_P, cmp_I = maamped(dask_client, T, m, include)

npt.assert_almost_equal(ref_P, comp_P)
npt.assert_almost_equal(ref_I, comp_I)
npt.assert_allclose(cmp_P, ref_P, atol=1.5e-07)
npt.assert_allclose(cmp_I, ref_I, atol=1.5e-07)


@pytest.mark.filterwarnings("ignore:\\s+Port 8787 is already in use:UserWarning")
Expand All @@ -76,10 +76,10 @@ def test_maamped_discords(T, m, dask_cluster):
excl_zone = int(np.ceil(m / 4))

ref_P, ref_I = naive.maamp(T, m, excl_zone, discords=True)
comp_P, comp_I = maamped(dask_client, T, m, discords=True)
cmp_P, cmp_I = maamped(dask_client, T, m, discords=True)

npt.assert_almost_equal(ref_P, comp_P)
npt.assert_almost_equal(ref_I, comp_I)
npt.assert_allclose(cmp_P, ref_P, atol=1.5e-07)
npt.assert_allclose(cmp_I, ref_I, atol=1.5e-07)


@pytest.mark.filterwarnings("ignore:\\s+Port 8787 is already in use:UserWarning")
Expand All @@ -93,10 +93,10 @@ def test_maamped_include_discords(T, m, dask_cluster):
excl_zone = int(np.ceil(m / 4))

ref_P, ref_I = naive.maamp(T, m, excl_zone, include, discords=True)
comp_P, comp_I = maamped(dask_client, T, m, include, discords=True)
cmp_P, cmp_I = maamped(dask_client, T, m, include, discords=True)

npt.assert_almost_equal(ref_P, comp_P)
npt.assert_almost_equal(ref_I, comp_I)
npt.assert_allclose(cmp_P, ref_P, atol=1.5e-07)
npt.assert_allclose(cmp_I, ref_I, atol=1.5e-07)


@pytest.mark.filterwarnings("ignore:\\s+Port 8787 is already in use:UserWarning")
Expand All @@ -107,10 +107,10 @@ def test_maamped_df(T, m, dask_cluster):

ref_P, ref_I = naive.maamp(T, m, excl_zone)
df = pd.DataFrame(T.T)
comp_P, comp_I = maamped(dask_client, df, m)
cmp_P, cmp_I = maamped(dask_client, df, m)

npt.assert_almost_equal(ref_P, comp_P)
npt.assert_almost_equal(ref_I, comp_I)
npt.assert_allclose(cmp_P, ref_P, atol=1.5e-07)
npt.assert_allclose(cmp_I, ref_I, atol=1.5e-07)


@pytest.mark.filterwarnings("ignore:\\s+Port 8787 is already in use:UserWarning")
Expand All @@ -125,9 +125,9 @@ def test_maamped_constant_subsequence_self_join(dask_cluster):
excl_zone = int(np.ceil(m / 4))

ref_P, ref_I = naive.maamp(T, m, excl_zone)
comp_P, comp_I = maamped(dask_client, T, m)
cmp_P, cmp_I = maamped(dask_client, T, m)

npt.assert_almost_equal(ref_P, comp_P) # ignore indices
npt.assert_allclose(cmp_P, ref_P, atol=1.5e-07) # ignore indices


@pytest.mark.filterwarnings("ignore:\\s+Port 8787 is already in use:UserWarning")
Expand All @@ -143,10 +143,10 @@ def test_maamped_identical_subsequence_self_join(dask_cluster):
excl_zone = int(np.ceil(m / 4))

ref_P, ref_I = naive.maamp(T, m, excl_zone)
comp_P, comp_I = maamped(dask_client, T, m)
cmp_P, cmp_I = maamped(dask_client, T, m)

npt.assert_almost_equal(
ref_P, comp_P, decimal=config.STUMPY_TEST_PRECISION
npt.assert_allclose(
cmp_P, ref_P, atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
) # ignore indices


Expand All @@ -163,10 +163,10 @@ def test_maamped_one_subsequence_inf_self_join_first_dimension(
T_sub[0, substitution_location] = np.inf

ref_P, ref_I = naive.maamp(T_sub, m, excl_zone)
comp_P, comp_I = maamped(dask_client, T_sub, m)
cmp_P, cmp_I = maamped(dask_client, T_sub, m)

npt.assert_almost_equal(ref_P, comp_P)
npt.assert_almost_equal(ref_I, comp_I)
npt.assert_allclose(cmp_P, ref_P, atol=1.5e-07)
npt.assert_allclose(cmp_I, ref_I, atol=1.5e-07)


@pytest.mark.filterwarnings("ignore:\\s+Port 8787 is already in use:UserWarning")
Expand All @@ -182,10 +182,10 @@ def test_maamped_one_subsequence_inf_self_join_all_dimensions(
T_sub[:, substitution_location] = np.inf

ref_P, ref_I = naive.maamp(T_sub, m, excl_zone)
comp_P, comp_I = maamped(dask_client, T_sub, m)
cmp_P, cmp_I = maamped(dask_client, T_sub, m)

npt.assert_almost_equal(ref_P, comp_P)
npt.assert_almost_equal(ref_I, comp_I)
npt.assert_allclose(cmp_P, ref_P, atol=1.5e-07)
npt.assert_allclose(cmp_I, ref_I, atol=1.5e-07)


@pytest.mark.filterwarnings("ignore:\\s+Port 8787 is already in use:UserWarning")
Expand All @@ -201,10 +201,10 @@ def test_maamped_one_subsequence_nan_self_join_first_dimension(
T_sub[0, substitution_location] = np.nan

ref_P, ref_I = naive.maamp(T_sub, m, excl_zone)
comp_P, comp_I = maamped(dask_client, T_sub, m)
cmp_P, cmp_I = maamped(dask_client, T_sub, m)

npt.assert_almost_equal(ref_P, comp_P)
npt.assert_almost_equal(ref_I, comp_I)
npt.assert_allclose(cmp_P, ref_P, atol=1.5e-07)
npt.assert_allclose(cmp_I, ref_I, atol=1.5e-07)


@pytest.mark.filterwarnings("ignore:\\s+Port 8787 is already in use:UserWarning")
Expand All @@ -220,7 +220,7 @@ def test_maamped_one_subsequence_nan_self_join_all_dimensions(
T_sub[:, substitution_location] = np.nan

ref_P, ref_I = naive.maamp(T_sub, m, excl_zone)
comp_P, comp_I = maamped(dask_client, T_sub, m)
cmp_P, cmp_I = maamped(dask_client, T_sub, m)

npt.assert_almost_equal(ref_P, comp_P)
npt.assert_almost_equal(ref_I, comp_I)
npt.assert_allclose(cmp_P, ref_P, atol=1.5e-07)
npt.assert_allclose(cmp_I, ref_I, atol=1.5e-07)
Loading