From 9495f3467c320589b1a3ea753ba8aa4459740a74 Mon Sep 17 00:00:00 2001 From: ThibeauWouters Date: Mon, 13 Nov 2023 15:28:10 +0100 Subject: [PATCH] Revert "attempt to fix heterodyning for GW150914" This reverts commit 5ea134782fe0ad3e0b5324ecc82901780168184c. --- example/GW150914.py | 4 ++-- src/jimgw/likelihood.py | 25 ++++--------------------- 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/example/GW150914.py b/example/GW150914.py index da523ac4..2e73ad58 100644 --- a/example/GW150914.py +++ b/example/GW150914.py @@ -47,8 +47,8 @@ "cos_iota": ("iota",lambda params: jnp.arccos(jnp.arcsin(jnp.sin(params['cos_iota']/2*jnp.pi))*2/jnp.pi)), "sin_dec": ("dec",lambda params: jnp.arcsin(jnp.arcsin(jnp.sin(params['sin_dec']/2*jnp.pi))*2/jnp.pi))} # sin and arcsin are periodize cos_iota and sin_dec ) -# likelihood = TransientLikelihoodFD([H1, L1], waveform=RippleIMRPhenomD(), trigger_time=gps, duration=4, post_trigger_duration=2) -likelihood = HeterodynedTransientLikelihoodFD([H1, L1], prior=prior, bounds=[prior.xmin, prior.xmax], waveform=RippleIMRPhenomD(), trigger_time=gps, duration=4, post_trigger_duration=2) +likelihood = TransientLikelihoodFD([H1, L1], waveform=RippleIMRPhenomD(), trigger_time=gps, duration=4, post_trigger_duration=2) +# likelihood = HeterodynedTransientLikelihoodFD([H1, L1], prior=prior, bounds=[prior.xmin, prior.xmax], waveform=RippleIMRPhenomD(), trigger_time=gps, duration=4, post_trigger_duration=2) mass_matrix = jnp.eye(11) diff --git a/src/jimgw/likelihood.py b/src/jimgw/likelihood.py index 376ab581..579eca5b 100644 --- a/src/jimgw/likelihood.py +++ b/src/jimgw/likelihood.py @@ -177,24 +177,14 @@ def __init__( f_max = jnp.max(f_valid) f_min = jnp.min(f_valid) - # Apply the mask for frequencies to both polarization modes and for all waveforms currently used - for mode in ["p", "c"]: - h_sky[mode] = h_sky[mode][jnp.where((frequency_original>=f_min) & (frequency_original<=f_max))[0]] - # h_sky_low[mode] = h_sky_low[mode][jnp.where((self.freq_grid_low>=f_min) & (self.freq_grid_low<=f_max))[0]] - h_sky_low[mode] = h_sky[mode][:-1] # TODO does this work? - h_sky_center[mode] = h_sky_center[mode][jnp.where((self.freq_grid_center>=f_min) & (self.freq_grid_center<=f_max))[0]] + h_sky = h_sky[jnp.where((frequency_original>=f_min) & (frequency_original<=f_max))[0]] + h_sky_low = h_sky_low[jnp.where((self.freq_grid_low>=f_min) & (self.freq_grid_low<=f_max))[0]] + h_sky_center = h_sky_center[jnp.where((self.freq_grid_center>=f_min) & (self.freq_grid_center<=f_max))[0]] frequency_original = frequency_original[jnp.where((frequency_original>=f_min) & (frequency_original<=f_max))[0]] - freq_grid = freq_grid[jnp.where((freq_grid>=f_min) & (freq_grid<=f_max))[0]] - # self.freq_grid_low = self.freq_grid_low[jnp.where((self.freq_grid_low>=f_min) & (self.freq_grid_low<=f_max))[0]] - self.freq_grid_low = freq_grid[:-1] # TODO override, does this work? + self.freq_grid_low = self.freq_grid_low[jnp.where((self.freq_grid_low>=f_min) & (self.freq_grid_low<=f_max))[0]] self.freq_grid_center = self.freq_grid_center[jnp.where((self.freq_grid_center>=f_min) & (self.freq_grid_center<=f_max))[0]] - print("len(self.freq_grid_low)") - print(len(self.freq_grid_low)) - print("len(self.freq_grid_center)") - print(len(self.freq_grid_center)) - align_time = jnp.exp( -1j * 2 @@ -218,9 +208,6 @@ def __init__( ) for detector in self.detectors: - # Also apply the mask of frequencies to the strain data - detector.data = detector.data[jnp.where((frequency_original>=f_min) & (frequency_original<=f_max))[0]] - # Get the reference waveforms waveform_ref = ( detector.fd_response(frequency_original, h_sky, self.ref_params) * align_time @@ -270,11 +257,7 @@ def evaluate(self, params: Array, data: dict) -> float: detector.fd_response(frequencies_center, waveform_sky_center, params) * align_time_center ) - r0 = waveform_center / self.waveform_center_ref[detector.name] - print(np.shape(r0)) - print(np.shape(waveform_low)) - print(np.shape(waveform_center)) r1 = (waveform_low / self.waveform_low_ref[detector.name] - r0) / ( frequencies_low - frequencies_center )