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

Fars_vs_stat plot in results page #5052

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
10 changes: 6 additions & 4 deletions bin/plotting/pycbc_page_fars_vs_stat
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,14 @@ ax = fig.add_subplot(111)
ifar_calc_points = np.linspace(-10, 30, 200)

fitted = [] # List of combos for which a fit is used
for f in opts.trigger_files:
for item in opts.trigger_files:
sig_key, f = item.split(':', 1) # Split at the first colon
logging.info(f"Opening {f}")
with h5py.File(f, 'r') as exc_zlag_f:
logging.info(f"Ifos {exc_zlag_f.attrs['ifos']}") # eg 'H1 L1'
sig_key = exc_zlag_f.attrs['ifos'].replace(' ', '') # eg 'H1L1'
coinc_key = sig_key.replace('1', '') # eg 'HL'
ifos = ' '.join(list(sig_key)) # eg 'H1 L1'
logging.info(f"Ifos {ifos}")
sig_key = ifos.replace(' ', '') # eg 'H1L1'
coinc_key = ''.join([c for c in sig_key if not c.isdigit()]) # eg 'HL'
stat_exc = exc_zlag_f['background_exc']['stat'][:]
dec_fac_exc = exc_zlag_f['background_exc']['decimation_factor'][:]
bg_time = convert_s_to_y(exc_zlag_f.attrs['background_time_exc'])
Expand Down
5 changes: 4 additions & 1 deletion bin/workflows/pycbc_make_offline_search_workflow
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,9 @@ wf.setup_foreground_minifollowups(workflow, combined_bg_file,
tags=combined_bg_file.tags + ['background'])

# Sub-pages for each ifo combination
farstat = wf.make_farstat_plot(workflow, final_bg_files, rdir['background_triggers'],
require='summ',
tags=bg_file.tags + ['closed'])

snrifar_summ = []
for key in final_bg_files:
Expand All @@ -629,7 +632,7 @@ for key in final_bg_files:
tags=bg_file.tags + ['closed_box'])
closed_page = [(snrifar_cb, ifar_cb)]
else:
closed_page = [(snrifar_cb,)]
closed_page = [(snrifar_cb, farstat)]
if len(ifo_sets) > 1:
# If there is only one ifo_set, then this table has already been made
table = wf.make_foreground_table(workflow, bg_file, hdfbank, open_dir,
Expand Down
1 change: 1 addition & 0 deletions examples/search/executables.ini
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ single_template = ${which:pycbc_single_template}
plot_singles_timefreq = ${which:pycbc_plot_singles_timefreq}
plot_snrratehist = ${which:pycbc_page_snrratehist}
plot_waveform = ${which:pycbc_plot_waveform}
page_farstat = ${which:pycbc_page_fars_vs_stat}

[pegasus_profile]
condor|request_memory = 1000
Expand Down
6 changes: 6 additions & 0 deletions examples/search/plotting.ini
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,12 @@ decimation-factor = 100
[page_ifar-open_box]
open-box=

[page_farstat]
far-calculation-method = H1:trigger_fit L1:trigger_fit
limit-ifar = H1:1000 L1:1000
fit-function = H1:exponential L1:exponential
fit-threshold = H1:-1.2 L1:0

[page_vetotable]
[plot_bank]
log-x =
Expand Down
17 changes: 17 additions & 0 deletions pycbc/workflow/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,23 @@ def make_ifar_plot(workflow, trigger_file, out_dir, tags=None,
workflow += node
return node.output_files[0]

def make_farstat_plot(workflow, trigger_files, out_dir, tags=None,
hierarchical_level=None, require=None, executable='page_farstat'):
""" Creates a node in the workflow for plotting cumulative histogram
of IFAR vs stat values.
"""

makedir(out_dir)
opt = list(trigger_files.values())
ifo_combos = ' '.join(sorted(trigger_files.keys(), key=lambda x: (len(x), x)))
exe = PlotExecutable(workflow.cp, executable,
out_dir=out_dir, tags=tags)
node = exe.create_node()
node.add_multiifo_input_list_opt('--trigger-files', opt)
node.add_opt('--ifo-combos', ifo_combos)
node.new_output_file_opt(workflow.analysis_time, '.png', '--output-file')
workflow += node
return node.output_files[0]

def make_snrchi_plot(workflow, trig_files, veto_file, veto_name,
out_dir, exclude=None, require=None, tags=None):
Expand Down
Loading