Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyGRB reweighted SNR cut bug #5023

Merged
merged 2 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bin/pygrb/pycbc_pygrb_plot_injs_results
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ if opts.newsnr_threshold:
found_inj[key] = found_inj[key][~rw_snr_cut]
for ifo in ifos:
found_inj[ifo+'/end_time'] = found_inj[ifo+'/end_time'][~rw_snr_cut]
found_inj['reweighted_snr'] = found_inj['reweighted_snr'][~rw_snr_cut]
msg = f"After applying reweighted SNR cut at {opts.newsnr_threshold}: "
msg += f"{len(found_inj[x_qty])} found injections and "
msg += f"{len(missed_inj[x_qty])} missed injections"
Expand Down
18 changes: 8 additions & 10 deletions pycbc/results/pygrb_postprocessing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,6 @@ def apply_vetoes_to_found_injs(found_missed_file, found_injs, ifos,
dict.fromkeys(keep_keys, numpy.array([])),
None, None)

found_after_vetoes = found_injs
missed_after_vetoes = dict.fromkeys(keep_keys, numpy.array([]))
found_idx = numpy.arange(len(found_injs[ifos[0]+'/end_time'][:]))
veto_idx = numpy.array([], dtype=numpy.int64)

Expand All @@ -422,14 +420,14 @@ def apply_vetoes_to_found_injs(found_missed_file, found_injs, ifos,
logging.info("%d injections vetoed.", len(veto_idx))
logging.info("%d injections surviving vetoes.", len(found_idx))

found_after_vetoes = {}
missed_after_vetoes = {}
for key in keep_keys:
if key == 'network/coincident_snr':
found_injs[key] = get_coinc_snr(found_injs)
if isinstance(found_injs[key], numpy.ndarray):
found_after_vetoes[key] = found_injs[key][found_idx]
missed_after_vetoes[key] = found_injs[key][veto_idx]
found_after_vetoes = {}
missed_after_vetoes = {}
for key in keep_keys:
if key == 'network/coincident_snr':
found_injs[key] = get_coinc_snr(found_injs)
if isinstance(found_injs[key], numpy.ndarray):
found_after_vetoes[key] = found_injs[key][found_idx]
missed_after_vetoes[key] = found_injs[key][veto_idx]

return found_after_vetoes, missed_after_vetoes, found_idx, veto_idx

Expand Down
Loading