From 65c958a25f7cdc6cebe4857e780c6510b28bb521 Mon Sep 17 00:00:00 2001 From: Max Isi Date: Tue, 29 Oct 2024 11:39:08 -0400 Subject: [PATCH] example: fixed likelihood call --- example/GW150914_IMRPhenomPV2.py | 15 +++++++++++---- src/jimgw/single_event/likelihood.py | 3 +++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/example/GW150914_IMRPhenomPV2.py b/example/GW150914_IMRPhenomPV2.py index a75a219f..2556e6f9 100644 --- a/example/GW150914_IMRPhenomPV2.py +++ b/example/GW150914_IMRPhenomPV2.py @@ -49,19 +49,26 @@ psd_end = gps + 2048 # define frequency integration bounds for the likelihood +# we set fmax to 87.5% of the Nyquist frequency to avoid +# data corrupted by the GWOSC antialiasing filter +# (Note that Data.from_gwosc will pull data sampled at +# 4096 Hz by default) fmin = 20.0 -fmax = 1000.0 +fmax = 896.0 ifos = [H1, L1] for ifo in ifos: + # set analysis data data = jd.Data.from_gwosc(ifo.name, start, end) ifo.set_data(data) + # set PSD (Welch estimate) psd_data = jd.Data.from_gwosc(ifo.name, psd_start, psd_end) psd_fftlength = data.duration * data.sampling_frequency ifo.set_psd(psd_data.to_psd(nperseg=psd_fftlength)) +# define the approximant to use waveform = RippleIMRPhenomPv2(f_ref=20) ########################################### @@ -154,7 +161,7 @@ likelihood = TransientLikelihoodFD( - [H1, L1], waveform=waveform, trigger_time=gps, duration=4, post_trigger_duration=2 + [H1, L1], waveform=waveform, f_min=fmin, f_max=fmax, trigger_time=gps ) @@ -163,8 +170,8 @@ # mass_matrix = mass_matrix.at[9, 9].set(1e-3) local_sampler_arg = {"step_size": mass_matrix * 1e-3} -Adam_optimizer = optimization_Adam( - n_steps=3000, learning_rate=0.01, noise_level=1) +# Adam_optimizer = optimization_Adam( +# n_steps=3000, learning_rate=0.01, noise_level=1) n_epochs = 20 diff --git a/src/jimgw/single_event/likelihood.py b/src/jimgw/single_event/likelihood.py index 47bd591a..2eb020c8 100644 --- a/src/jimgw/single_event/likelihood.py +++ b/src/jimgw/single_event/likelihood.py @@ -47,6 +47,9 @@ def __init__( post_trigger_duration: Float = 2, **kwargs, ) -> None: + # NOTE: having 'kwargs' here makes it very difficult to diagnose + # errors and keep track of what's going on, would be better to list + # explicitly what the arguments are accepted self.detectors = detectors # make sure data has a Fourier representation