Difficulties with running parameter estimation analysis in challenge #4

Dear Open Data Workshop community, I would like to query some help regarding the solving of challenge #4 on the parameter estimation task.

I am trying to solve challenge #4 in the context of my gravitational waves undergrad course, and I have been encountering difficulties to run the analysis on the parameter estimation of the first signal event I could spot. The run_sampler() step with bilby is taking an eternity to run while yet struggling to converge. I would like to know if someone could review my code and know how to solve my problem…

Basically I am trying to estimate the mass for a signal that seems to appear in both interferometers and presents this nice chirp shape at ~ 1638 s (~27’18"), following the instructions that were provided (leaving chirp mass, geocent time, sky position and distance as the only free parameters) and I computed the likelihood similarly to as described in tutorial 5.2. However, once reached the step of the analysis, my cell has been running for more than 3hours on Google Collab and I think this is unusually long… Here’s the specifics I use for run_sampler()for reference:

result_short = bilby.run_sampler(
    likelihood,
    prior,
    sampler='dynesty',
    outdir='event1_results', label="event1",
    conversion_function=bilby.gw.conversion.generate_all_bbh_parameters, #Get m1,2 derived from M
    nlive=250,
    dlogz=1., # default one is 0.1
    clean=True # Deletes existing results in outdir before running
)

Does anyone see something that could be improved and let me know? I am stuck at this point.

Additionally, I’m not sure if I need to reproduce the PSD initialisation procedure of tutorial 5.2, or if this is somehow handled internally already… Also, may I ask what the difference is between this “PSD initialisation step” for parameter estimation and calculating the PSD in as in tutorial 3.2 for matched filtering. Are those two unrelated things? I’m sorry if my question might seem basic, I’m not fully acquainted with the data analysis techniques in gravitational waves yet :downcast_face_with_sweat:

I would be very grateful if anyone could lend me a hand!

Best regards, Denis

Hi Denis — I’m not an expert, but from what I understand your issue may be less about “nlive=250” itself and more about the setup around the likelihood and priors.

A few things I would check first:

  1. Make sure your “geocent_time” prior is centered on the actual GPS/event time expected by Bilby, not only the relative time of ~1638 s inside the file unless your data object is using that as its time reference. If the time prior is even slightly misplaced, Dynesty can spend forever exploring the wrong region.

  2. Yes, the PSD/noise model still matters for parameter estimation. Matched filtering uses the PSD to weight the template/SNR search, while Bilby parameter estimation uses the PSD inside the likelihood to compare the data against each proposed waveform. So they are related, but used at different stages.

  3. I would try a diagnostic fast run first, for example with fewer live points and looser convergence, just to confirm the likelihood/prior setup is sane before committing to a full run. Also check the Bilby log line for “Single likelihood evaluation took …”; if that is slow, the full sampler will be very slow.

  4. I would avoid “clean=True” once you start long runs, because it deletes previous results/checkpoints. For debugging it is fine, but for long sampling runs “resume=True” / not cleaning may save you time.

Something like this could be useful only as a quick test, not final science-quality settings:

result_short = bilby.run_sampler(
likelihood,
prior,
sampler=“dynesty”,
outdir=“event1_results”,
label=“event1”,
conversion_function=bilby.gw.conversion.generate_all_bbh_parameters,
nlive=50,
dlogz=5,
sample=“rwalk”,
clean=False,
resume=True,
)

If that fast run still does not find a sensible posterior near the event, I’d suspect the PSD/interferometer setup, the waveform approximant, or the “geocent_time” prior before increasing sampler settings.

Hello, thank you for your reply!

I am not sure to fully understand your first point. As those are simulated signals and the time labels in the file have been adjusted, I don’t see why there would be a difference. I set the analysis time window as follows:

merger_time = 1638.18 

sampling_rate = 2048 

duration = 8  

start_time = merger_time - 2  

interferometers = bilby.gw.detector.InterferometerList([])

for ifo_name in ['H1', 'L1']:

  # Set up empty interferometers
  ifo = bilby.gw.detector.get_empty_interferometer(ifo_name)

  # Initialise the Bilby interferometers with the strain data
  ifo.set_strain_data_from_frame_file('challenge3.gwf', sampling_rate, duration, start_time=start_time, channel=f'{ifo_name}:CHALLENGE3')

  interferometers.append(ifo)

and in the prior: prior['geocent_time'] = Uniform(minimum=merger_time-0.05, maximum=merger_time+0.05)

I ended up being able to run it below 2hours with a few tweaks in the run_sampler

result_short = bilby.run_sampler(

    likelihood=likelihood,
    priors=prior,
    sampler='dynesty',
    nlive=250,
    dlogz=1., # default one is 0.1
    sample='rwalk', # default is 'unif'
    nact=1, # minimal for speed
    walks=1, # minimal for speed
    outdir=f'{merger_time}_results',
    label=f"event_{merger_time}",
    conversion_function=bilby.gw.conversion.generate_all_bbh_parameters, #Get m1,2 derived from M
    clean=True # Deletes existing results in outdir before running
)

Thanks in advance!