Skip to content

Commit faefd3b

Browse files
committed
BUG: squash some bugs
1 parent 84c6621 commit faefd3b

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

bilby/gw/detector/interferometer.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -664,8 +664,7 @@ def whiten_frequency_series(self, frequency_series : np.array) -> np.array:
664664
return np.nan_to_num(frequency_series / (
665665
self.amplitude_spectral_density_array
666666
* np.sqrt(self.duration / 4)
667-
* self.frequency_mask
668-
))
667+
)) * self.frequency_mask
669668
else:
670669
return self.whiten_and_crop(frequency_series=frequency_series)
671670

@@ -715,7 +714,7 @@ def whiten_and_crop(self, frequency_series : np.array) -> np.array:
715714
cropped_time_series = time_series[self.time_mask]
716715
cropped_white, _ = nfft(cropped_time_series, self.sampling_frequency)
717716

718-
return cropped_white * (4 / (self.duration - 2 * self.cropped_duration))**0.5
717+
return cropped_white * (4 / self.cropped_duration)**0.5
719718

720719
def get_whitened_time_series_from_whitened_frequency_series(
721720
self,

bilby/gw/likelihood/base.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -301,30 +301,32 @@ def calculate_snrs(self, waveform_polarizations, interferometer, return_array=Tr
301301
(self.number_of_response_curves, 1)
302302
).T
303303

304-
d_inner_h_integrand *= self.calibration_draws[interferometer.name].T
304+
d_inner_h_integrand[interferometer.frequency_mask] *= self.calibration_draws[interferometer.name].T
305305

306-
d_inner_h_array = np.fft.fft(d_inner_h_integrand[0:-1], axis=0).T
306+
d_inner_h_array = np.fft.fft(d_inner_h_integrand[:-1], axis=0).T
307307

308308
optimal_snr_squared_integrand = np.abs(whitened_signal)**2
309309
optimal_snr_squared_array = np.dot(
310-
optimal_snr_squared_integrand,
310+
optimal_snr_squared_integrand[interferometer.frequency_mask],
311311
self.calibration_abs_draws[interferometer.name].T
312312
)
313313

314314
elif self.time_marginalization and not self.calibration_marginalization:
315-
d_inner_h_array = np.fft.fft(
315+
d_inner_h_integrand = (
316316
whitened_signal
317317
* interferometer.whitened_frequency_domain_strain.conjugate()
318318
)
319+
d_inner_h_array = np.fft.fft(d_inner_h_integrand[:-1])
319320

320321
elif self.calibration_marginalization and ('recalib_index' not in parameters):
321322
d_inner_h_integrand = (
322323
interferometer.whitened_frequency_domain_strain.conjugate() * whitened_signal
323-
)
324+
)[interferometer.frequency_mask]
324325
d_inner_h_array = np.dot(d_inner_h_integrand, self.calibration_draws[interferometer.name].T)
325326

326327
optimal_snr_squared_integrand = np.abs(whitened_signal)**2
327328
optimal_snr_squared_array = np.dot(
329+
optimal_snr_squared_integrand[interferometer.frequency_mask],
328330
self.calibration_abs_draws[interferometer.name].T
329331
)
330332

0 commit comments

Comments
 (0)