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

Function to setup pygrb_grb_info_table jobs #4875

Merged
merged 6 commits into from
Sep 19, 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
2 changes: 1 addition & 1 deletion bin/pygrb/pycbc_pygrb_pp_workflow
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ files = _workflow.FileList([])
#
# Create information table about the GRB trigger and plot the search grid
#
info_table_node, grb_info_table = _workflow.make_info_table(wflow, out_dir)
info_table_node, grb_info_table = _workflow.make_info_table(wflow, 'pygrb_grb_info_table', out_dir)
html_nodes.append(info_table_node)
files.append(grb_info_table)
#
Expand Down
31 changes: 19 additions & 12 deletions pycbc/workflow/grb_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,30 +560,37 @@ def make_pygrb_plot(workflow, exec_name, out_dir,
return node, node.output_files


def make_info_table(workflow, out_dir, tags=None):
"""Setup a job to create an html snippet with the GRB trigger information.
def make_info_table(workflow, exec_name, out_dir, in_files=None, tags=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

Can the function be a bit more specific make_grb_info_table at least?

"""
Setup a job to create an html snippet with the GRB trigger information
or exlusion distances information.
"""

# Organize tags
tags = [] if tags is None else tags

# Executable
exec_name = 'pygrb_grb_info_table'
grb_name = workflow.cp.get('workflow', 'trigger-name')
extra_tags = ['GRB'+grb_name]

# Initialize job node
grb_name = workflow.cp.get('workflow', 'trigger-name')
extra_tags = ['GRB'+grb_name, 'INFO_TABLE']
node = PlotExecutable(workflow.cp, exec_name,
ifos=workflow.ifos, out_dir=out_dir,
tags=tags+extra_tags).create_node()

# Options
node.add_opt('--trigger-time', workflow.cp.get('workflow', 'trigger-time'))
node.add_opt('--ra', workflow.cp.get('workflow', 'ra'))
node.add_opt('--dec', workflow.cp.get('workflow', 'dec'))
node.add_opt('--sky-error', workflow.cp.get('workflow', 'sky-error'))
node.add_opt('--ifos', ' '.join(workflow.ifos))
if exec_name == 'pygrb_grb_info_table':
node.add_opt('--trigger-time',
workflow.cp.get('workflow', 'trigger-time'))
node.add_opt('--ra', workflow.cp.get('workflow', 'ra'))
node.add_opt('--dec', workflow.cp.get('workflow', 'dec'))
node.add_opt('--sky-error', workflow.cp.get('workflow', 'sky-error'))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do these need to be read from cp.get? The all-sky workflow has numerous cases where options are shared between codes, and the config files have syntax to support this .... The idea being to avoid these setup codes being unecessarily complex and having the configs specifying, as much as possible, what arguments codes will run with.

node.add_opt('--ifos', ' '.join(workflow.ifos))
elif exec_name == 'pygrb_exclusion_dist_table':
node.add_input_opt('--input-files', in_files)

# Output
node.new_output_file_opt(workflow.analysis_time, '.html',
'--output-file', tags=extra_tags)

# Add job node to workflow
workflow += node

Expand Down
Loading