From 52816fe1f592be44c490866c8e68568eca9be16d Mon Sep 17 00:00:00 2001 From: Vijay Varma Date: Sun, 17 Nov 2019 21:29:02 -0800 Subject: [PATCH] Make 7dq4 dynamics closer to the LAL version There was a minor difference in how the refernce time was set given an f_ref. This is now fixed. Doesn't impact the waveform comparison noticeably, so this is still fine for the LAL review. --- gwsurrogate/new/precessing_surrogate.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/gwsurrogate/new/precessing_surrogate.py b/gwsurrogate/new/precessing_surrogate.py index d902d41..4921ba0 100644 --- a/gwsurrogate/new/precessing_surrogate.py +++ b/gwsurrogate/new/precessing_surrogate.py @@ -351,18 +351,28 @@ def _get_t_from_omega(self, omega_ref, q, chiA0, chiB0, init_orbphase, raise Exception("Got omega_ref = %0.4f < %0.4f = omega_0, " "too small!"%(omega_ref, omega0)) + # In this function we don't use the 3 half-node indices at the + # start. This is mainly to agree with the LAL implementation, where + # this was done, and should not affect anything meaningful. + full_node_indices = range(len(self.t)) + full_node_indices.remove(1) + full_node_indices.remove(3) + full_node_indices.remove(5) + # i0=0 is a lower bound, find the first index where omega > omega_ref - imax=1 - omega_max = self.get_omega(imax, q, y0) + imax = 1 omega_min = omega0 + omega_max = self.get_omega(full_node_indices[imax], q, y0) while omega_max <= omega_ref: imax += 1 omega_min = omega_max - omega_max = self.get_omega(imax, q, y0) + omega_max = self.get_omega(full_node_indices[imax], q, y0) - # Interpolate - t_ref = (self.t[imax-1] * (omega_max - omega_ref) - + self.t[imax] * (omega_ref - omega_min))/(omega_max - omega_min) + # Do a linear interpolation between omega_min and omega_max + t_min = self.t[full_node_indices[imax-1]]; + t_max = self.t[full_node_indices[imax]]; + t_ref = (t_min * (omega_max - omega_ref) + + t_max * (omega_ref - omega_min)) / (omega_max - omega_min); if t_ref < self.t[0] or t_ref > self.t[-1]: raise Exception("Somehow, t_ref ended up being outside of "