nrutils.py: Fixing the NANs in the HBR final spin fit reported in #168
Description
This fixes the NANs returned by the HBR (Hoffmann, Barausse, and Rezzolla) fit for the magnitude of the final spin of a BBH coalescence that Serguei Ossokine reported in #168 (closed). It does so by truncating the argument of the square root to zero when it becomes negative, and prints a message about the truncation in this case. As Serguei noted, the NANs are a feature of the fit, specifically the phenomenological adjustment of the tilt angles to obtain smaller errors. Without that adjustment, the argument of the square root is nonnegative, on geometrical grounds.
I have checked that this fix indeed corrects the NANs in the two cases Serguei identified, and does not change the results returned by the code (to all decimal places output) in cases where the argument of the square root is nonnegative (10 randomly sampled points--see the original and new results). I have also checked that the magnitude of the final spin varies continuously (though not smoothly, due to the nature of the fix) when varying the parameters individually around the two cases that Serguei identified--see these plots. These checks are carried out using the code /home/nathan.johnson-mcdaniel/o3-postprocessing/check_HBR_NAN_fix.py
on LHO. The largest negative value of the argument of the square root found when making these plots is -3.27e-4.
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
Review Status
This is not yet reviewed, though @david-keitel agreed to the truncation fix in #168 (closed).