Skip to content

Commit

Permalink
Add tests for raising value error
Browse files Browse the repository at this point in the history
  • Loading branch information
wbenoit26 committed Feb 7, 2025
1 parent 4eb87a8 commit 9f77be1
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/test_gw.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,27 @@ def test_compute_ifo_snr(_get_waveforms_from_lalsimulation, highpass, lowpass):
backgrounds = torch.from_numpy(backgrounds)
hp_torch = torch.from_numpy(hp.data.data)
hc_torch = torch.from_numpy(hc.data.data)

num_freqs = hp_torch.shape[-1] // 2 + 1
with pytest.raises(ValueError) as exc:
snr_hp_compute_ifo_snr = injection.compute_ifo_snr(
hp_torch,
backgrounds,
sample_rate=sample_rate,
highpass=torch.ones(num_freqs - 1),
lowpass=lowpass,
)
assert str(exc.value).startswith("Can't apply highpass")
with pytest.raises(ValueError) as exc:
snr_hp_compute_ifo_snr = injection.compute_ifo_snr(
hp_torch,
backgrounds,
sample_rate=sample_rate,
highpass=highpass,
lowpass=torch.ones(num_freqs - 1),
)
assert str(exc.value).startswith("Can't apply lowpass")

snr_hp_compute_ifo_snr = injection.compute_ifo_snr(
hp_torch,
backgrounds,
Expand Down

0 comments on commit 9f77be1

Please sign in to comment.