Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions bilby/gw/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,7 @@ def lal_binary_neutron_star_relative_binning(
waveform_kwargs.update(kwargs)

if fiducial == 1:
_ = waveform_kwargs.pop("frequency_bin_edges", None)
Comment on lines 785 to +786
return _base_lal_cbc_fd_waveform(
frequency_array=frequency_array, mass_1=mass_1, mass_2=mass_2,
luminosity_distance=luminosity_distance, theta_jn=theta_jn, phase=phase,
Expand Down
37 changes: 37 additions & 0 deletions test/gw/source_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,23 @@ def test_relbin_bbh_runs_without_fiducial_option(self):
dict,
)

def test_relbin_fiducial_bbh_ignores_frequency_bin_edges(self):
"""
Once bins are set up, ``RelativeBinningGravitationalWaveTransient``
leaves ``frequency_bin_edges`` in the waveform generator's persistent
``waveform_arguments``, so any later fiducial (full-resolution) call
is made with it still present. The fiducial branch must drop it
rather than pass it through as an unused kwarg.
"""
self.parameters.update(self.waveform_kwargs_fiducial)
self.parameters["frequency_bin_edges"] = np.arange(20, 1500, 50)
self.assertIsInstance(
bilby.gw.source.lal_binary_black_hole_relative_binning(
self.frequency_array, **self.parameters
),
dict,
)

def test_relbin_bbh_xpprecession_version(self):
self.parameters.update(self.waveform_kwargs_fiducial)
self.parameters["waveform_approximant"] = "IMRPhenomXP"
Expand Down Expand Up @@ -700,6 +717,26 @@ def test_relbin_bns_fails_without_fiducial_option(self):
dict,
)

def test_relbin_fiducial_bns_ignores_frequency_bin_edges(self):
"""
Regression test for the missing ``frequency_bin_edges`` pop in the
fiducial branch (unlike the BBH counterpart, which already drops it).
Once bins are set up, ``RelativeBinningGravitationalWaveTransient``
leaves ``frequency_bin_edges`` in the waveform generator's persistent
``waveform_arguments``, so any later fiducial (full-resolution) call
-- e.g. from an iterative fiducial-parameter update, or an external
Fisher-matrix calculation -- is made with it still present. Before the
fix this raised the "unused waveform kwargs" ``ValueError``.
"""
self.parameters.update(self.waveform_kwargs_fiducial)
self.parameters["frequency_bin_edges"] = np.arange(20, 1500, 50)
self.assertIsInstance(
bilby.gw.source.lal_binary_neutron_star_relative_binning(
self.frequency_array, **self.parameters
),
dict,
)

def test_fiducial_fails_without_tidal_parameters(self):
self.parameters.pop("lambda_1")
self.parameters.pop("lambda_2")
Expand Down
Loading