bilby-dev / bilby

A unified framework for stochastic sampling packages and gravitational-wave inference in Python.
https://bilby-dev.github.io/bilby/
MIT License
68 stars 75 forks source link

Problems when reading and trying modifying examples/gw_examples/data_examples/GW190425.py for a new research #772

Closed bilby-bot closed 1 month ago

bilby-bot commented 1 year ago

In GitLab by @git.ligo:support-bot on Oct 31, 2023, 08:56

Dear Bilby maintainers:

I read Bilby example, examples/gw_examples/data_examples/GW190425.py · master · lscsoft / bilby · GitLab (ligo.org), and tried modifying it for a new research, and now I have some problems:

  1. line 93 is: priors = bilby.gw.prior.BBHPriorDict(filename="GW190425.prior") I think it should be BNSPriorDict, not BBHPriorDict! After I modified BBHPriorDict to BNSPriorDict and ran the code, no exceptions raised.

  2. line 117 is:

    Note, phase_marginalization is formally invalid with a precessing waveform such as IMRPhenomPv2

    but in line 123, param phase_marginalization is sat to be True. It seems to be a contradiction! After I modified phase_marginalization=True to phase_marginalization=False and ran the code, no exceptions raised.

  3. In line 122, time_marginalization is sat to be False, which is different from that in another example, examples/gw_examples/data_examples/GW150914.py · master · lscsoft / bilby · GitLab (ligo.org). I want to make time marginalization. After I modified time_marginalization=False to time_marginalization=True and ran the code, some exceptions raised! Here is the traceback: Traceback (most recent call last): File "/home/gasinan/pe/test/GW190425.py", line 118, in likelihood = bilby.gw.likelihood.RelativeBinningGravitationalWaveTransient( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/gasinan/miniconda3/lib/python3.11/site-packages/bilby/gw/likelihood/relative.py", line 169, in init logger.info(f"Fiducial likelihood: {self.log_likelihood_ratio():.2f}") ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/gasinan/miniconda3/lib/python3.11/site-packages/bilby/gw/likelihood/base.py", line 399, in log_likelihood_ratio self.parameters['geocent_time'] += self.parameters['time_jitter']

    
    KeyError: 'time_jitter'
    It really makes me disappointed. I hope I can make time marginalization when using bilby.gw.likelihood.RelativeBinningGravitationalWaveTransient.

Thank you very much for your consideration, and look forward to hearing from you soon.

Yours sincerely, Jiachen An

bilby-bot commented 1 year ago

In GitLab by @git.ligo:sylvia.biscoveanu on Nov 15, 2023, 20:42

Hi, the first two points you raise are not really issues.

  1. Using the BBHPriorDict instead of the BNSPriorDict is fine in this case since the priors are specified directly in terms of lambda_1 and lambda_2. If you want to specify priors in delta_lambda_tilde and lambda_tilde instead, this is when using the BNSPriorDict is required.
  2. While using phase marginalization is formatting incorrect for a precessing waveform approximant, it's fine to do when the precession effects are small, as is expected for binary neutron star systems.

The third point can be solved by adding "time_jitter": 0 to the fiducial_parameters dictionary defined on line 40 of the example.