Commit 2c37a696 authored by Cody Messick's avatar Cody Messick Committed by Chad Hanna

gstlal_inspiral_plot_background: added options --event-snr and

--event-chisq to plot an snr and chisq on the snr chisq plots
parent 24aedcd9
Pipeline #45549 failed with stages
in 9 minutes and 37 seconds
......@@ -136,6 +136,8 @@ def parse_command_line():
parser.add_option("--add-zerolag-to-background", action = "store_true", help = "Add zerolag events to background before populating coincident parameter PDF histograms.")
parser.add_option("--user-tag", metavar = "user-tag", default = "ALL", help = "Set the adjustable component of the description fields in the output filenames (default = \"ALL\").")
parser.add_option("--plot-snr-snr-pdfs", action = "store_true", help = "Plot the full cache of snr-snr-pdfs.")
parser.add_option("--event-snr", metavar = "ifo:snr", action = "append", help = "SNR to plot on snr chisq plots. Pass as ifo:snr, e.g. H1:3.2. Can be passed multiple times, though only once for each ifo. Must also pass --event-chisq for ifo.")
parser.add_option("--event-chisq", metavar = "ifo:chisq", action = "append", help = "chisq to plot on snr chisq plots. Pass as ifo:chisq, e.g. H1:1.1. Can be passed multiple times, though only once for each ifo. Must also pass --event-snr for ifo.")
parser.add_option("-v", "--verbose", action = "store_true", help = "Be verbose.")
options, filenames = parser.parse_args()
......@@ -153,6 +155,22 @@ def parse_command_line():
options.user_tag = options.user_tag.upper()
options.event_snr_dict = {}
options.event_chisq_dict = {}
if options.event_snr or options.event_chisq:
for ifo_snr_str in options.event_snr:
ifo, snr = ifo_snr_str.split(':')
options.event_snr_dict[ifo] = float(snr)
for ifo_chisq_str in options.event_chisq:
if ifo_chisq_str.split(':')[0] != ifo:
continue
options.event_chisq_dict[ifo] = float(ifo_chisq_str.split(':')[1])
for ifo in options.event_snr_dict.keys():
if ifo not in options.event_chisq_dict.keys():
print ifo
raise ValueError("Each ifo provided to --event-snr or --event-chisq must be provided to both options")
return options, filenames
......@@ -331,7 +349,10 @@ for bin_index, rankingstat in enumerate(sorted(rankingstats.values(), key = lamb
# SNR and \chi^2
for instrument in rankingstat.instruments:
for snr_chi_type in ("background_pdf", "injection_pdf", "zero_lag_pdf", "LR"):
fig = plotfar.plot_snr_chi_pdf(rankingstat, instrument, snr_chi_type, options.max_snr, sngls = sngls)
if instrument in options.event_snr_dict.keys():
fig = plotfar.plot_snr_chi_pdf(rankingstat, instrument, snr_chi_type, options.max_snr, sngls = sngls, event_snr = options.event_snr_dict[instrument], event_chisq = options.event_chisq_dict[instrument])
else:
fig = plotfar.plot_snr_chi_pdf(rankingstat, instrument, snr_chi_type, options.max_snr, sngls = sngls)
if fig is None:
continue
plotname = inspiral_pipe.T050017_filename(instrument, "GSTLAL_INSPIRAL_PLOT_BACKGROUND_%s_%04d_%s_SNRCHI2" % (options.user_tag, bin_index, snr_chi_type.upper()), seg, options.output_format, path = options.output_dir)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment