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

Preparing for veto file handling in PyGRB #4929

Merged
merged 14 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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/pycbc_multi_inspiral
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def slide_limiter(args):
num_slides = 1
return num_slides


# The following block of lines sets up the command-line interface (CLI) for the
# pycbc_multi_inspiral executable.
time_init = time.time()
Expand Down
35 changes: 22 additions & 13 deletions bin/pygrb/pycbc_make_offline_grb_workflow
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

# Copyright (C) 2015 Andrew R. Williamson
# Copyright (C) 2015 Andrew R. Williamson, Francesco Pannarale
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
Expand Down Expand Up @@ -79,7 +79,6 @@ sciSegsFile = _workflow.get_segments_file(wflow,
'science',
'segments-science',
seg_dir)

sciSegs = {}
for ifo in wflow.ifos:
sciSegs[ifo] = sciSegsFile.segment_dict[ifo+':science']
Expand Down Expand Up @@ -130,14 +129,15 @@ else:

sciSegs = segmentlistdict(sciSegs)
if onSrc is None:
plot_met = make_grb_segments_plot(wflow, sciSegs, triggertime, triggername,
seg_dir, fail_criterion=offSrc)
plot_met = make_grb_segments_plot(
wflow, segmentlistdict(), triggertime, triggername,
seg_dir, fail_criterion=offSrc)
titodalcanton marked this conversation as resolved.
Show resolved Hide resolved
logging.info("Making segment plot and exiting.")
sys.exit()
else:
plot_met = make_grb_segments_plot(
wflow, sciSegs, triggertime, triggername, seg_dir,
coherent_seg=offSrc[tuple(offSrc.keys())[0]][0])
wflow, sciSegs, triggertime, triggername, seg_dir,
coherent_seg=offSrc[tuple(offSrc.keys())[0]][0])
segs_plot = _workflow.File(plot_met[0], plot_met[1], plot_met[2],
file_url=plot_met[3])
segs_plot.add_pfn(segs_plot.cache_entry.path, site="local")
Expand Down Expand Up @@ -193,10 +193,12 @@ if wflow.cp.has_option("workflow-condition_strain", "do-gating"):
int(sciSegs[ifo][0][1]))

ifos = sorted(sciSegs.keys())
ifo = ifos[0]
wflow.ifos = ifos
datafind_veto_files = _workflow.FileList([])

# Convenience variable to operate on sciSegs within this executable
ifo = ifos[0]

# GATING
if wflow.cp.has_option("workflow-condition_strain", "do-gating"):
logging.info("Creating gating jobs.")
Expand Down Expand Up @@ -234,12 +236,17 @@ if wflow.cp.has_option("workflow-condition_strain", "do-gating"):
gated_frames.convert_to_lal_cache().tofile(
open(gated_cache.storage_path, "w"))
datafind_files.append(gated_cache)

datafind_veto_files.extend(datafind_files)
ifo_list = sorted(sciSegs.keys())
ifo = ifo_list[0]
ifos = ''.join(ifo_list)
wflow.ifos = ifos
titodalcanton marked this conversation as resolved.
Show resolved Hide resolved

# Retrieve vetoes
veto_file = None
if wflow.cp.has_option("workflow-segments", "segments-vetoes"):
veto_file = _workflow.get_segments_file(wflow,
'vetoes',
'segments-vetoes',
seg_dir,
tags=['veto'])
datafind_veto_files.append(veto_file)

# Config file consistency check for IPN GRBs
if wflow.cp.has_option("workflow-inspiral", "ipn-search-points") \
Expand All @@ -262,6 +269,7 @@ else:
if wflow.cp.has_option('workflow-inspiral', 'bank-veto-bank-file'):
bank_veto_file = configparser_value_to_file(wflow.cp, 'workflow-inspiral',
'bank-veto-bank-file')
bank_veto_file.description += '_BANK_VETO_BANK'
bank_veto_file = _workflow.FileList([bank_veto_file])
datafind_veto_files.extend(bank_veto_file)

Expand Down Expand Up @@ -453,7 +461,8 @@ if post_proc_method == "PYGRB_OFFLINE":
clustered_files,
inj_find_files,
full_bank_file,
seg_dir)
seg_dir,
veto_file=veto_file)
logging.info('Leaving results module')

all_files.extend(pp_files)
Expand Down
Loading
Loading