Skip to content

Commit

Permalink
Make test less strict
Browse files Browse the repository at this point in the history
  • Loading branch information
titodalcanton committed Dec 16, 2024
1 parent 743de4f commit d646eef
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions test/test_skymax.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,27 +347,28 @@ def test_filtering(self):
low_frequency_cutoff=self.low_freq_filter,
h_norm=1.
)
# FIXME: Remove the deepcopies before merging with master
I_plus = copy.deepcopy(I_plus).astype(numpy.complex64)
I_plus = I_plus.astype(numpy.complex64)
I_cross, _, n_cross = matched_filter_core(
hcross,
stilde,
psd=self.psd,
low_frequency_cutoff=self.low_freq_filter,
h_norm=1.
)
I_cross = copy.deepcopy(I_cross).astype(numpy.complex64)
I_cross = I_cross.astype(numpy.complex64)
I_plus = I_plus * n_plus
I_cross = I_cross * n_cross
IPM = abs(I_plus.data).argmax()
ICM = abs(I_cross.data).argmax()
self.assertAlmostEqual(abs(I_plus[IPM]),
expected_results[idx][jdx]['Ip_snr'])
self.assertAlmostEqual(
abs(I_plus[IPM]), expected_results[idx][jdx]['Ip_snr'], places=5
)
self.assertAlmostEqual(angle(I_plus[IPM]),
expected_results[idx][jdx]['Ip_angle'])
self.assertEqual(IPM, expected_results[idx][jdx]['Ip_argmax'])
self.assertAlmostEqual(abs(I_cross[ICM]),
expected_results[idx][jdx]['Ic_snr'])
self.assertAlmostEqual(
abs(I_cross[ICM]), expected_results[idx][jdx]['Ic_snr'], places=5
)
self.assertAlmostEqual(angle(I_cross[ICM]),
expected_results[idx][jdx]['Ic_angle'])
self.assertEqual(ICM, expected_results[idx][jdx]['Ic_argmax'])
Expand All @@ -388,9 +389,15 @@ def test_filtering(self):
thresh=0.1,
analyse_slice=slice(0,len(I_plus.data))
)
det_stat_hom = compute_max_snr_over_sky_loc_stat_no_phase\
(I_plus, I_cross, hpc_corr_R, hpnorm=1., hcnorm=1.,
thresh=0.1, analyse_slice=slice(0,len(I_plus.data)))
det_stat_hom = compute_max_snr_over_sky_loc_stat_no_phase(
I_plus,
I_cross,
hpc_corr_R,
hpnorm=1.,
hcnorm=1.,
thresh=0.1,
analyse_slice=slice(0,len(I_plus.data))
)
idx_max_prec = argmax(det_stat_prec.data)
idx_max_hom = argmax(det_stat_hom.data)
max_ds_prec = det_stat_prec[idx_max_prec]
Expand All @@ -414,7 +421,9 @@ def test_filtering(self):
(ht, stilde, psd=self.psd,
low_frequency_cutoff=self.low_freq_filter, h_norm=1.)
I_t = I_t * n_t
self.assertAlmostEqual(abs(real(I_t.data[idx_max_hom])), max_ds_hom)
self.assertAlmostEqual(
abs(real(I_t.data[idx_max_hom])), max_ds_hom, places=5
)
self.assertEqual(abs(real(I_t.data[idx_max_hom])),
max(abs(real(I_t.data))))
with numpy.errstate(invalid='ignore', divide='ignore'):
Expand Down

0 comments on commit d646eef

Please sign in to comment.