Skip to content

Commit

Permalink
Add code to generate SEOBNRv4P(HM) modes via lalsim
Browse files Browse the repository at this point in the history
  • Loading branch information
prayush committed Dec 5, 2024
1 parent 3caa512 commit 9e2e802
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions pycbc/waveform/waveform_modes.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,66 @@ def get_nrhybsur_modes(**params):
get_nrsur_modes.__doc__ = _formatdocstr(get_nrsur_modes.__doc__)
get_nrhybsur_modes.__doc__ = _formatdocstr(get_nrhybsur_modes.__doc__)

def get_lalsimulation_modes(**params):
"""Generates approximant waveform mode-by-mode.
All waveform parameters should be provided as keyword arguments.
Recognized parameters are listed below. Unrecognized arguments are ignored.
Parameters
----------
template: object
An object that has attached properties. This can be used to substitute
for keyword arguments. A common example would be a row in an xml table.
approximant : str
The approximant to generate. Must be available in ``lalsimulation``.
{delta_t}
{mass1}
{mass2}
{spin1x}
{spin1y}
{spin1z}
{spin2x}
{spin2y}
{spin2z}
{f_lower}
{f_ref}
{distance}
{mode_array}
{ell_max}
Returns
-------
dict :
Dictionary of ``(l, m)`` -> ``(h_+, -h_x)`` ``TimeSeries``.
"""
ell_max = 5
if 'ell_max' in params:
ell_max = params['ell_max']
laldict = _check_lal_pars(params)
ret = lalsimulation.SimInspiralChooseTDModes(
params['coa_phase'],
params['delta_t'],
params['mass1']*lal.MSUN_SI,
params['mass2']*lal.MSUN_SI,
params['spin1x'],
params['spin1y'],
params['spin1z'],
params['spin2x'],
params['spin2y'],
params['spin2z'],
params['f_lower'], params['f_ref'],
params['distance']*1e6*lal.PC_SI, laldict,
ell_max,
params['approx']
)
hlms = {}
while ret:
hlm = TimeSeries(ret.mode.data.data, delta_t=ret.mode.deltaT,
epoch=ret.mode.epoch)
hlms[ret.l, ret.m] = (hlm.real(), hlm.imag())
ret = ret.next
return hlms

def get_imrphenomxh_modes(**params):
"""Generates ``IMRPhenomXHM`` waveforms mode-by-mode. """
Expand Down Expand Up @@ -271,6 +331,8 @@ def get_imrphenomxh_modes(**params):

_mode_waveform_td = {'NRSur7dq4': get_nrsur_modes,
'NRHybSur3dq8': get_nrhybsur_modes,
'SEOBNRv4P': get_lalsimulation_modes,
'SEOBNRv4PHM': get_lalsimulation_modes,
}
_mode_waveform_fd = {'IMRPhenomXHM': get_imrphenomxh_modes,
}
Expand Down

0 comments on commit 9e2e802

Please sign in to comment.