Skip to content

Commit

Permalink
Exclude IFO sections when looping through the get_subsections (#4402)
Browse files Browse the repository at this point in the history
* Exclude IFO sections when looping through the get_subsections for plots

* Add an example whihc would have previously failed into the search config
  • Loading branch information
GarethCabournDavies authored Jun 15, 2023
1 parent 80181d0 commit 9337353
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/search/plotting.ini
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ log-prune-param =
prune-bins = ${fit_by_template|prune-bins}
prune-number = ${fit_by_template|prune-number}

[plot_binnedhist-h1]
sngl-ranking = newsnr_sgveto

[plot_binnedhist-mtotal]
bin-param = mtotal
; for template duration, need a starting frequency
Expand Down
11 changes: 11 additions & 0 deletions pycbc/workflow/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,7 @@ def __init__(self, args, name=None):

self.ifos = ifos
self.ifos.sort(key=str.lower)
self.get_ifo_combinations()
self.ifo_string = ''.join(self.ifos)

# Set up input and output file lists for workflow
Expand Down Expand Up @@ -859,6 +860,16 @@ def save_config(self, fname, output_dir, cp=None):
ini_file.storage_path = ini_file_path
return FileList([ini_file])

def get_ifo_combinations(self):
"""
Get a list of strings for all possible combinations of IFOs
in the workflow
"""
self.ifo_combinations = []
for n in range(len(self.ifos)):
self.ifo_combinations += [''.join(ifos).lower() for ifos in
combinations(self.ifos, n + 1)]


class Node(pegasus_workflow.Node):
def __init__(self, executable, valid_seg=None):
Expand Down
3 changes: 3 additions & 0 deletions pycbc/workflow/minifollowups.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ def make_single_template_plots(workflow, segs, data_read_name, analyzed_name,
name = 'single_template_plot'
secs = requirestr(workflow.cp.get_subsections(name), require)
secs = excludestr(secs, exclude)
secs = excludestr(secs, workflow.ifo_combinations)
files = FileList([])
for tag in secs:
for ifo in workflow.ifos:
Expand Down Expand Up @@ -485,6 +486,7 @@ def make_plot_waveform_plot(workflow, params, out_dir, ifos, exclude=None,
name = 'single_template_plot'
secs = requirestr(workflow.cp.get_subsections(name), require)
secs = excludestr(secs, exclude)
secs = excludestr(secs, workflow.ifo_combinations)
files = FileList([])
for tag in secs:
node = PlotExecutable(workflow.cp, 'plot_waveform', ifos=ifos,
Expand Down Expand Up @@ -577,6 +579,7 @@ def make_trigger_timeseries(workflow, singles, ifo_times, out_dir, special_tids=
name = 'plot_trigger_timeseries'
secs = requirestr(workflow.cp.get_subsections(name), require)
secs = excludestr(secs, exclude)
secs = excludestr(secs, workflow.ifo_combinations)
files = FileList([])
for tag in secs:
node = PlotExecutable(workflow.cp, name, ifos=workflow.ifos,
Expand Down
8 changes: 8 additions & 0 deletions pycbc/workflow/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def make_range_plot(workflow, psd_files, out_dir, exclude=None, require=None,
makedir(out_dir)
secs = requirestr(workflow.cp.get_subsections('plot_range'), require)
secs = excludestr(secs, exclude)
secs = excludestr(secs, workflow.ifo_combinations)
files = FileList([])
for tag in secs:
node = PlotExecutable(workflow.cp, 'plot_range', ifos=workflow.ifos,
Expand Down Expand Up @@ -165,6 +166,7 @@ def make_sensitivity_plot(workflow, inj_file, out_dir, exclude=None,
makedir(out_dir)
secs = requirestr(workflow.cp.get_subsections('plot_sensitivity'), require)
secs = excludestr(secs, exclude)
secs = excludestr(secs, workflow.ifo_combinations)
files = FileList([])
for tag in secs:
node = PlotExecutable(workflow.cp, 'plot_sensitivity', ifos=workflow.ifos,
Expand All @@ -181,6 +183,7 @@ def make_coinc_snrchi_plot(workflow, inj_file, inj_trig, stat_file, trig_file,
makedir(out_dir)
secs = requirestr(workflow.cp.get_subsections('plot_coinc_snrchi'), require)
secs = excludestr(secs, exclude)
secs = excludestr(secs, workflow.ifo_combinations)
files = FileList([])
for tag in secs:
exe = PlotExecutable(workflow.cp, 'plot_coinc_snrchi',
Expand Down Expand Up @@ -315,6 +318,7 @@ def make_snrchi_plot(workflow, trig_files, veto_file, veto_name,
makedir(out_dir)
secs = requirestr(workflow.cp.get_subsections('plot_snrchi'), require)
secs = excludestr(secs, exclude)
secs = excludestr(secs, workflow.ifo_combinations)
files = FileList([])
for tag in secs:
for trig_file in trig_files:
Expand All @@ -341,6 +345,7 @@ def make_foundmissed_plot(workflow, inj_file, out_dir, exclude=None,
makedir(out_dir)
secs = requirestr(workflow.cp.get_subsections('plot_foundmissed'), require)
secs = excludestr(secs, exclude)
secs = excludestr(secs, workflow.ifo_combinations)
files = FileList([])
for tag in secs:
exe = PlotExecutable(workflow.cp, 'plot_foundmissed', ifos=workflow.ifos,
Expand Down Expand Up @@ -431,6 +436,7 @@ def make_single_hist(workflow, trig_file, veto_file, veto_name,
makedir(out_dir)
secs = requirestr(workflow.cp.get_subsections('plot_hist'), require)
secs = excludestr(secs, exclude)
secs = excludestr(secs, workflow.ifo_combinations)
files = FileList([])
for tag in secs:
node = PlotExecutable(workflow.cp, 'plot_hist',
Expand All @@ -455,6 +461,7 @@ def make_binned_hist(workflow, trig_file, veto_file, veto_name,
makedir(out_dir)
secs = requirestr(workflow.cp.get_subsections('plot_binnedhist'), require)
secs = excludestr(secs, exclude)
secs = excludestr(secs, workflow.ifo_combinations)
files = FileList([])
for tag in secs:
node = PlotExecutable(workflow.cp, 'plot_binnedhist',
Expand All @@ -478,6 +485,7 @@ def make_singles_plot(workflow, trig_files, bank_file, veto_file, veto_name,
makedir(out_dir)
secs = requirestr(workflow.cp.get_subsections('plot_singles'), require)
secs = excludestr(secs, exclude)
secs = excludestr(secs, workflow.ifo_combinations)
files = FileList([])
for tag in secs:
for trig_file in trig_files:
Expand Down

0 comments on commit 9337353

Please sign in to comment.