Skip to content

Commit

Permalink
example: fixed likelihood call
Browse files Browse the repository at this point in the history
  • Loading branch information
maxisi committed Oct 29, 2024
1 parent d97dafb commit 65c958a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
15 changes: 11 additions & 4 deletions example/GW150914_IMRPhenomPV2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

###########################################
Expand Down Expand Up @@ -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
)


Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/jimgw/single_event/likelihood.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 65c958a

Please sign in to comment.