gwastro / pycbc

Core package to analyze gravitational-wave data, find signals, and study their parameters. This package was used in the first direct detection of gravitational waves (GW150914), and is used in the ongoing analysis of LIGO/Virgo data.
http://pycbc.org
GNU General Public License v3.0
314 stars 348 forks source link

Sort all quantities consistently in grb_inj_finder #4767

Closed pannarale closed 4 months ago

pannarale commented 4 months ago

Standard information about the request

This is a: bug fix.

This change affects: PyGRB.

This change changes: result presentation / plotting, scientific output.

Motivation

The PyGRB workflows were showing inconsistent injection results in the output pages:

  1. Network power chi-squares looked erratic H1L1-PYGRB_PLOT_CHISQ_VETO_NETWORK_NSBH_GRB170728A-1185258293-5648

  2. Differences between injection and recovery times were scattered all over the analysis time (for both injection sets used; the axes are in seconds) dt

  3. Recovered chirp mass values were incompatible with the injected values.

Here is a webpage with these, but I will not keep it much longer at this point.

Contents

pycbc_grb_inj_finder was sorting timing information, extracting indices with argsort based on such sorted array and using them on other two arrays that had not been sorted the same way. These contain the SNR (coherent, reweghited, ..., it is a user choice) and the event_ids. This meant that the incorrect event_id was associated to each found injection, causing the issues in plots and tables outlined above. The fix is to simply sort the SNR and event_id arrays as the timing one, prior to using the argsorted indices on them.

Testing performed

Here is a plot of the same chi square after the fix. H1L1-PYGRB_PLOT_CHISQ_VETO_NETWORK_NSBH_GRB170728A-1185258293-5648-1

It is taken from the regenerated version of the webpage for the example linked above.

Finally, a plot of the time differences (injected - recovered) for the two injection sets in this specific run. dt-1

pannarale commented 4 months ago

I will add that this also cleans up the efficiency plots. Here is an example before and after the fix. H1L1-PYGRB_EFFICIENCY_OFFTRIAL_3_NSBH_GRB170728A_ONSOURCE-1185258293-5648 H1L1-PYGRB_EFFICIENCY_OFFTRIAL_3_NSBH_GRB170728A_ONSOURCE-1185258293-5648-1