Skip to content

Commit

Permalink
Enforce pygrb_efficiency subsections (#4909)
Browse files Browse the repository at this point in the history
* Lower upper x limit

* Require one pygrb_efficiency subsection per injection set in the configuration file and insert back a line previously delete unintentionally

* Using sets to test whether each injection set has a pygrb_efficiency subsection in the configuration file
  • Loading branch information
pannarale authored Oct 18, 2024
1 parent 72e4224 commit 2c6c60d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions bin/pygrb/pycbc_pygrb_efficiency
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ if opts.background_output_file:
ax.legend()
ax.grid()
ax.set_ylim([0, 1])
ax.set_xlim(0, 2.*upper_dist - lower_dist)
ax.set_xlim(0, 1.3*upper_dist)
ax.set_ylabel("Fraction of injections found louder than loudest background")
ax.set_xlabel("Distance (Mpc)")
plot_title = "Detection efficiency - "+inj_set_name
Expand Down Expand Up @@ -655,13 +655,13 @@ if opts.onsource_output_file:
ax.get_legend().get_frame().set_alpha(0.5)
ax.grid()
ax.set_ylim([0, 1])
ax.set_xlim(0, 2.*upper_dist - lower_dist)
ax.set_xlim(0, 1.3*upper_dist)
ax.set_ylabel("Fraction of injections found louder than " +
"loudest foreground")
ax.set_xlabel("Distance (Mpc)")
ax.plot([excl_dist], [0.9], 'gx')
ax.set_ylim([0, 1])
ax.set_xlim(0, 2.*upper_dist - lower_dist)
ax.set_xlim(0, 1.3*upper_dist)
plot_title = "Exclusion distance - "+inj_set_name
plot_caption = "Injection recovery efficiency using "
plot_caption += "BestNR as detection statistic. "
Expand Down
10 changes: 9 additions & 1 deletion bin/pygrb/pycbc_pygrb_results_workflow
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,15 @@ logging.info("Offtrials: %s", [f.storage_path for f in offtrial_files])
bank_file = os.path.join(start_rundir, args.bank_file)
bank_file = _workflow.resolve_url_to_file(bank_file)

# File instances of the input injection files
# Sanity check and File instances of the input injection files
inj_sets = wflow.cp.get_subsections('injections')
eff_secs = wflow.cp.get_subsections('pygrb_efficiency')
if not set(inj_sets).issubset(eff_secs):
err_msg = "Each [injections] subsection requires at "
err_msg += "least one dedicated [pygrb_efficiency] subsection. "
err_msg += "[injections] subsections found: %s. "
err_msg += "[pygrb_efficiency] subsections found: %s. "
logging.error(err_msg, inj_sets, eff_secs)
inj_sets = [i.upper() for i in inj_sets]
inj_files = labels_in_files_metadata(inj_sets, start_rundir, args.inj_files)

Expand Down Expand Up @@ -532,6 +539,7 @@ for stat in stats:
out_dir,
trig_file=offsource_file,
inj_file=inj_file,
seg_files=seg_files,
tags=[stat],
)
plotting_nodes.append(plot_node)
Expand Down

0 comments on commit 2c6c60d

Please sign in to comment.