Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into udpdate-hm-pr
Browse files Browse the repository at this point in the history
  • Loading branch information
mj-will committed May 13, 2024
2 parents 15ef208 + df76249 commit 3020268
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
19 changes: 18 additions & 1 deletion BBHX_Phenom.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import math
import numpy as np
from scipy.interpolate import interp1d
from bbhx.utils.constants import MTSUN_SI, YRSID_SI
from bbhx.utils.constants import MTSUN_SI, YRSID_SI, L_SI
from bbhx.waveformbuild import BBHWaveformFD
from pycbc.coordinates import TIME_OFFSET_20_DEGREES, lisa_to_ssb, ssb_to_lisa
from warnings import warn
Expand Down Expand Up @@ -105,6 +105,7 @@ def _bbhx_fd(
ifos=None,
run_phenomd=True,
ref_frame='LISA',
tdi=None,
sample_points=None,
length=1024,
direct=False,
Expand All @@ -122,6 +123,8 @@ def _bbhx_fd(
run_phenomd : bool
Flag passed to :code:`bbhx.waveformbuild.BBHWaveformFD` that determines
if PhenomD or PhenomHM is used.
tdi : {'1.5', '2.0}
Version of TDI to use.
ref_frame : {'LISA', 'SSB'}
Reference frame.
samples_points : numpy.ndarray, optional
Expand Down Expand Up @@ -333,4 +336,18 @@ def _bbhx_fd(
# subtract t_offset from FD waveform
output[channel] *= np.exp(2j*np.pi*sample_points*t_offset)

# convert TDI version
if str(tdi) == '2.0':
from pycbc.psd.analytical_space import omega_length
if sample_points is None:
# assume all channels share the same sample_frequencies
omega_len = omega_length(f=output[channel].sample_frequencies, len_arm=L_SI)
else:
omega_len = omega_length(f=sample_points, len_arm=L_SI)
rescale = 2j*np.sin(2*omega_len)*np.exp(-2j*omega_len)
for key in output:
output[key] *= rescale
if str(tdi) not in ['1.5', '2.0']:
raise ValueError("The TDI version only supports '1.5' and '2.0' for now.")

return output
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from setuptools import Extension, setup, Command
from setuptools import find_packages

VERSION = '0.2'
VERSION = '0.3'

setup (
name = 'pycbc-bbhx-plugin',
Expand Down
5 changes: 4 additions & 1 deletion tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def ref_frame(request):
def params():
params = {}
params["approximant"] = "BBHX_PhenomHM"
params["tdi"] = 1.5
params["ref_frame"] = "LISA"
params["ifos"] = ["LISA_A", "LISA_E", "LISA_T"]
params["coa_phase"] = 0.0
Expand All @@ -40,7 +41,9 @@ def params():
return params


def test_get_fd_det_waveform(params, ref_frame, approximant):
@pytest.mark.parametrize("tdi", ["1.5", "2.0"])
def test_get_fd_det_waveform(params, ref_frame, approximant, tdi):
params["tdi"] = tdi
params["ref_frame"] = ref_frame
params["approximant"] = approximant
wf = get_fd_det_waveform(**params)
Expand Down

0 comments on commit 3020268

Please sign in to comment.