Skip to content
Closed
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion stumpy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"STUMPY_DENOM_THRESHOLD": 1e-14,
"STUMPY_STDDEV_THRESHOLD": 1e-7,
"STUMPY_P_NORM_THRESHOLD": 1e-14,
"STUMPY_TEST_PRECISION": 5,
"STUMPY_TEST_PRECISION": 1.5e-07,
"STUMPY_MAX_P_NORM_DISTANCE": np.finfo(np.float64).max,
"STUMPY_MAX_DISTANCE": np.sqrt(np.finfo(np.float64).max),
"STUMPY_EXCL_ZONE_DENOM": 4,
Expand All @@ -34,6 +34,7 @@
STUMPY_DENOM_THRESHOLD = _STUMPY_DEFAULTS["STUMPY_DENOM_THRESHOLD"]
STUMPY_STDDEV_THRESHOLD = _STUMPY_DEFAULTS["STUMPY_STDDEV_THRESHOLD"]
STUMPY_P_NORM_THRESHOLD = _STUMPY_DEFAULTS["STUMPY_P_NORM_THRESHOLD"]
# Absolute tolerance for floating-point comparisons in the test suite.
STUMPY_TEST_PRECISION = _STUMPY_DEFAULTS["STUMPY_TEST_PRECISION"]
STUMPY_MAX_P_NORM_DISTANCE = _STUMPY_DEFAULTS["STUMPY_MAX_P_NORM_DISTANCE"]
STUMPY_MAX_DISTANCE = _STUMPY_DEFAULTS["STUMPY_MAX_DISTANCE"]
Expand Down
10 changes: 5 additions & 5 deletions tests/test_aamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ def test_aamp_identical_subsequence_self_join():
npt.assert_allclose(
cmp_mp[:, 0].astype(np.float64),
ref_mp[:, 0].astype(np.float64),
atol=1.5 * 10**-config.STUMPY_TEST_PRECISION,
atol=config.STUMPY_TEST_PRECISION,
) # ignore indices

cmp_mp = aamp(pd.Series(T_A), m, ignore_trivial=True)
naive.replace_inf(cmp_mp)
npt.assert_allclose(
cmp_mp[:, 0].astype(np.float64),
ref_mp[:, 0].astype(np.float64),
atol=1.5 * 10**-config.STUMPY_TEST_PRECISION,
atol=config.STUMPY_TEST_PRECISION,
) # ignore indices


Expand All @@ -186,15 +186,15 @@ def test_aamp_identical_subsequence_A_B_join():
npt.assert_allclose(
cmp_mp[:, 0].astype(np.float64),
ref_mp[:, 0].astype(np.float64),
atol=1.5 * 10**-config.STUMPY_TEST_PRECISION,
atol=config.STUMPY_TEST_PRECISION,
) # ignore indices

cmp_mp = aamp(pd.Series(T_A), m, pd.Series(T_B), ignore_trivial=False)
naive.replace_inf(cmp_mp)
npt.assert_allclose(
cmp_mp[:, 0].astype(np.float64),
ref_mp[:, 0].astype(np.float64),
atol=1.5 * 10**-config.STUMPY_TEST_PRECISION,
atol=config.STUMPY_TEST_PRECISION,
) # ignore indices

# Swap inputs
Expand All @@ -205,7 +205,7 @@ def test_aamp_identical_subsequence_A_B_join():
npt.assert_allclose(
cmp_mp[:, 0].astype(np.float64),
ref_mp[:, 0].astype(np.float64),
atol=1.5 * 10**-config.STUMPY_TEST_PRECISION,
atol=config.STUMPY_TEST_PRECISION,
) # ignore indices


Expand Down
48 changes: 17 additions & 31 deletions tests/test_aampdist_snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ def test_get_all_aampdist_profiles(T, m):
ref_profiles = naive.get_all_aampdist_profiles(T, m)
cmp_profiles = _get_all_aampdist_profiles(T, m)

