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
11 changes: 8 additions & 3 deletions MonteCarloMarginalizeCode/Code/RIFT/calmarg/rift_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
has_GWS=False


def _hlmoft_with_extra_waveform_kwargs(P, Lmax, extra_waveform_kwargs):
"""Generate RIFT modes with the caller's waveform options expanded."""
return lalsimutils.hlmoft(P, Lmax=Lmax, **extra_waveform_kwargs)


def RIFT_lal_binary_black_hole_orig(
frequency_array, mass_1, mass_2, luminosity_distance, spin_1x, spin_1y, spin_1z,
spin_2x, spin_2y, spin_2z, lambda_1, lambda_2, iota, phase, **kwargs):
Expand Down Expand Up @@ -71,7 +76,7 @@ def RIFT_lal_binary_black_hole_orig(
# Note several underlying interfaces like ChooseTDModes will enforce these conditions already, but not all. Better safe than sorry.
P.phiref = 0
P.incl = 0 # L direction frame
hlmT = lalsimutils.hlmoft(P,Lmax=Lmax,extra_waveform_kwargs=extra_waveform_kwargs) # extra needed to control ChooseFDWaveform
hlmT = _hlmoft_with_extra_waveform_kwargs(P, Lmax, extra_waveform_kwargs)
P.phiref = phase
P.incl = iota # restore
h22T = hlmT[(2,2)]
Expand Down Expand Up @@ -179,7 +184,7 @@ def RIFT_lal_binary_black_hole(
# Note several underlying interfaces like ChooseTDModes will enforce these conditions already, but not all. Better safe than sorry.
P.phiref = 0
P.incl = 0 # L direction frame
hlmT = lalsimutils.hlmoft(P,Lmax=Lmax,extra_waveform_kwargs=extra_waveform_kwargs) # extra needed to control ChooseFDWaveform
hlmT = _hlmoft_with_extra_waveform_kwargs(P, Lmax, extra_waveform_kwargs)
P.phiref = phase
P.incl = iota # restore

Expand Down Expand Up @@ -306,7 +311,7 @@ def RIFT_lal_eccentric_binary_black_hole(
# Note several underlying interfaces like ChooseTDModes will enforce these conditions already, but not all. Better safe than sorry.
P.phiref = 0
P.incl = 0 # L direction frame
hlmT = lalsimutils.hlmoft(P,Lmax=Lmax,extra_waveform_kwargs=extra_waveform_kwargs) # extra needed to control ChooseFDWaveform
hlmT = _hlmoft_with_extra_waveform_kwargs(P, Lmax, extra_waveform_kwargs)
P.phiref = phase
P.incl = iota # restore

Expand Down
23 changes: 23 additions & 0 deletions MonteCarloMarginalizeCode/Code/test/test_calmarg_rift_source.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from RIFT.calmarg import rift_source


def test_hlmoft_expands_extra_waveform_kwargs(monkeypatch):
captured = {}

def fake_hlmoft(P, **kwargs):
captured["P"] = P
captured["kwargs"] = kwargs
return "modes"

monkeypatch.setattr(rift_source.lalsimutils, "hlmoft", fake_hlmoft)
P = object()
options = {"fd_L_frame": True, "no_condition": True}

result = rift_source._hlmoft_with_extra_waveform_kwargs(P, 4, options)

assert result == "modes"
assert captured == {
"P": P,
"kwargs": {"Lmax": 4, "fd_L_frame": True, "no_condition": True},
}
assert options == {"fd_L_frame": True, "no_condition": True}