Skip to content

Commit

Permalink
update time to merger
Browse files Browse the repository at this point in the history
  • Loading branch information
MarinerQ committed May 14, 2024
1 parent d19c488 commit 7906296
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 11 deletions.
11 changes: 4 additions & 7 deletions sealgw/simulation/generating_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,15 +307,12 @@ def f_of_tau(tau, m1=None, m2=None, mc=None):

def tau_of_f(f, m1=None, m2=None, mc=None):
'''
Maggiore, Gravtational wave, Vol. 1, eqs.(4.20) and (4.21)
Use 0PN if mc is provided. Otherwise use 3.5PN (TaylorF2).
'''
if mc is None:
if m1 and m2:
mc = (m1 * m2) ** (3 / 5) / (m1 + m2) ** (1 / 5)
else:
raise ValueError("Mass not provided.")

tau = 2.18 * (1.21 / mc) ** (5 / 3) * (100 / f) ** (8 / 3)
tau = bilby.gw.utils.calculate_time_to_merger(f, m1, m2)
else:
tau = 2.18 * (1.21 / mc) ** (5 / 3) * (100 / f) ** (8 / 3)
return tau


Expand Down
38 changes: 34 additions & 4 deletions sealgw/simulation/sealinterferometers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# 2. Here response function can change with time.

import os
import lal
import bilby
from bilby.gw.detector.interferometer import Interferometer
from bilby.gw.detector.networks import InterferometerList, TriangularInterferometer
Expand Down Expand Up @@ -229,11 +230,12 @@ def get_detector_response(

if self.antenna_response_change:
try:
tau = tau_of_f(frequencies, mc=parameters['chirp_mass'])
except:
tau = tau_of_f(
frequencies, m1=parameters['mass_1'], m2=parameters['mass_2']
)
except:
print("Using 0PN order to calculate time to merger.")
tau = tau_of_f(frequencies, mc=parameters['chirp_mass'])
times = parameters['geocent_time'] - tau
segment_starts = segmentize_tau(tau, self.antenna_response_change_timescale)

Expand Down Expand Up @@ -465,6 +467,33 @@ def __init__(
maximum_frequency = [maximum_frequency] * 3

for ii in range(3):
'''
# this does not work, since LAL and bilby has different definition of x,yAZIMUTH
if "{}{}".format(name, ii + 1) == 'ET1':
latitude = lal.ET1_DETECTOR_LATITUDE_RAD * 180/ np.pi
longitude = lal.ET1_DETECTOR_LONGITUDE_RAD * 180/ np.pi
elevation = lal.ET1_DETECTOR_ELEVATION_SI
xarm_azimuth = lal.ET1_DETECTOR_ARM_X_AZIMUTH_RAD * 180/ np.pi
yarm_azimuth = lal.ET1_DETECTOR_ARM_Y_AZIMUTH_RAD * 180/ np.pi
xarm_tilt = lal.ET1_DETECTOR_ARM_X_ALTITUDE_RAD * 180/ np.pi
yarm_tilt = lal.ET1_DETECTOR_ARM_Y_ALTITUDE_RAD * 180/ np.pi
if "{}{}".format(name, ii + 1) == 'ET2':
latitude = lal.ET2_DETECTOR_LATITUDE_RAD * 180/ np.pi
longitude = lal.ET2_DETECTOR_LONGITUDE_RAD * 180/ np.pi
elevation = lal.ET2_DETECTOR_ELEVATION_SI
xarm_azimuth = lal.ET2_DETECTOR_ARM_X_AZIMUTH_RAD * 180/ np.pi
yarm_azimuth = lal.ET2_DETECTOR_ARM_Y_AZIMUTH_RAD * 180/ np.pi
xarm_tilt = lal.ET2_DETECTOR_ARM_X_ALTITUDE_RAD * 180/ np.pi
yarm_tilt = lal.ET2_DETECTOR_ARM_Y_ALTITUDE_RAD * 180/ np.pi
if "{}{}".format(name, ii + 1) == 'ET3':
latitude = lal.ET3_DETECTOR_LATITUDE_RAD * 180/ np.pi
longitude = lal.ET3_DETECTOR_LONGITUDE_RAD * 180/ np.pi
elevation = lal.ET3_DETECTOR_ELEVATION_SI
xarm_azimuth = lal.ET3_DETECTOR_ARM_X_AZIMUTH_RAD * 180/ np.pi
yarm_azimuth = lal.ET3_DETECTOR_ARM_Y_AZIMUTH_RAD * 180/ np.pi
xarm_tilt = lal.ET3_DETECTOR_ARM_X_ALTITUDE_RAD * 180/ np.pi
yarm_tilt = lal.ET3_DETECTOR_ARM_Y_ALTITUDE_RAD * 180/ np.pi
'''
self.append(
SealInterferometer(
"{}{}".format(name, ii + 1),
Expand All @@ -482,8 +511,9 @@ def __init__(
)
)

xarm_azimuth += 240
yarm_azimuth += 240
# was "+" in bilby. Changing to - could reduces the difference with LAL but still has ~1e-4 error
xarm_azimuth -= 240
yarm_azimuth -= 240

latitude += (
np.arctan(
Expand Down

0 comments on commit 7906296

Please sign in to comment.