Skip to content

Commit

Permalink
Revised init signature to be more similar to LIGO detector; rebase to…
Browse files Browse the repository at this point in the history
… most recent PyCBC patch (6/4/24)
  • Loading branch information
acorreia61201 committed Jun 4, 2024
1 parent f9d5330 commit 331503a
Showing 1 changed file with 39 additions and 22 deletions.
61 changes: 39 additions & 22 deletions pycbc/detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,21 +658,39 @@ class LISA_detector(object):
"""
LISA-like GW detector. Applies detector response from FastLISAResponse.
"""
def __init__(self, orbits=ESAOrbits(), use_gpu=False):
def __init__(self, detector='LISA', reference_time=None, orbits=ESAOrbits(), use_gpu=False):
"""
Parameters
----------
orbits: lisatools.detector.Orbits, optional
Orbital information to pass into pyResponseTDI. Accepts LISA Analysis Tools
format. Default ESAOrbits.
detector: str (optional)
String specifying space-borne detector. Currently only accepts 'LISA',
which is the default setting.
reference_time: float (optional)
The GPS start time of signal in the SSB frame. Default to start time of
orbits input.
orbits: lisatools.detector.Orbits (optional)
Orbital information to pass into pyResponseTDI. Default
lisatools.detector.ESAOrbits.
use_gpu : bool (optional)
Specify whether to run class on GPU support. Default False.
Specify whether to run class on GPU support via CuPy. Default False.
"""
# initialize detector; for now we only accept LISA
assert (detector=='LISA'), 'Currently only supports LISA detector'

# intialize orbit information
if orbits is None:
raise ImportError('LISAanalysistools required for inputting orbital data')
orbits.configure(linear_interp_setup=True)
self.orbits = orbits

# specify and cache the start time and orbital time series
if reference_time is None:
reference_time = self.orbits.t_base[0]
self.ref_time = reference_time
self.sample_times = None

# cache the FLR instance along with dt and n
self.dt = None
Expand Down Expand Up @@ -714,7 +732,7 @@ def get_links(self, hp, hc, lamb, beta, t0=10000., use_gpu=None, reference_time=
reference_time : float (optional)
The GPS start time of the GW signal in the SSB frame. Default to
value in input signals hp and hc.
input on class initialization.
Returns
-------
Expand All @@ -727,11 +745,18 @@ def get_links(self, hp, hc, lamb, beta, t0=10000., use_gpu=None, reference_time=
dt = hp.delta_t # timestep (s)
n = len(hp) # number of points

# configure the orbits file according to wf times
# cache n, dt
self.dt = dt
self.n = n
self.t0 = t0

# set waveform start time and cache the resultant time series
if reference_time is not None:
hp.start_time = reference_time
self.ref_time = reference_time
hp.start_time = self.ref_time
self.sample_times = hp.sample_times.numpy()


# rescale the orbital time series to match waveform
### FIXME: This currently doesn't work. There seems to be a bug in
### LISAanalysistools that breaks the code when specifying a time array.
# self.orbits.configure(t_arr=self.sample_times)
Expand All @@ -754,8 +779,8 @@ def get_links(self, hp, hc, lamb, beta, t0=10000., use_gpu=None, reference_time=

if self.response_init is None:
# initialize the class
### TDI is set to '2nd generation' here to match default value in get_tdi()
### see FIXME in get_tdi()
### TDI is set to '2nd generation' here to match default value in project_wave()
### see FIXME in project_wave()
response_init = pyResponseTDI(1/dt, n, orbits=self.orbits, use_gpu=use_gpu, tdi='2nd generation')
self.response_init = response_init
else:
Expand All @@ -765,11 +790,6 @@ def get_links(self, hp, hc, lamb, beta, t0=10000., use_gpu=None, reference_time=
self.response_init.orbits = self.orbits
self.response_init.use_gpu = use_gpu

# cache n, dt, response class
self.dt = dt
self.n = n
self.t0 = t0

# project the signal
self.response_init.get_projections(wf, lamb, beta, t0)
wf_proj = self.response_init.y_gw
Expand Down Expand Up @@ -823,12 +843,12 @@ def project_wave(self, hp, hc, lamb, beta, reference_time=None, tdi='2nd generat
dict
The TDI observables keyed by their corresponding TDI channel.
"""

# set use_gpu
if use_gpu is None:
use_gpu = self.use_gpu

tdi_args = {}

# generate the Doppler time series
links = self.get_links(hp, hc, lamb, beta, t0=self.t0, use_gpu=use_gpu, reference_time=reference_time)

# set TDI configuration
if tdi in ['1st generation', '2nd generation']:
Expand Down Expand Up @@ -856,9 +876,6 @@ def project_wave(self, hp, hc, lamb, beta, reference_time=None, tdi='2nd generat
if self.response_init.tdi != original_tdi:
self.response_init._init_tdi_delays()

# generate the Doppler time series
links = self.get_links(hp, hc, lamb, beta, t0=self.t0, use_gpu=use_gpu, reference_time=reference_time)

# generate the TDI channels
tdi_obs = self.response_init.get_tdi_delays()

Expand Down

0 comments on commit 331503a

Please sign in to comment.