diff --git a/tests/test_stomp.py b/tests/test_stomp.py index 2199195c3..d30f1cbd4 100644 --- a/tests/test_stomp.py +++ b/tests/test_stomp.py @@ -32,10 +32,12 @@ def test_stomp_self_join(T_A, T_B): m = 3 zone = int(np.ceil(m / 4)) ref_mp = naive.stump(T_B, m, exclusion_zone=zone, row_wise=True) - comp_mp = _stomp(T_B, m, ignore_trivial=True) + cmp_mp = _stomp(T_B, m, ignore_trivial=True) naive.replace_inf(ref_mp) - naive.replace_inf(comp_mp) - npt.assert_almost_equal(ref_mp, comp_mp) + naive.replace_inf(cmp_mp) + npt.assert_allclose( + cmp_mp.astype(np.float64), ref_mp.astype(np.float64), atol=1.5e-07 + ) @pytest.mark.parametrize("T_A, T_B", test_data) @@ -44,21 +46,25 @@ def test_stump_self_join_larger_window(T_A, T_B, m): if len(T_B) > m: zone = int(np.ceil(m / 4)) ref_mp = naive.stump(T_B, m, exclusion_zone=zone, row_wise=True) - comp_mp = _stomp(T_B, m, ignore_trivial=True) + cmp_mp = _stomp(T_B, m, ignore_trivial=True) naive.replace_inf(ref_mp) - naive.replace_inf(comp_mp) + naive.replace_inf(cmp_mp) - npt.assert_almost_equal(ref_mp, comp_mp) + npt.assert_allclose( + cmp_mp.astype(np.float64), ref_mp.astype(np.float64), atol=1.5e-07 + ) @pytest.mark.parametrize("T_A, T_B", test_data) def test_stomp_A_B_join(T_A, T_B): m = 3 ref_mp = naive.stump(T_A, m, T_B=T_B, row_wise=True) - comp_mp = _stomp(T_A, m, T_B, ignore_trivial=False) + cmp_mp = _stomp(T_A, m, T_B, ignore_trivial=False) naive.replace_inf(ref_mp) - naive.replace_inf(comp_mp) - npt.assert_almost_equal(ref_mp, comp_mp) + naive.replace_inf(cmp_mp) + npt.assert_allclose( + cmp_mp.astype(np.float64), ref_mp.astype(np.float64), atol=1.5e-07 + ) @pytest.mark.parametrize("T_A, T_B", test_data) @@ -75,10 +81,12 @@ def test_stomp_nan_inf_self_join(T_A, T_B, substitute_B, substitution_locations) zone = int(np.ceil(m / 4)) ref_mp = naive.stump(T_B_sub, m, exclusion_zone=zone, row_wise=True) - comp_mp = _stomp(T_B_sub, m, ignore_trivial=True) + cmp_mp = _stomp(T_B_sub, m, ignore_trivial=True) naive.replace_inf(ref_mp) - naive.replace_inf(comp_mp) - npt.assert_almost_equal(ref_mp, comp_mp) + naive.replace_inf(cmp_mp) + npt.assert_allclose( + cmp_mp.astype(np.float64), ref_mp.astype(np.float64), atol=1.5e-07 + ) @pytest.mark.parametrize("T_A, T_B", test_data) @@ -101,10 +109,12 @@ def test_stomp_nan_inf_A_B_join( T_B_sub[substitution_location_B] = substitute_B ref_mp = naive.stump(T_A_sub, m, T_B=T_B_sub, row_wise=True) - comp_mp = _stomp(T_A_sub, m, T_B_sub, ignore_trivial=False) + cmp_mp = _stomp(T_A_sub, m, T_B_sub, ignore_trivial=False) naive.replace_inf(ref_mp) - naive.replace_inf(comp_mp) - npt.assert_almost_equal(ref_mp, comp_mp) + naive.replace_inf(cmp_mp) + npt.assert_allclose( + cmp_mp.astype(np.float64), ref_mp.astype(np.float64), atol=1.5e-07 + ) def test_stomp_nan_zero_mean_self_join(): @@ -113,8 +123,10 @@ def test_stomp_nan_zero_mean_self_join(): zone = int(np.ceil(m / 4)) ref_mp = naive.stump(T, m, exclusion_zone=zone, row_wise=True) - comp_mp = _stomp(T, m, ignore_trivial=True) + cmp_mp = _stomp(T, m, ignore_trivial=True) naive.replace_inf(ref_mp) - naive.replace_inf(comp_mp) - npt.assert_almost_equal(ref_mp, comp_mp) + naive.replace_inf(cmp_mp) + npt.assert_allclose( + cmp_mp.astype(np.float64), ref_mp.astype(np.float64), atol=1.5e-07 + )