Skip to content
Snippets Groups Projects
Commit e1e68fd4 authored by Prathamesh Joshi's avatar Prathamesh Joshi
Browse files

Save the prior dist_stats created during the online setup dag to the backup dir

parent 999832e1
No related branches found
No related tags found
No related merge requests found
Pipeline #598066 passed
......@@ -75,7 +75,7 @@ def parse_command_line():
parser.add_option("--coincidence-threshold", metavar = "value", type = "float", default = 0.005, help = "Set the coincidence window in seconds (default = 0.005). The light-travel time between instruments will be added automatically in the coincidence test.")
# FIXME: default must be identical to gstlal_inspiral's default
parser.add_option("--min-instruments", metavar = "count", type = "int", default = 2, help = "Set the minimum number of instruments that must contribute triggers to form a candidate (default = 2).")
parser.add_option("--write-likelihood", metavar = "filename", help = "Write merged raw likelihood data to this file.")
parser.add_option("--write-likelihood", metavar = "filename", action = "append", help = "Write merged raw likelihood data to this file.")
parser.add_option("--instrument", action = "append", help = "Append to a list of instruments to create dist stats for. List must be whatever instruments you intend to analyze.")
parser.add_option("-p", "--background-prior", metavar = "N", default = 1, type = "float", help = "Include an exponential background prior with the maximum bin count = N, default 1")
parser.add_option("--df", metavar = "N", default = 40, help = "set the degrees of freedom for the background chisq prior: default 40. You can also use template bandwidth to set this by setting it to 'bandwidth' or the values analytically derived from auto-correlations by setting it to 'analytic'.")
......@@ -250,4 +250,5 @@ if options.write_empty_rankingstatpdf:
process.set_end_time_now()
ligolw_utils.write_filename(xmldoc, options.write_likelihood, verbose = options.verbose)
for filename in options.write_likelihood:
ligolw_utils.write_filename(xmldoc, filename, verbose = options.verbose)
......@@ -29,7 +29,7 @@ from lal.utils import CacheEntry
from ligo.segments import segment
from gstlal import plugins
from gstlal.datafind import DataType, DataCache
from gstlal.datafind import DataType, DataCache, DEFAULT_BACKUP_DIR
from gstlal.dags import Argument, Option
from gstlal.dags import util as dagutil
from gstlal.dags.layers import Layer, Node
......@@ -513,7 +513,11 @@ def create_prior_layer(config, dag, svd_bank_cache, median_psd_cache, dist_stat_
svd_bins=config.svd.bins,
root="rank",
)
backup_cache = None
else:
# assume online operation; create a DIST_STATS cache
# and a PRIOR_DIST_STATS in the backup dir
prior_cache = DataCache.generate(
DataType.DIST_STATS,
config.all_ifos,
......@@ -521,6 +525,18 @@ def create_prior_layer(config, dag, svd_bank_cache, median_psd_cache, dist_stat_
svd_bins=config.svd.bins,
)
backup_cache = DataCache.generate(
DataType.PRIOR_DIST_STATS,
config.all_ifos,
config.span,
svd_bins=config.svd.bins,
root=DEFAULT_BACKUP_DIR,
)
backup_dir = os.path.dirname(backup_cache.files[0])
if not os.path.exists(backup_dir):
os.makedirs(backup_dir)
backup_cache = backup_cache.groupby("bin")
svd_banks = svd_bank_cache.groupby("bin")
arguments = [
Option("df", prior_df),
......@@ -539,7 +555,10 @@ def create_prior_layer(config, dag, svd_bank_cache, median_psd_cache, dist_stat_
if prior_df == "bandwidth":
inputs += [Option("psd-xml", median_psd_cache.files)]
outputs = [Option("write-likelihood", prior.files)]
output_filenames = prior.files
if backup_cache:
output_filenames += backup_cache[svd_bin].files
outputs = [Option("write-likelihood", output_filenames)]
if write_empty_rankingstatpdf:
if i == 0:
# create an empty rankingstatpdf using the first svd bin's prior file
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment