Skip to content

Commit

Permalink
Propagating slide_id information to some pygrb plotting scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiangomezlopez committed Jul 22, 2024
1 parent cbc36e4 commit 25e9726
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
3 changes: 2 additions & 1 deletion bin/pygrb/pycbc_pygrb_plot_chisq_veto
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ if ifo and ifo not in ifos:
raise RuntimeError(err_msg)

# Extract trigger data
trig_data = load_data(trig_file, ifos, vetoes, opts, slide_id=0)
trig_data = load_data(trig_file, ifos, vetoes, opts,
slide_id=opts.slide_id)

# Extract (or initialize) injection data
inj_data = load_data(found_missed_file, ifos, vetoes, opts,
Expand Down
2 changes: 1 addition & 1 deletion bin/pygrb/pycbc_pygrb_plot_coh_ifosnr
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ ifos, vetoes = ppu.extract_ifos_and_vetoes(
)

# Extract trigger data
trig_data = load_data(trig_file, ifos, vetoes, opts, slide_id=0)
trig_data = load_data(trig_file, ifos, vetoes, opts, slide_id=opts.slide_id)

# Extract (or initialize) injection data
inj_data = load_data(found_file, ifos, vetoes, opts, injections=True, slide_id=0)
Expand Down
3 changes: 2 additions & 1 deletion bin/pygrb/pycbc_pygrb_plot_null_stats
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ ifos, vetoes = ppu.extract_ifos_and_vetoes(trig_file, opts.veto_files,
opts.veto_category)

# Extract trigger data
trig_data = load_data(trig_file, ifos, vetoes, opts, slide_id=0)
trig_data = load_data(trig_file, ifos, vetoes, opts,
slide_id=opts.slide_id)

# Extract (or initialize) injection data
inj_data = load_data(found_missed_file, ifos, vetoes, opts,
Expand Down
11 changes: 7 additions & 4 deletions bin/pygrb/pycbc_pygrb_plot_snr_timeseries
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def reset_times(data_time, trig_time):
# =============================================================================
parser = ppu.pygrb_initialize_plot_parser(description=__doc__)
parser.add_argument("-t", "--trig-file", action="store",
default=None, required=True,
default=None, required=True,
help="The location of the trigger file")
parser.add_argument("--found-missed-file",
help="The hdf injection results file", required=False)
Expand Down Expand Up @@ -136,18 +136,21 @@ ifos, vetoes = ppu.extract_ifos_and_vetoes(trig_file, opts.veto_files,
# points to show the impact of the cut, otherwise remove points with
# reweighted SNR below threshold
if snr_type == 'reweighted':
trig_data = load_data(trig_file, ifos, vetoes, slide_id=0)
trig_data = load_data(trig_file, ifos, vetoes,
slide_id=opts.slide_id)
trig_data['network/reweighted_snr'] = \
reweightedsnr_cut(trig_data['network/reweighted_snr'],
opts.newsnr_threshold)
inj_data = load_data(inj_file, ifos, vetoes, injections=True,slide_id=0)
inj_data = load_data(inj_file, ifos, vetoes, injections=True,
slide_id=0)
if inj_data is not None:
inj_data['network/reweighted_snr'] = \
reweightedsnr_cut(inj_data['network/reweighted_snr'],
opts.newsnr_threshold)
else:
trig_data = load_data(trig_file, ifos, vetoes,
rw_snr_threshold=opts.newsnr_threshold, slide_id=0)
rw_snr_threshold=opts.newsnr_threshold,
slide_id=opts.slide_id)
inj_data = load_data(inj_file, ifos, vetoes,
rw_snr_threshold=opts.newsnr_threshold,
injections=True, slide_id=0)
Expand Down
4 changes: 3 additions & 1 deletion pycbc/results/pygrb_postprocessing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ def pygrb_initialize_plot_parser(description=None):
parser.add_argument('--plot-caption', default=None,
help="If provided, use the given string as the plot " +
"caption")

parser.add_argument("--slide-id", default=0, type=int,
help="If None, the plotting scripts will use triggers" +
"from all slides. Most plots only need the slide_id=0")
return parser


Expand Down

0 comments on commit 25e9726

Please sign in to comment.