npt.assert_allclose(
cmp_profiles, ref_profiles, atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
)
npt.assert_allclose(cmp_profiles, ref_profiles, atol=config.STUMPY_TEST_PRECISION)


@pytest.mark.parametrize("T", test_data)
Expand All @@ -31,9 +29,7 @@ def test_get_all_aampdist_profiles_s(T, m, s):
ref_profiles = naive.get_all_aampdist_profiles(T, m, s=s)
cmp_profiles = _get_all_aampdist_profiles(T, m, s=s)

npt.assert_allclose(
cmp_profiles, ref_profiles, atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
)
npt.assert_allclose(cmp_profiles, ref_profiles, atol=config.STUMPY_TEST_PRECISION)


@pytest.mark.parametrize("T", test_data)
Expand Down Expand Up @@ -72,19 +68,17 @@ def test_aampdist_snippets(T, m, k):
npt.assert_allclose(
cmp_aampdist_snippets,
ref_aampdist_snippets,
atol=1.5 * 10**-config.STUMPY_TEST_PRECISION,
)
npt.assert_allclose(
cmp_indices, ref_indices, atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
atol=config.STUMPY_TEST_PRECISION,
)
npt.assert_allclose(cmp_indices, ref_indices, atol=config.STUMPY_TEST_PRECISION)
# npt.assert_allclose(
# cmp_profiles, ref_profiles, atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
# cmp_profiles, ref_profiles, atol=config.STUMPY_TEST_PRECISION
# )
npt.assert_allclose(
cmp_fractions, ref_fractions, atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
cmp_fractions, ref_fractions, atol=config.STUMPY_TEST_PRECISION
)
# npt.assert_allclose(
# cmp_areas, ref_areas, atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
# cmp_areas, ref_areas, atol=config.STUMPY_TEST_PRECISION
# )
npt.assert_allclose(cmp_regimes, ref_regimes, atol=1.5e-07)

Expand Down Expand Up @@ -119,19 +113,15 @@ def test_aampdist_snippets_percentage(T, m, k, percentage):
npt.assert_allclose(
cmp_aampdist_snippets,
ref_aampdist_snippets,
atol=1.5 * 10**-config.STUMPY_TEST_PRECISION,
)
npt.assert_allclose(
cmp_indices, ref_indices, atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
atol=config.STUMPY_TEST_PRECISION,
)
npt.assert_allclose(cmp_indices, ref_indices, atol=config.STUMPY_TEST_PRECISION)
# npt.assert_allclose(
# cmp_profiles, ref_profiles, atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
# cmp_profiles, ref_profiles, atol=config.STUMPY_TEST_PRECISION
# )
npt.assert_allclose(
cmp_fractions, ref_fractions, atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
)
npt.assert_allclose(cmp_fractions, ref_fractions, atol=config.STUMPY_TEST_PRECISION)
# npt.assert_allclose(
# cmp_areas, ref_areas, atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
# cmp_areas, ref_areas, atol=config.STUMPY_TEST_PRECISION
# )
npt.assert_allclose(cmp_regimes, ref_regimes, atol=1.5e-07)

