Skip to content
Snippets Groups Projects
Commit e50cd632 authored by Patrick Godwin's avatar Patrick Godwin
Browse files

gstlal_inspiral_bank_splitter: standardize split bank filenames

parent 4053f941
No related branches found
No related tags found
1 merge request!41DAG Workflow Overhaul + OSG DAG support
......@@ -248,7 +248,7 @@ for bank_count, (_, rows) in enumerate(outputrows, start=split_bin_start):
row.mtotal = row.mass1 + row.mass2
sngl_inspiral_table[:] = rows
output = datafind.T050017_filename(options.instrument, "%04d_GSTLAL_SPLIT_BANK" % bank_count, (0, 0), ".xml.gz", path = options.output_path)
output = datafind.T050017_filename(options.instrument, f"GSTLAL_SPLIT_BANK_{bank_count:04d}", (0, 0), ".xml.gz", path = options.output_path)
metadata[output] = rows
svd_dirs.append(output)
ligolw_utils.write_filename(xmldoc, output, verbose = options.verbose)
......@@ -258,27 +258,22 @@ if options.bank_name:
svd_groups = list(svd_bank.group(svd_dirs, options.num_banks))
for n, svd in enumerate(svd_groups, start=svd_bin_start):
outdir = os.path.join(options.output_path, "%04d" % n)
try:
os.mkdir(outdir)
except OSError:
# svd directory already exists
pass
svd_mchirps = []
svd_durs = []
svd_bw = []
ref_hd = []
clipleft = options.overlap // 2
clipright = options.overlap // 2
for m, split_file in enumerate(svd):
for m, split_file in enumerate(svd, start=split_bin_start):
svd_mchirps.extend([r.mchirp for r in metadata[split_file][clipleft:-clipright]])
svd_durs.extend([r.template_duration for r in metadata[split_file][clipleft:-clipright]])
svd_bw.extend([r.bandwidth for r in metadata[split_file][clipleft:-clipright]])
outfile = os.path.join(outdir, os.path.split(split_file)[1])
outfile = datafind.T050017_filename(options.instrument, f"{n:04d}_GSTLAL_SPLIT_BANK_{m:04d}", (0, 0), ".xml.gz", path = options.output_path)
shutil.move(split_file, outfile)
xmldoc = ligolw_utils.load_url(outfile, contenthandler = LIGOLWContentHandler, verbose = options.verbose)
process = ligolw_process.register_to_xmldoc(xmldoc, program = "gstlal_inspiral_bank_splitter", paramdict = {"clipleft": clipleft, "clipright": clipright, "bank-id": "%d_%d" % (n,m)}, comment = "Add some extra metadata for the SVD")
ligolw_utils.write_filename(xmldoc, outfile, verbose = options.verbose)
split_bin_start += len(svd)
# some gymnastics to get the fiducial horizon template in the LR calculation
rows = metadata[svd[0]][clipleft:-clipright]
......
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