Bayesspputils eta fixes
Summary
Simplifying the computation of eta and lam_tilde/dlam_tilde in bayespputils.py to avoid errors with eta becoming slightly greater than 0.25.
Description
The q2eta function in bayespputils.py now computes eta = q/(1+q)^2, instead of first computing m1 and m2, which was causing eta to become slightly greater than 0.25 in some cases. q2eta thus now only takes in q, not (mc, q). It now additionally caps eta at 0.25, to be extra-safe. This function is also used in cbcBayesPosToSimInspiral.py, so I changed the call there to no longer pass mc.
The symm_tidal_params function in bayespputils.py now take q as input, instead of eta, to avoid the sqrt(1 - 4*eta) term that caused trouble when eta > 0.25 and seems overly complicated, in general. I also defined some additional variables, to make the function easier to read and more efficient.
I have checked that running cbcBayesPostProc on /home/anuradha.gupta/spin_evolution_test/pe_runs/tidal_ns_run/run/posterior_samples/posterior_H1L1_1135136363.571641445-0.hdf5 (CIT) no longer runs into an error with symm_tidal_params (output in /home/nathan.johnson-mcdaniel/bayespputils_test/test_bayespputils_eta_fix on LHO) and all eta values are indeed <= 0.25.
I also checked that the eta, lam_tilde, and dlam_tilde values from this GW170817 run are reproduced to good accuracy when running cbcBayesPostProc on the HDF5 posterior sample file. Specifically, the maximum absolute differences between the new and old samples for eta, lam_tilde, and dlam_tilde are 1.1102230246251565e-16, 1.668900040385779e-08, and 8.6171638713494758e-09, respectively. The output of the cbcBayesPostProc run with the new code is in /home/nathan.johnson-mcdaniel/bayespputils_test/GW170817_bayespputils_eta_fix_test on LHO.
API Changes and Justification
Backwards Compatible Changes
-
This change introduces no API changes -
This change adds new API calls
Backwards Incompatible Changes
-
This change modifies an existing API -
This change removes an existing API
The q2eta function in bayespputils.py now only takes q as input, not also mc. Since mc is not needed in the calculation, it makes sense to remove it from the input to q2eta, particularly since q2eta is just used in one other piece of LALSuite (cbcBayesPosToSimInspiral.py).