From 8923927c0aa6c04b5056b766b56c949f508dd8fb Mon Sep 17 00:00:00 2001 From: Marc Arene <arene.marc@gmail.com> Date: Tue, 3 Sep 2019 09:05:20 -0500 Subject: [PATCH] Fixing bug in dt --- bilby/gw/detector/interferometer.py | 6 +++++- bilby/gw/likelihood.py | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bilby/gw/detector/interferometer.py b/bilby/gw/detector/interferometer.py index a56bbb102..dbbbb5629 100644 --- a/bilby/gw/detector/interferometer.py +++ b/bilby/gw/detector/interferometer.py @@ -298,7 +298,11 @@ class Interferometer(object): time_shift = self.time_delay_from_geocenter( parameters['ra'], parameters['dec'], parameters['geocent_time']) - dt = parameters['geocent_time'] + time_shift - self.strain_data.start_time + + # Be careful to first substract the two GPS times which are ~1e9 sec. + # And then add the time_shift which varies at ~1e-5 sec + dt_geocent = parameters['geocent_time'] - self.strain_data.start_time + dt = dt_geocent + time_shift signal_ifo[self.strain_data.frequency_mask] = signal_ifo[self.strain_data.frequency_mask] * np.exp( -1j * 2 * np.pi * dt * self.strain_data.frequency_array[self.strain_data.frequency_mask]) diff --git a/bilby/gw/likelihood.py b/bilby/gw/likelihood.py index f950c27ea..326bcbf9d 100644 --- a/bilby/gw/likelihood.py +++ b/bilby/gw/likelihood.py @@ -895,8 +895,8 @@ class ROQGravitationalWaveTransient(GravitationalWaveTransient): dt = interferometer.time_delay_from_geocenter( self.parameters['ra'], self.parameters['dec'], self.parameters['geocent_time']) - ifo_time = self.parameters['geocent_time'] + dt - \ - interferometer.strain_data.start_time + dt_geocent = self.parameters['geocent_time'] - interferometer.strain_data.start_time + ifo_time = dt_geocent + dt calib_linear = interferometer.calibration_model.get_calibration_factor( self.frequency_nodes_linear, -- GitLab