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

setup_pygrb_minifollowups cleaner #4872

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Changes from 1 commit
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
23 changes: 11 additions & 12 deletions pycbc/workflow/grb_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2015 Andrew Williamson
# Copyright (C) 2015 Andrew 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 @@ -661,19 +661,20 @@ def make_pygrb_injs_tables(workflow, out_dir, # exclude=None, require=None,


# Based on setup_single_det_minifollowups
def setup_pygrb_minifollowups(workflow, followups_file,
dax_output, out_dir,
trig_file=None, tags=None):
"""Create plots that followup the the loudest PyGRB triggers or
def setup_pygrb_minifollowups(workflow, followups_file, trigger_file,
dax_output, out_dir, tags=None):
""" Create plots that followup the the loudest PyGRB triggers or
missed injections from an HDF file.

Parameters
----------
workflow: pycbc.workflow.Workflow
The core workflow instance we are populating
followups_file: pycbc.workflow.File
The File class holding the triggers/injections.
dax_output: The directory that will contain the dax file.
The File class holding the triggers/injections to follow up
trigger_file: pycbc.workflow.File
The File class holding the triggers
dax_output: The directory that will contain the dax file
out_dir: path
The directory to store minifollowups result plots and files
tags: {None, optional}
Expand All @@ -690,7 +691,6 @@ def setup_pygrb_minifollowups(workflow, followups_file,
return

tags = [] if tags is None else tags
# _workflow.makedir(dax_output)
makedir(dax_output)

# Turn the config file into a File instance
Expand All @@ -710,14 +710,12 @@ def setup_pygrb_minifollowups(workflow, followups_file,
tags=tags)
node = exe.create_node()

node.add_input_opt('--trig-file', resolve_url_to_file(trigger_file))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, the resolve_url_to_file call would not happen here, but instead be done as soon as the trigger_file is read in (presumably a few levels above this). The help states that trigger_file is a pycbc.workflow.File, which is what we would want, but not what seems to be happening if this is needed.

# Grab and pass all necessary files
if trig_file is not None:
node.add_input_opt('--trig-file', trig_file)
if workflow.cp.has_option('workflow', 'veto-files'):
veto_files = build_veto_filelist(workflow)
node.add_input_list_opt('--veto-files', veto_files)
trig_time = workflow.cp.get('workflow', 'trigger-time')
node.add_opt('--trigger-time', trig_time)
node.add_input_opt('--config-files', config_file)
node.add_input_opt('--followups-file', followups_file)
node.add_opt('--wiki-file', wikifile)
Expand All @@ -734,6 +732,7 @@ def setup_pygrb_minifollowups(workflow, followups_file,

node.add_opt('--workflow-name', name)
node.add_opt('--output-dir', out_dir)
node.add_opt('--dax-file-directory', '.')

workflow += node

Expand Down
Loading