From 9b98d1bfc3529a71cbdd71c794667e757cc0533b Mon Sep 17 00:00:00 2001 From: WuShichao Date: Wed, 3 Apr 2024 18:13:58 +0200 Subject: [PATCH 01/11] add TDI-2 support --- BBHX_PhenomD.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/BBHX_PhenomD.py b/BBHX_PhenomD.py index 2aeee61..a70ed66 100644 --- a/BBHX_PhenomD.py +++ b/BBHX_PhenomD.py @@ -55,7 +55,7 @@ def interpolated_tf(m1, m2): tf_track = interp1d(t_array, freq_array) return tf_track -def bbhx_fd(ifos=None, run_phenomd=True, +def bbhx_fd(ifos=None, run_phenomd=True, tdi='1.5', ref_frame='LISA', sample_points=None, **params): if ifos is None: @@ -209,4 +209,20 @@ def bbhx_fd(ifos=None, run_phenomd=True, # subtract t_offset from FD waveform output[channel] *= np.exp(2j*np.pi*sample_points*t_offset) + # convert TDI version + if 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=2.5e9) + else: + omega_len = omega_length(f=sample_points, len_arm=2.5e9) + rescale = 2j*np.sin(2*omega_len)*np.exp(-2j*omega_len) + for tdi_wave in output: + tdi_wave *= rescale + elif tdi == '1.5': + pass + else: + raise Exception("Only support TDI-1.5 and TDI-2.0 for now.") + return output From 54195283148c7e59bf6a537360f6db3f22141efa Mon Sep 17 00:00:00 2001 From: WuShichao Date: Wed, 3 Apr 2024 18:51:17 +0200 Subject: [PATCH 02/11] update version number --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 91f7932..8f330fb 100644 --- a/setup.py +++ b/setup.py @@ -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', From 5264498ca937c434e9e4516628b2feb468662f17 Mon Sep 17 00:00:00 2001 From: WuShichao Date: Wed, 3 Apr 2024 20:59:06 +0200 Subject: [PATCH 03/11] update --- BBHX_PhenomD.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BBHX_PhenomD.py b/BBHX_PhenomD.py index a70ed66..6cf0f7e 100644 --- a/BBHX_PhenomD.py +++ b/BBHX_PhenomD.py @@ -218,8 +218,8 @@ def bbhx_fd(ifos=None, run_phenomd=True, tdi='1.5', else: omega_len = omega_length(f=sample_points, len_arm=2.5e9) rescale = 2j*np.sin(2*omega_len)*np.exp(-2j*omega_len) - for tdi_wave in output: - tdi_wave *= rescale + for key in output: + output[key] *= rescale elif tdi == '1.5': pass else: From fb5ca326d6cb3fcbbfc684de876ffdf9945e1c40 Mon Sep 17 00:00:00 2001 From: WuShichao Date: Sat, 27 Apr 2024 13:29:48 +0200 Subject: [PATCH 04/11] use str --- BBHX_PhenomD.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BBHX_PhenomD.py b/BBHX_PhenomD.py index 6cf0f7e..2fd383c 100644 --- a/BBHX_PhenomD.py +++ b/BBHX_PhenomD.py @@ -210,7 +210,7 @@ def bbhx_fd(ifos=None, run_phenomd=True, tdi='1.5', output[channel] *= np.exp(2j*np.pi*sample_points*t_offset) # convert TDI version - if tdi == '2.0': + 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 @@ -220,7 +220,7 @@ def bbhx_fd(ifos=None, run_phenomd=True, tdi='1.5', rescale = 2j*np.sin(2*omega_len)*np.exp(-2j*omega_len) for key in output: output[key] *= rescale - elif tdi == '1.5': + elif str(tdi) == '1.5': pass else: raise Exception("Only support TDI-1.5 and TDI-2.0 for now.") From 8d53f8919d37e63df6a5400f168b9c3bf0899e8e Mon Sep 17 00:00:00 2001 From: WuShichao Date: Sat, 27 Apr 2024 16:38:01 +0200 Subject: [PATCH 05/11] let users set TDI version --- BBHX_PhenomD.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BBHX_PhenomD.py b/BBHX_PhenomD.py index 2fd383c..925d431 100644 --- a/BBHX_PhenomD.py +++ b/BBHX_PhenomD.py @@ -55,7 +55,7 @@ def interpolated_tf(m1, m2): tf_track = interp1d(t_array, freq_array) return tf_track -def bbhx_fd(ifos=None, run_phenomd=True, tdi='1.5', +def bbhx_fd(ifos=None, run_phenomd=True, tdi=None, ref_frame='LISA', sample_points=None, **params): if ifos is None: @@ -223,6 +223,6 @@ def bbhx_fd(ifos=None, run_phenomd=True, tdi='1.5', elif str(tdi) == '1.5': pass else: - raise Exception("Only support TDI-1.5 and TDI-2.0 for now.") + raise Exception("The TDI version only supports '1.5' and '2.0' for now.") return output From db00f57e70722cc03eea5bb58b86d1cd53768edd Mon Sep 17 00:00:00 2001 From: Shichao Wu Date: Mon, 29 Apr 2024 21:49:26 +0200 Subject: [PATCH 06/11] Update BBHX_PhenomD.py --- BBHX_PhenomD.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BBHX_PhenomD.py b/BBHX_PhenomD.py index 925d431..d5a30dc 100644 --- a/BBHX_PhenomD.py +++ b/BBHX_PhenomD.py @@ -223,6 +223,6 @@ def bbhx_fd(ifos=None, run_phenomd=True, tdi=None, elif str(tdi) == '1.5': pass else: - raise Exception("The TDI version only supports '1.5' and '2.0' for now.") + raise ValueError("The TDI version only supports '1.5' and '2.0' for now.") return output From 914ad67b22fb45080067392301f0b09340f98e5a Mon Sep 17 00:00:00 2001 From: Shichao Wu Date: Mon, 29 Apr 2024 21:52:09 +0200 Subject: [PATCH 07/11] Update BBHX_PhenomD.py --- BBHX_PhenomD.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/BBHX_PhenomD.py b/BBHX_PhenomD.py index d5a30dc..58e7fb8 100644 --- a/BBHX_PhenomD.py +++ b/BBHX_PhenomD.py @@ -220,9 +220,7 @@ def bbhx_fd(ifos=None, run_phenomd=True, tdi=None, rescale = 2j*np.sin(2*omega_len)*np.exp(-2j*omega_len) for key in output: output[key] *= rescale - elif str(tdi) == '1.5': - pass - else: + 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 From af58fe36cc0ccd5784e7bb0296753dc13f91175a Mon Sep 17 00:00:00 2001 From: WuShichao Date: Mon, 13 May 2024 15:10:01 +0200 Subject: [PATCH 08/11] use BBHx's L_SI --- BBHX_PhenomD.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/BBHX_PhenomD.py b/BBHX_PhenomD.py index 58e7fb8..dbc73c6 100644 --- a/BBHX_PhenomD.py +++ b/BBHX_PhenomD.py @@ -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 @@ -214,9 +214,9 @@ def bbhx_fd(ifos=None, run_phenomd=True, tdi=None, 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=2.5e9) + omega_len = omega_length(f=output[channel].sample_frequencies, len_arm=L_SI) else: - omega_len = omega_length(f=sample_points, len_arm=2.5e9) + 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 From 056483f99ab7503b89b2d2ff2847a75e1be08fa4 Mon Sep 17 00:00:00 2001 From: WuShichao Date: Mon, 13 May 2024 15:57:57 +0200 Subject: [PATCH 09/11] add TDI versions --- tests.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests.py b/tests.py index 9f4f623..9c21107 100644 --- a/tests.py +++ b/tests.py @@ -4,8 +4,10 @@ @pytest.mark.parametrize("ref_frame", ["SSB", "LISA"]) +@pytest.mark.parametrize("tdi", ["1.5", "2.5"]) def test_get_fd_det_waveform(ref_frame): params = {} + params["tdi"] = tdi params["ref_frame"] = ref_frame params["approximant"] = "BBHX_PhenomD" params["coa_phase"] = 0.0 From bb3c191edbce997466f0a25e8e78f30c8d77fdbb Mon Sep 17 00:00:00 2001 From: WuShichao Date: Mon, 13 May 2024 15:59:33 +0200 Subject: [PATCH 10/11] update --- tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests.py b/tests.py index 9c21107..1c02db9 100644 --- a/tests.py +++ b/tests.py @@ -5,7 +5,7 @@ @pytest.mark.parametrize("ref_frame", ["SSB", "LISA"]) @pytest.mark.parametrize("tdi", ["1.5", "2.5"]) -def test_get_fd_det_waveform(ref_frame): +def test_get_fd_det_waveform(tdi, ref_frame): params = {} params["tdi"] = tdi params["ref_frame"] = ref_frame From d74cb582afa4bf2f87f401d6aa268457bd0dce35 Mon Sep 17 00:00:00 2001 From: WuShichao Date: Mon, 13 May 2024 16:01:02 +0200 Subject: [PATCH 11/11] fix typo --- tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests.py b/tests.py index 1c02db9..32b3e93 100644 --- a/tests.py +++ b/tests.py @@ -4,7 +4,7 @@ @pytest.mark.parametrize("ref_frame", ["SSB", "LISA"]) -@pytest.mark.parametrize("tdi", ["1.5", "2.5"]) +@pytest.mark.parametrize("tdi", ["1.5", "2.0"]) def test_get_fd_det_waveform(tdi, ref_frame): params = {} params["tdi"] = tdi