Expand Down Expand Up @@ -166,18 +156,14 @@ def test_aampdist_snippets_s(T, m, k, s):
npt.assert_allclose(
cmp_aampdist_snippets,
ref_aampdist_snippets,
atol=1.5 * 10**-config.STUMPY_TEST_PRECISION,
)
npt.assert_allclose(
cmp_indices, ref_indices, atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
atol=config.STUMPY_TEST_PRECISION,
)
npt.assert_allclose(cmp_indices, ref_indices, atol=config.STUMPY_TEST_PRECISION)
# npt.assert_allclose(
# cmp_profiles, ref_profiles, atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
# cmp_profiles, ref_profiles, atol=config.STUMPY_TEST_PRECISION
# )
npt.assert_allclose(
cmp_fractions, ref_fractions, atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
)
npt.assert_allclose(cmp_fractions, ref_fractions, atol=config.STUMPY_TEST_PRECISION)
# npt.assert_allclose(
# cmp_areas, ref_areas, atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
# cmp_areas, ref_areas, atol=config.STUMPY_TEST_PRECISION
# )
npt.assert_allclose(cmp_regimes, ref_regimes, atol=1.5e-07)
4 changes: 2 additions & 2 deletions tests/test_aamped.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def test_aamped_identical_subsequence_self_join(dask_cluster):
npt.assert_allclose(
cmp_mp[:, 0].astype(np.float64),
ref_mp[:, 0].astype(np.float64),
atol=1.5 * 10**-config.STUMPY_TEST_PRECISION,
atol=config.STUMPY_TEST_PRECISION,
) # ignore indices


Expand All @@ -348,7 +348,7 @@ def test_aamped_identical_subsequence_A_B_join(dask_cluster):
npt.assert_allclose(
cmp_mp[:, 0].astype(np.float64),
ref_mp[:, 0].astype(np.float64),
atol=1.5 * 10**-config.STUMPY_TEST_PRECISION,
atol=config.STUMPY_TEST_PRECISION,
) # ignore indices


Expand Down
28 changes: 10 additions & 18 deletions tests/test_aampi.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ def test_aampi_identical_subsequence_self_join():
npt.assert_allclose(
cmp_P.astype(np.float64),
ref_P.astype(np.float64),
atol=1.5 * 10**-config.STUMPY_TEST_PRECISION,
atol=config.STUMPY_TEST_PRECISION,
)
# npt.assert_allclose(cmp_I, ref_I, atol=1.5e-07)

Expand All @@ -857,7 +857,7 @@ def test_aampi_identical_subsequence_self_join():
npt.assert_allclose(
cmp_P.astype(np.float64),
ref_P.astype(np.float64),
atol=1.5 * 10**-config.STUMPY_TEST_PRECISION,
atol=config.STUMPY_TEST_PRECISION,
)
# npt.assert_allclose(cmp_I, ref_I, atol=1.5e-07)

Expand Down Expand Up @@ -889,11 +889,9 @@ def test_aampi_identical_subsequence_self_join_egress():
naive.replace_inf(ref_left_P)
naive.replace_inf(cmp_left_P)

npt.assert_allclose(cmp_P, ref_P, atol=1.5 * 10**-config.STUMPY_TEST_PRECISION)
npt.assert_allclose(cmp_P, ref_P, atol=config.STUMPY_TEST_PRECISION)
# npt.assert_allclose(cmp_I, ref_I, atol=1.5e-07)
npt.assert_allclose(
cmp_left_P, ref_left_P, atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
)
npt.assert_allclose(cmp_left_P, ref_left_P, atol=config.STUMPY_TEST_PRECISION)
# npt.assert_allclose(cmp_left_I, ref_left_I, atol=1.5e-07)

for i in range(34):
Expand All @@ -916,12 +914,10 @@ def test_aampi_identical_subsequence_self_join_egress():
naive.replace_inf(cmp_P)
naive.replace_inf(cmp_left_P)

npt.assert_allclose(
cmp_P, ref_P, atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
)
npt.assert_allclose(cmp_P, ref_P, atol=config.STUMPY_TEST_PRECISION)
# npt.assert_allclose(cmp_I, ref_I, atol=1.5e-07)
npt.assert_allclose(
cmp_left_P, ref_left_P, atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
cmp_left_P, ref_left_P, atol=config.STUMPY_TEST_PRECISION
)
# npt.assert_allclose(cmp_left_I, ref_left_I, atol=1.5e-07)

Expand Down Expand Up @@ -950,11 +946,9 @@ def test_aampi_identical_subsequence_self_join_egress():
naive.replace_inf(ref_left_P)
naive.replace_inf(cmp_left_P)

