From 331503a63307a5939ff54b9f91557be15bb91612 Mon Sep 17 00:00:00 2001 From: acorreia61201 Date: Tue, 4 Jun 2024 19:58:19 +0000 Subject: [PATCH] Revised init signature to be more similar to LIGO detector; rebase to most recent PyCBC patch (6/4/24) --- pycbc/detector.py | 61 ++++++++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/pycbc/detector.py b/pycbc/detector.py index cf05edf7e62..d3b44b2f356 100644 --- a/pycbc/detector.py +++ b/pycbc/detector.py @@ -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 @@ -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 ------- @@ -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) @@ -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: @@ -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 @@ -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']: @@ -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()