Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to fix test_skymax on Numpy 2 #4991

Merged
merged 5 commits into from
Dec 16, 2024
Merged
Changes from 1 commit
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
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
titodalcanton marked this conversation as resolved.
Show resolved Hide resolved
)
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
Loading