From 116d60feef1a59371ac75b13475e73451e3a67e6 Mon Sep 17 00:00:00 2001 From: Francesco Pannarale Date: Wed, 11 Sep 2024 09:02:07 -0700 Subject: [PATCH 1/5] Expand make_info_table to setup pygrb_grb_info_table jobs --- pycbc/workflow/grb_utils.py | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/pycbc/workflow/grb_utils.py b/pycbc/workflow/grb_utils.py index 3ad2a4ddf4a..50179848ef5 100644 --- a/pycbc/workflow/grb_utils.py +++ b/pycbc/workflow/grb_utils.py @@ -539,6 +539,8 @@ def make_pygrb_plot(workflow, exec_name, out_dir, node.add_opt('--y-variable', tags[0]) # Quantity to be displayed on the x-axis of the plot elif exec_name == 'pygrb_plot_stats_distribution': + seg_filelist = FileList([resolve_url_to_file(sf) for sf in seg_files]) + node.add_input_list_opt('--seg-files', seg_filelist) node.add_opt('--x-variable', tags[0]) elif exec_name == 'pygrb_plot_injs_results': # Variables to plot on x and y axes @@ -560,30 +562,36 @@ 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): + """ + 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')) + 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 From 1738bfcb2a7eac15df4e762658ef86b84e07a831 Mon Sep 17 00:00:00 2001 From: Francesco Pannarale Date: Thu, 12 Sep 2024 00:27:35 -0700 Subject: [PATCH 2/5] Code climate --- pycbc/workflow/grb_utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pycbc/workflow/grb_utils.py b/pycbc/workflow/grb_utils.py index 50179848ef5..93562521dfc 100644 --- a/pycbc/workflow/grb_utils.py +++ b/pycbc/workflow/grb_utils.py @@ -579,13 +579,14 @@ def make_info_table(workflow, exec_name, out_dir, in_files=None, tags=None): tags=tags+extra_tags).create_node() # Options - if exec_name=='pygrb_grb_info_table': - node.add_opt('--trigger-time', workflow.cp.get('workflow', 'trigger-time')) + 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')) node.add_opt('--ifos', ' '.join(workflow.ifos)) - elif exec_name=='pygrb_exclusion_dist_table': + elif exec_name == 'pygrb_exclusion_dist_table': node.add_input_opt('--input-files', in_files) # Output From 42ce417c060838e555a8c4ee40deb8d1abc416bb Mon Sep 17 00:00:00 2001 From: Francesco Pannarale Date: Thu, 12 Sep 2024 13:45:29 -0700 Subject: [PATCH 3/5] Cleanup --- pycbc/workflow/grb_utils.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/pycbc/workflow/grb_utils.py b/pycbc/workflow/grb_utils.py index 93562521dfc..b1324dbe061 100644 --- a/pycbc/workflow/grb_utils.py +++ b/pycbc/workflow/grb_utils.py @@ -539,8 +539,6 @@ def make_pygrb_plot(workflow, exec_name, out_dir, node.add_opt('--y-variable', tags[0]) # Quantity to be displayed on the x-axis of the plot elif exec_name == 'pygrb_plot_stats_distribution': - seg_filelist = FileList([resolve_url_to_file(sf) for sf in seg_files]) - node.add_input_list_opt('--seg-files', seg_filelist) node.add_opt('--x-variable', tags[0]) elif exec_name == 'pygrb_plot_injs_results': # Variables to plot on x and y axes From 238645a8566ced3cb7c02128e41c43a6351c0075 Mon Sep 17 00:00:00 2001 From: Francesco Pannarale Date: Thu, 12 Sep 2024 14:07:22 -0700 Subject: [PATCH 4/5] Update call to make_info_table in PyGRB workflow generator --- bin/pygrb/pycbc_pygrb_pp_workflow | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/pygrb/pycbc_pygrb_pp_workflow b/bin/pygrb/pycbc_pygrb_pp_workflow index 73620850291..a2954ac6c9d 100644 --- a/bin/pygrb/pycbc_pygrb_pp_workflow +++ b/bin/pygrb/pycbc_pygrb_pp_workflow @@ -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) # From e364aea1cc94cbb24845a3988b0f9fad1af94fb4 Mon Sep 17 00:00:00 2001 From: Francesco Pannarale Date: Thu, 19 Sep 2024 08:31:52 -0700 Subject: [PATCH 5/5] Renaming make_info_table to make_pygrb_info_table; removing 4 cp.get calls from make_pygrb_info_table --- pycbc/workflow/grb_utils.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pycbc/workflow/grb_utils.py b/pycbc/workflow/grb_utils.py index b1324dbe061..24d46232342 100644 --- a/pycbc/workflow/grb_utils.py +++ b/pycbc/workflow/grb_utils.py @@ -560,7 +560,8 @@ def make_pygrb_plot(workflow, exec_name, out_dir, return node, node.output_files -def make_info_table(workflow, exec_name, out_dir, in_files=None, tags=None): +def make_pygrb_info_table(workflow, exec_name, out_dir, in_files=None, + tags=None): """ Setup a job to create an html snippet with the GRB trigger information or exlusion distances information. @@ -578,11 +579,6 @@ def make_info_table(workflow, exec_name, out_dir, in_files=None, tags=None): # Options 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')) node.add_opt('--ifos', ' '.join(workflow.ifos)) elif exec_name == 'pygrb_exclusion_dist_table': node.add_input_opt('--input-files', in_files)