Skip to content

Commit

Permalink
Tables and minifollowups of: quiet-found and missed-found injections,…
Browse files Browse the repository at this point in the history
… loudest off-source triggers, loudest on-source trigger
  • Loading branch information
pannarale committed Oct 8, 2024
1 parent ede8f66 commit 2962046
Showing 1 changed file with 79 additions and 13 deletions.
92 changes: 79 additions & 13 deletions bin/pygrb/pycbc_pygrb_pp_workflow
Original file line number Diff line number Diff line change
Expand Up @@ -415,13 +415,29 @@ for inj_set in inj_sets:
# take [0]
files.append(output_files[0])
# Generate quiet-found and missed-found html tables
# TODO: pass loudest-onsource-trigger/loudest-offsource-triggers
# arguments if inj_set=None
inj_layout = list(layout.grouper(files, 2))
html_node, [mf_table, qf_table, qf_h5] = \
_workflow.make_pygrb_injs_tables(wflow, out_dir, bank_file,
offsource_file, seg_files,
inj_file=inj_file,
tags=inj_file.tags)
html_nodes.append(html_node)

inj_layout = list(layout.grouper(files, 2)) + [(mf_table,), (qf_table,)]
layout.two_column_layout(out_dir, inj_layout)

# TODO: Follow up of loudest N quiet-found injections:

# Follow up of loudest N quiet/missed-found injections:
# qf_h5 includes quiet and missed found injections
out_dir = rdir['injections/'+inj_set+'loudest_quiet_found_followups']
if not wflow.cp.has_section('workflow-minifollowups'):
msg = 'No [workflow-minifollowups] section found in '
msg += 'configuration file'
logging.info(msg)
else:
logging.info('Entering minifollowups module for injections')
_workflow.setup_pygrb_minifollowups(
wflow, qf_h5, offsource_file, 'daxes', out_dir,
tags=inj_file.tags+['loudest_quiet_found_injs'])
logging.info('Leaving minifollowups')

#
# FAP distributions
Expand All @@ -441,7 +457,27 @@ for stat in stats:
# pycbc_pygrb_plot_stats_distribution produces only one plot: take [0]
files.append(output_file[0])

# TODO: Include minifollow-ups materiale
# Generate loudest off-source triggers table
html_node, [lofft_table, lofft_h5] = \
_workflow.make_pygrb_injs_tables(wflow, out_dir, bank_file,
offsource_file, seg_files)
html_nodes.append(html_node)

lofft_layout = list(layout.grouper(files, 2)) + [(lofft_table,)]
layout.two_column_layout(out_dir, lofft_layout)

# Follow up N loudest offsource triggers (parent-child)
out_dir = rdir['loudest_offsource_events/followups']
if not wflow.cp.has_section('workflow-minifollowups'):
msg = 'No [workflow-minifollowups] section found in '
msg += 'configuration file'
logging.info(msg)
else:
logging.info('Entering minifollowups module for offsource')
_workflow.setup_pygrb_minifollowups(wflow, lofft_h5, offsource_file,
'daxes', out_dir,
tags=['loudest_offsource_events'])
logging.info('Leaving minifollowups')


#
Expand Down Expand Up @@ -478,12 +514,6 @@ for i, offtrial in enumerate(offtrials):
eff_layout = list(layout.grouper(files, 2))
layout.two_column_layout(out_dir, eff_layout, offtrial)

# TODO: add onsource calculation by using the true onsource file

#
# Trigger Followups (TODO)
#

# Make room for throughput histograms (TODO)
base = rdir['workflow/throughput']
_workflow.makedir(base)
Expand Down Expand Up @@ -535,7 +565,43 @@ _workflow.make_results_web_page(
out_dir = rdir['open_box']
_workflow.makedir(out_dir)
os.chmod(out_dir, 0o0700)
# TODO: follow up loudest offsource trigger

# Generate loudest on-source trigger table
_workflow.makedir(out_dir)
html_node, [lont_table, lont_h5] = \
_workflow.make_pygrb_injs_tables(wflow, out_dir, bank_file,
offsource_file, seg_files,
on_file=onsource_file)
html_nodes.append(html_node)

# Reweighted and coherent SNR timseries for the full data stretch
timeseries_plots = _workflow.FileList([])
for snr_type in ['reweighted', 'coherent']:
plot_node, output_files = \
_workflow.make_pygrb_plot(wflow,
'pygrb_plot_snr_timeseries',
out_dir,
trig_file=all_times_file,
tags=[snr_type, 'alltimes'])
plotting_nodes.append(plot_node)
timeseries_plots.extend(output_files)
openbox_layout = [(lont_table,)] + list(layout.grouper(timeseries_plots, 2))
layout.two_column_layout(out_dir, openbox_layout)


# Loudest on-source trigger follow up
out_dir = rdir['open_box/loudest_event_followup']
if not wflow.cp.has_section('workflow-minifollowups'):
msg = 'No [workflow-minifollowups] section found in '
msg += 'configuration file'
logging.info(msg)
else:
logging.info("Entering minifollowups module for loudest onsource")
_workflow.setup_pygrb_minifollowups(wflow, lont_h5, onsource_file,
'daxes', out_dir,
tags=['loudest_onsource_event'])
logging.info("Leaving onsource minifollowups")


# Close the log and flush to the html file
logging.shutdown()
Expand Down

0 comments on commit 2962046

Please sign in to comment.