nuclear-multimessenger-astronomy / nmma

A pythonic library for probing nuclear physics and cosmology with multimessenger analysis
https://nuclear-multimessenger-astronomy.github.io/nmma/
GNU General Public License v3.0
32 stars 58 forks source link

Change deprecated key `distance` to `luminosity_distance` #375

Open ThibeauWouters opened 3 months ago

ThibeauWouters commented 3 months ago

Describe the bug There are a few instances where NMMA makes use of the key distance rather than luminosity_distance, but the former seems to be deprecated in favour of the latter. Therefore, one should make sure to remove all references to the former. grepping in NMMA, it seems the deprecated key occurs in the following files:

This bug can cause unexpected behavior when running injections with nmma-create-injection.py: when giving luminosity distances under the column name distance, the values are ignored and instead, values are sampled from the provided prior.

To Reproduce Steps to reproduce the behavior:

  1. Download example injections file injections.dat from NMMA repository.
  2. Run the following command
nmma-create-injection \
    --prior-file ./Bu2022Ye.prior \
    --injection-file ./injections.dat \
    --eos-file ../injections_tidal/36022_macroscopic.dat \
    --binary-type BNS \
    --extension json \
    -f ./injection_Bu2022Ye \
    --generation-seed 42 \
    --aligned-spin \
    --eject

where the EOS could be replaced by this EOS file and an example of a prior file is:

timeshift=0
luminosity_distance = Uniform(name='luminosity_distance', minimum=0., maximum=800., latex_label='$d_L$')
inclination_EM = Uniform(name='inclination_EM', minimum=0., maximum=np.pi/2., latex_label='$\\iota$')
log10_mej_dyn  = Uniform(name='log10_mej_dyn', minimum=-3, maximum=-1.7, latex_label='$\\log_{10}M^{\\rm{dyn}}_{\\rm{ej}}$')
vej_dyn = Uniform(name='vej_dyn', minimum=0.12, maximum=0.25, latex_label='$V^{\\rm{dyn}}_{\\rm{ej}}$')
Yedyn = Uniform(name='Yedyn', minimum=0.15, maximum=0.3, latex_label='$Y_{\\rm{e}}$')
log10_mej_wind = Uniform(name='log10_mej_wind', minimum=-2, maximum=-0.89, latex_label='$\\log_{10}M^{\\rm{wind}}_{\\rm{ej}}$')
vej_wind = Uniform(name='vej_wind', minimum=0.03, maximum=0.15, latex_label='$V^{\\rm{wind}}_{\\rm{ej}}$')
alpha = Gaussian(mu=0., sigma=4e-3, name='alpha',latex_label='$\\alpha$')
ratio_zeta = Uniform(minimum=0.10, maximum=0.50, name='ratio_zeta',latex_label='$\\zeta$')
ratio_epsilon = Uniform(minimum=0.00, maximum=1.0, name='ratio_epsilon',latex_label='$\\varepsilon$')
cos_theta_jn = Uniform(name='cos_theta_jn', minimum=-1, maximum=1, boundary='reflective')

Expected behavior The injected luminosity distances are the ones written down in the distance column of the injections.dat file.