Revision 9291900d0e04ba2345b5cb5f324858ab964abf22 authored by Josh Willis on 28 May 2020, 10:48:11 UTC, committed by GitHub on 28 May 2020, 10:48:11 UTC
* Add scripts for detailed comparison of two offline search runs

* Relocate offline search workflow comparisons from tools/ to bin/

* Add copyright statements to all newly added search comparison scripts

* Clarify some arguments to 'pycbc_injection_set_comparison'
1 parent 615f9db
Raw File
check_GW150914_detection.py
#!/usr/bin/env python
# Read a pycbc_inspiral HDF5 trigger file and check that it contains triggers
# compatible with GW150914
# 2016 Tito Dal Canton

import sys
import h5py
import numpy as np

gw150914_time = 1126259462.4
gw150914_snr = {'H1': 19.71, 'L1': 13.28}
gw150914_chi2r = {'H1': 1.05, 'L1': 0.45}

f = h5py.File(sys.argv[1], 'r')
detector = tuple(f.keys())[0]
end_times = f[detector]['end_time'][:]
snrs = f[detector]['snr'][:]
chi2rs = f[detector]['chisq'][:] / (2 * f[detector]['chisq_dof'][:] - 2)

# search for trigs compatible with GW150914
mask = np.logical_and.reduce([abs(end_times - gw150914_time) < 0.1,
                              snrs > 0.8 * gw150914_snr[detector],
                              snrs < 1.2 * gw150914_snr[detector],
                              chi2rs > 0.8 * gw150914_chi2r[detector],
                              chi2rs < 1.2 * gw150914_chi2r[detector]])

if mask.any():
    print('Pass: %d GW150914-like triggers' % sum(mask))
    print('end_time snr reduced_chi2')
    for t, s, c in zip(end_times[mask], snrs[mask], chi2rs[mask]):
        print('%.3f %.3f %.3f' % (t, s, c))
    sys.exit(0)
else:
    print('Fail: no GW150914-like triggers')
    sys.exit(1)
back to top