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

python/config/inspiral.py : add write I/O function for manifest file

gstlal/python/config/__init__.py : add reverse argument for write I/O function of svd manifest file
parent a9d43502
No related branches found
No related tags found
1 merge request!481python/dags/layers/inspiral.py : move functions and some parts to...
......@@ -125,3 +125,7 @@ class Config(BaseConfig):
# define svd bins, metadata
self.svd.bins = svd_stats.bins.keys()
self.svd.stats = svd_stats
def write_svd_manifest(self, output_file):
with open(output_file, "w") as f:
f.write(json.dumps(replace_keys(self.svd.stats, reverse=True), sort_keys = True, indent = 4))
......@@ -242,9 +242,9 @@ class dotdict(dict):
self[k] = dotdict(v)
def replace_keys(dict_):
def replace_keys(dict_, reverse=False):
out = dict(dict_)
for k, v in out.items():
if isinstance(v, dict):
out[k] = replace_keys(v)
return {k.replace("-", "_"): v for k, v in out.items()}
return {k.replace("_", "-") if reverse else k.replace("-", "_") : v for k, v in out.items()}
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