npt.assert_allclose(cmp_P, ref_P, atol=1.5 * 10**-config.STUMPY_TEST_PRECISION)
npt.assert_allclose(cmp_P, ref_P, atol=config.STUMPY_TEST_PRECISION)
# npt.assert_allclose(cmp_I, ref_I, atol=1.5e-07)
npt.assert_allclose(
cmp_left_P, ref_left_P, atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
)
npt.assert_allclose(cmp_left_P, ref_left_P, atol=config.STUMPY_TEST_PRECISION)
# npt.assert_allclose(cmp_left_I, ref_left_I, atol=1.5e-07)

for i in range(34):
Expand All @@ -977,12 +971,10 @@ def test_aampi_identical_subsequence_self_join_egress():
naive.replace_inf(cmp_P)
naive.replace_inf(cmp_left_P)

npt.assert_allclose(
cmp_P, ref_P, atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
)
npt.assert_allclose(cmp_P, ref_P, atol=config.STUMPY_TEST_PRECISION)
# npt.assert_allclose(cmp_I, ref_I, atol=1.5e-07)
npt.assert_allclose(
cmp_left_P, ref_left_P, atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
cmp_left_P, ref_left_P, atol=config.STUMPY_TEST_PRECISION
)
# npt.assert_allclose(cmp_left_I, ref_left_I, atol=1.5e-07)

Expand Down
12 changes: 6 additions & 6 deletions tests/test_gpu_aamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,13 @@ def test_gpu_aamp_identical_subsequence_self_join():
npt.assert_allclose(
cmp_mp[:, 0].astype(np.float64),
ref_mp[:, 0].astype(np.float64),
atol=1.5 * 10**-config.STUMPY_TEST_PRECISION,
atol=config.STUMPY_TEST_PRECISION,
) # ignore indices

# cmp_mp = gpu_aamp(pd.Series(T_A), m, ignore_trivial=True)
# naive.replace_inf(cmp_mp)
# npt.assert_allclose(
# cmp_mp[:, 0], ref_mp[:, 0], atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
# cmp_mp[:, 0], ref_mp[:, 0], atol=config.STUMPY_TEST_PRECISION
# ) # ignore indices


Expand All @@ -305,13 +305,13 @@ def test_gpu_aamp_identical_subsequence_A_B_join():
npt.assert_allclose(
cmp_mp[:, 0].astype(np.float64),
ref_mp[:, 0].astype(np.float64),
atol=1.5 * 10**-config.STUMPY_TEST_PRECISION,
atol=config.STUMPY_TEST_PRECISION,
) # ignore indices

# cmp_mp = gpu_aamp(pd.Series(T_A), m, pd.Series(T_B), ignore_trivial=False)
# naive.replace_inf(cmp_mp)
# npt.assert_allclose(
# cmp_mp[:, 0], ref_mp[:, 0], atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
# cmp_mp[:, 0], ref_mp[:, 0], atol=config.STUMPY_TEST_PRECISION
# ) # ignore indices

# Swap inputs
Expand All @@ -322,13 +322,13 @@ def test_gpu_aamp_identical_subsequence_A_B_join():
npt.assert_allclose(
cmp_mp[:, 0].astype(np.float64),
ref_mp[:, 0].astype(np.float64),
atol=1.5 * 10**-config.STUMPY_TEST_PRECISION,
atol=config.STUMPY_TEST_PRECISION,
) # ignore indices

# cmp_mp = gpu_aamp(pd.Series(T_B), m, pd.Series(T_A), ignore_trivial=False)
# naive.replace_inf(cmp_mp)
# npt.assert_allclose(
# cmp_mp[:, 0], ref_mp[:, 0], atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
# cmp_mp[:, 0], ref_mp[:, 0], atol=config.STUMPY_TEST_PRECISION
# ) # ignore indices


