@@ -33,12 +33,12 @@ def test_stamp_mass_PI(T_A, T_B):
3333 ref_P , ref_I , ref_left_I , ref_right_I = naive .mass_PI (
3434 Q , T_B , m , trivial_idx = trivial_idx , excl_zone = zone , ignore_trivial = True
3535 )
36- comp_P , comp_I = _mass_PI (Q , T_B , M_T , Σ_T , trivial_idx = trivial_idx , excl_zone = zone )
36+ cmp_P , cmp_I = _mass_PI (Q , T_B , M_T , Σ_T , trivial_idx = trivial_idx , excl_zone = zone )
3737
38- npt .assert_almost_equal ( ref_P , comp_P )
39- npt .assert_almost_equal ( ref_I , comp_I )
38+ npt .assert_allclose ( cmp_P , ref_P , atol = 1.5e-07 )
39+ npt .assert_allclose ( cmp_I , ref_I , atol = 1.5e-07 )
4040
41- comp_left_P , comp_left_I = _mass_PI (
41+ cmp_left_P , cmp_left_I = _mass_PI (
4242 Q ,
4343 T_B ,
4444 M_T ,
@@ -48,9 +48,9 @@ def test_stamp_mass_PI(T_A, T_B):
4848 left = True ,
4949 )
5050
51- npt .assert_almost_equal ( ref_left_I , comp_left_I )
51+ npt .assert_allclose ( cmp_left_I , ref_left_I , atol = 1.5e-07 )
5252
53- comp_right_P , comp_right_I = _mass_PI (
53+ cmp_right_P , cmp_right_I = _mass_PI (
5454 Q ,
5555 T_B ,
5656 M_T ,
@@ -60,7 +60,7 @@ def test_stamp_mass_PI(T_A, T_B):
6060 right = True ,
6161 )
6262
63- npt .assert_almost_equal ( ref_right_I , comp_right_I )
63+ npt .assert_allclose ( cmp_right_I , ref_right_I , atol = 1.5e-07 )
6464
6565
6666def test_stamp_int_input ():
@@ -74,20 +74,24 @@ def test_stamp_self_join(T_A, T_B):
7474 m = 3
7575 zone = int (np .ceil (m / 2 ))
7676 ref_mp = naive .stump (T_B , m , exclusion_zone = zone , row_wise = True )
77- comp_mp = stamp (T_B , T_B , m , ignore_trivial = True )
77+ cmp_mp = stamp (T_B , T_B , m , ignore_trivial = True )
7878 naive .replace_inf (ref_mp )
79- naive .replace_inf (comp_mp )
80- npt .assert_almost_equal (ref_mp [:, :2 ], comp_mp )
79+ naive .replace_inf (cmp_mp )
80+ npt .assert_allclose (
81+ cmp_mp .astype (np .float64 ), ref_mp [:, :2 ].astype (np .float64 ), atol = 1.5e-07
82+ )
8183
8284
8385@pytest .mark .parametrize ("T_A, T_B" , test_data )
8486def test_stamp_A_B_join (T_A , T_B ):
8587 m = 3
8688 ref_mp = naive .stump (T_A , m , T_B = T_B , row_wise = True )
87- comp_mp = stamp (T_A , T_B , m )
89+ cmp_mp = stamp (T_A , T_B , m )
8890 naive .replace_inf (ref_mp )
89- naive .replace_inf (comp_mp )
90- npt .assert_almost_equal (ref_mp [:, :2 ], comp_mp )
91+ naive .replace_inf (cmp_mp )
92+ npt .assert_allclose (
93+ cmp_mp .astype (np .float64 ), ref_mp [:, :2 ].astype (np .float64 ), atol = 1.5e-07
94+ )
9195
9296
9397@pytest .mark .parametrize ("T_A, T_B" , test_data )
@@ -104,10 +108,12 @@ def test_stamp_nan_inf_self_join(T_A, T_B, substitute_B, substitution_locations)
104108
105109 zone = int (np .ceil (m / 2 ))
106110 ref_mp = naive .stump (T_B_sub , m , exclusion_zone = zone , row_wise = True )
107- comp_mp = stamp (T_B_sub , T_B_sub , m , ignore_trivial = True )
111+ cmp_mp = stamp (T_B_sub , T_B_sub , m , ignore_trivial = True )
108112 naive .replace_inf (ref_mp )
109- naive .replace_inf (comp_mp )
110- npt .assert_almost_equal (ref_mp [:, :2 ], comp_mp )
113+ naive .replace_inf (cmp_mp )
114+ npt .assert_allclose (
115+ cmp_mp .astype (np .float64 ), ref_mp [:, :2 ].astype (np .float64 ), atol = 1.5e-07
116+ )
111117
112118
113119@pytest .mark .parametrize ("T_A, T_B" , test_data )
@@ -130,10 +136,14 @@ def test_stamp_nan_inf_A_B_join(
130136 T_B_sub [substitution_location_B ] = substitute_B
131137
132138 ref_mp = naive .stump (T_A_sub , m , T_B = T_B_sub , row_wise = True )
133- comp_mp = stamp (T_A_sub , T_B_sub , m )
139+ cmp_mp = stamp (T_A_sub , T_B_sub , m )
134140 naive .replace_inf (ref_mp )
135- naive .replace_inf (comp_mp )
136- npt .assert_almost_equal (ref_mp [:, :2 ], comp_mp )
141+ naive .replace_inf (cmp_mp )
142+ npt .assert_allclose (
143+ cmp_mp .astype (np .float64 ),
144+ ref_mp [:, :2 ].astype (np .float64 ),
145+ atol = 1.5e-07 ,
146+ )
137147
138148
139149def test_stamp_nan_zero_mean_self_join ():
@@ -142,11 +152,13 @@ def test_stamp_nan_zero_mean_self_join():
142152
143153 zone = int (np .ceil (m / 2 ))
144154 ref_mp = naive .stump (T , m , exclusion_zone = zone , row_wise = True )
145- comp_mp = stamp (T , T , m , ignore_trivial = True )
155+ cmp_mp = stamp (T , T , m , ignore_trivial = True )
146156
147157 naive .replace_inf (ref_mp )
148- naive .replace_inf (comp_mp )
149- npt .assert_almost_equal (ref_mp [:, :2 ], comp_mp )
158+ naive .replace_inf (cmp_mp )
159+ npt .assert_allclose (
160+ cmp_mp .astype (np .float64 ), ref_mp [:, :2 ].astype (np .float64 ), atol = 1.5e-07
161+ )
150162
151163
152164def test_stamp_mass_PI_with_isconstant_case1 ():
@@ -175,7 +187,7 @@ def test_stamp_mass_PI_with_isconstant_case1():
175187 T_subseq_isconstant = isconstant_custom_func ,
176188 Q_subseq_isconstant = isconstant_custom_func ,
177189 )
178- comp_P , comp_I = _mass_PI (
190+ cmp_P , cmp_I = _mass_PI (
179191 Q ,
180192 T_B ,
181193 M_T ,
@@ -186,10 +198,10 @@ def test_stamp_mass_PI_with_isconstant_case1():
186198 Q_subseq_isconstant = isconstant_custom_func ,
187199 )
188200
189- npt .assert_almost_equal ( ref_P , comp_P )
190- npt .assert_almost_equal ( ref_I , comp_I )
201+ npt .assert_allclose ( cmp_P , ref_P , atol = 1.5e-07 )
202+ npt .assert_allclose ( cmp_I , ref_I , atol = 1.5e-07 )
191203
192- comp_left_P , comp_left_I = _mass_PI (
204+ cmp_left_P , cmp_left_I = _mass_PI (
193205 Q ,
194206 T_B ,
195207 M_T ,
@@ -201,9 +213,9 @@ def test_stamp_mass_PI_with_isconstant_case1():
201213 Q_subseq_isconstant = isconstant_custom_func ,
202214 )
203215
204- npt .assert_almost_equal ( ref_left_I , comp_left_I )
216+ npt .assert_allclose ( cmp_left_I , ref_left_I , atol = 1.5e-07 )
205217
206- comp_right_P , comp_right_I = _mass_PI (
218+ cmp_right_P , cmp_right_I = _mass_PI (
207219 Q ,
208220 T_B ,
209221 M_T ,
@@ -215,7 +227,7 @@ def test_stamp_mass_PI_with_isconstant_case1():
215227 Q_subseq_isconstant = isconstant_custom_func ,
216228 )
217229
218- npt .assert_almost_equal ( ref_right_I , comp_right_I )
230+ npt .assert_allclose ( cmp_right_I , ref_right_I , atol = 1.5e-07 )
219231
220232
221233def test_stamp_mass_PI_with_isconstant_case2 ():
@@ -244,7 +256,7 @@ def test_stamp_mass_PI_with_isconstant_case2():
244256 T_subseq_isconstant = isconstant_custom_func ,
245257 Q_subseq_isconstant = isconstant_custom_func ,
246258 )
247- comp_P , comp_I = _mass_PI (
259+ cmp_P , cmp_I = _mass_PI (
248260 Q ,
249261 T_B ,
250262 M_T ,
@@ -255,10 +267,10 @@ def test_stamp_mass_PI_with_isconstant_case2():
255267 Q_subseq_isconstant = isconstant_custom_func ,
256268 )
257269
258- npt .assert_almost_equal ( ref_P , comp_P )
259- npt .assert_almost_equal ( ref_I , comp_I )
270+ npt .assert_allclose ( cmp_P , ref_P , atol = 1.5e-07 )
271+ npt .assert_allclose ( cmp_I , ref_I , atol = 1.5e-07 )
260272
261- comp_left_P , comp_left_I = _mass_PI (
273+ cmp_left_P , cmp_left_I = _mass_PI (
262274 Q ,
263275 T_B ,
264276 M_T ,
@@ -270,9 +282,9 @@ def test_stamp_mass_PI_with_isconstant_case2():
270282 Q_subseq_isconstant = isconstant_custom_func ,
271283 )
272284
273- npt .assert_almost_equal ( ref_left_I , comp_left_I )
285+ npt .assert_allclose ( cmp_left_I , ref_left_I , atol = 1.5e-07 )
274286
275- comp_right_P , comp_right_I = _mass_PI (
287+ cmp_right_P , cmp_right_I = _mass_PI (
276288 Q ,
277289 T_B ,
278290 M_T ,
@@ -284,7 +296,7 @@ def test_stamp_mass_PI_with_isconstant_case2():
284296 Q_subseq_isconstant = isconstant_custom_func ,
285297 )
286298
287- npt .assert_almost_equal ( ref_right_I , comp_right_I )
299+ npt .assert_allclose ( cmp_right_I , ref_right_I , atol = 1.5e-07 )
288300
289301
290302@pytest .mark .parametrize ("T_A, T_B" , test_data )
@@ -302,7 +314,7 @@ def test_stamp_self_join_with_isconstant(T_A, T_B):
302314 row_wise = True ,
303315 T_A_subseq_isconstant = isconstant_custom_func ,
304316 )
305- comp_mp = stamp (
317+ cmp_mp = stamp (
306318 T_B ,
307319 T_B ,
308320 m ,
@@ -311,5 +323,7 @@ def test_stamp_self_join_with_isconstant(T_A, T_B):
311323 T_B_subseq_isconstant = isconstant_custom_func ,
312324 )
313325 naive .replace_inf (ref_mp )
314- naive .replace_inf (comp_mp )
315- npt .assert_almost_equal (ref_mp [:, :2 ], comp_mp )
326+ naive .replace_inf (cmp_mp )
327+ npt .assert_allclose (
328+ cmp_mp .astype (np .float64 ), ref_mp [:, :2 ].astype (np .float64 ), atol = 1.5e-07
329+ )
0 commit comments