Skip to content

Commit

Permalink
Revert "attempt to fix heterodyning for GW150914"
Browse files Browse the repository at this point in the history
This reverts commit 5ea1347.
  • Loading branch information
ThibeauWouters committed Nov 13, 2023
1 parent 224d020 commit 9495f34
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
4 changes: 2 additions & 2 deletions example/GW150914.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
25 changes: 4 additions & 21 deletions src/jimgw/likelihood.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
)
Expand Down

0 comments on commit 9495f34

Please sign in to comment.