Expand Down
12 changes: 6 additions & 6 deletions tests/test_gpu_stump.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,13 @@ def test_gpu_stump_identical_subsequence_self_join():
npt.assert_allclose(
cmp_mp[:, 0].astype(np.float64),
ref_mp[:, 0].astype(np.float64),
atol=1.5 * 10**-config.STUMPY_TEST_PRECISION,
atol=config.STUMPY_TEST_PRECISION,
) # ignore indices

# cmp_mp = gpu_stump(pd.Series(T_A), m, ignore_trivial=True)
# naive.replace_inf(cmp_mp)
# npt.assert_allclose(
# cmp_mp[:, 0], ref_mp[:, 0], atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
# cmp_mp[:, 0], ref_mp[:, 0], atol=config.STUMPY_TEST_PRECISION
# ) # ignore indices


Expand All @@ -302,13 +302,13 @@ def test_gpu_stump_identical_subsequence_A_B_join():
npt.assert_allclose(
cmp_mp[:, 0].astype(np.float64),
ref_mp[:, 0].astype(np.float64),
atol=1.5 * 10**-config.STUMPY_TEST_PRECISION,
atol=config.STUMPY_TEST_PRECISION,
) # ignore indices

# cmp_mp = gpu_stump(pd.Series(T_B), m, pd.Series(T_A), ignore_trivial=False)
# naive.replace_inf(cmp_mp)
# npt.assert_allclose(
# cmp_mp[:, 0], ref_mp[:, 0], atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
# cmp_mp[:, 0], ref_mp[:, 0], atol=config.STUMPY_TEST_PRECISION
# ) # ignore indices

# Swap inputs
Expand All @@ -319,13 +319,13 @@ def test_gpu_stump_identical_subsequence_A_B_join():
npt.assert_allclose(
cmp_mp[:, 0].astype(np.float64),
ref_mp[:, 0].astype(np.float64),
atol=1.5 * 10**-config.STUMPY_TEST_PRECISION,
atol=config.STUMPY_TEST_PRECISION,
) # ignore indices

# cmp_mp = gpu_stump(pd.Series(T_A), m, pd.Series(T_B), ignore_trivial=False)
# naive.replace_inf(cmp_mp)
# npt.assert_allclose(
# cmp_mp[:, 0], ref_mp[:, 0], atol=1.5 * 10**-config.STUMPY_TEST_PRECISION
# cmp_mp[:, 0], ref_mp[:, 0], atol=config.STUMPY_TEST_PRECISION
# ) # ignore indices


Expand Down
6 changes: 3 additions & 3 deletions tests/test_maamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_multi_mass_absolute_seeded():
Q, T, m, T_subseq_isfinite[:, trivial_idx], T_subseq_isfinite
)

npt.assert_allclose(cmp, ref, atol=1.5 * 10**-config.STUMPY_TEST_PRECISION)
npt.assert_allclose(cmp, ref, atol=config.STUMPY_TEST_PRECISION)


@pytest.mark.parametrize("T, m", test_data)
Expand All @@ -58,7 +58,7 @@ def test_multi_mass_absolute(T, m):
Q, _T, m, T_subseq_isfinite[:, trivial_idx], T_subseq_isfinite, p=p
)

npt.assert_allclose(cmp, ref, atol=1.5 * 10**-config.STUMPY_TEST_PRECISION)
npt.assert_allclose(cmp, ref, atol=config.STUMPY_TEST_PRECISION)


@pytest.mark.parametrize("T, m", test_data)
Expand Down Expand Up @@ -303,7 +303,7 @@ def test_identical_subsequence_self_join():
cmp_P, cmp_I = maamp(T, m)

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


Expand Down
2 changes: 1 addition & 1 deletion tests/test_maamped.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def test_maamped_identical_subsequence_self_join(dask_cluster):
cmp_P, cmp_I = maamped(dask_client, T, m)

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


Expand Down
Loading
Loading