Skip to content
Snippets Groups Projects
Commit b8c5d4f9 authored by Leo Tsukada's avatar Leo Tsukada
Browse files

some clean up for dtdphi plumbing fix

parent 0f849a9e
No related branches found
No related tags found
No related merge requests found
Pipeline #679943 passed with warnings
......@@ -97,15 +97,15 @@ def svd_bin_to_dtdphi_file(config, svd_bin, stats_bin, aggregate="mean"):
"others" : lambda stats_bin: True
}
if isinstance(config.prior.dtdphi, Mapping):
if isinstance(config.prior.dtdphi_file, Mapping):
if "bank_name" in stats_bin:
sub_bank = stats_bin["bank_name"]
dtdphi_file = config.prior.dtdphi[sub_bank]
dtdphi_file = config.prior.dtdphi_file[sub_bank]
else:
assert all(category in category_condition for category in config.prior.dtdphi if category != "others"), "At least one of the categories set in config, [%s], is not defined in those in the source code, [%s]." % (",".join(config.prior.dtdphi.keys()), ",".join(category_condition.keys()))
dtdphi_files = {category: filename for category, filename in config.prior.dtdphi.items() if category_condition[category](stats_bin)}
assert all(category in category_condition for category in config.prior.dtdphi_file if category != "others"), "At least one of the categories set in config, [%s], is not defined in those in the source code, [%s]." % (",".join(config.prior.dtdphi_file.keys()), ",".join(category_condition.keys()))
dtdphi_files = {category: filename for category, filename in config.prior.dtdphi_file.items() if category_condition[category](stats_bin)}
if not len(dtdphi_files):
raise ValueError("SVD bin %s does not meet a condition of any category given in config.prior.dtdphi option.\
raise ValueError("SVD bin %s does not meet a condition of any category given in config.prior.dtdphi_file option.\
Add 'others' category explicitly and point that to the default dtdphi file to catch such bins." % (svd_bin,))
elif "others" in dtdphi_files:
# pick the default dtdphi file from 'others' category
......@@ -118,7 +118,7 @@ def svd_bin_to_dtdphi_file(config, svd_bin, stats_bin, aggregate="mean"):
dtdphi_file = [*dtdphi_files.values()][0]
assert "dtdphi_file" in locals(), "dtdphi_file is not defined even after the validation"
else:
dtdphi_file = config.prior.dtdphi
dtdphi_file = config.prior.dtdphi_file
return dtdphi_file
......@@ -169,7 +169,7 @@ for svd_bin, stats_bin in config.svd.stats.bins.items():
stats_bin["mass_model_file"] = config.prior.mass_model
if config.prior.idq_timeseries:
stats_bin["idq_file"] = config.prior.idq_timeseries
if config.prior.dtdphi:
if config.prior.dtdphi_file:
stats_bin["dtdphi_file"] = svd_bin_to_dtdphi_file(config, svd_bin, stats_bin)
if config.filter.reconstruction_segment:
# FIXME : find a more eleganway to find the files.
......
......@@ -178,7 +178,8 @@ unlock :
--stats-file $@ \
$<
{% endif %}
gstlal_inspiral_set_svdbin_option --config config.yml
# FIXME : add proper workflow in the command below
gstlal_inspiral_set_svdbin_option --config config.yml -w # ADDME
@echo ""
psd_inspiral_dag.dag : {{ config.filter.veto_segments_file }} {{ config.source.frame_segments_file }} {{ config.svd.option_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