aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2016-10-12 12:42:09 +0800
committerAaron LI <aaronly.me@outlook.com>2016-10-12 12:42:09 +0800
commitfd85a3ecaa2fc0b684d6dbd00c803c9b1ca75349 (patch)
tree1648233a888dedbdbb2317f8828f16fea6e9bcf8
parentc55782255310a9f716d00612f9ae2a44db3f2b5b (diff)
downloadfg21sim-fd85a3ecaa2fc0b684d6dbd00c803c9b1ca75349.tar.bz2
configs/validate.py: Check component configs only if enabled
-rw-r--r--fg21sim/configs/validate.py48
1 files changed, 26 insertions, 22 deletions
diff --git a/fg21sim/configs/validate.py b/fg21sim/configs/validate.py
index f12bac1..aaf7fd1 100644
--- a/fg21sim/configs/validate.py
+++ b/fg21sim/configs/validate.py
@@ -67,35 +67,39 @@ def check_output(configs):
def check_galactic_synchrotron(configs):
"""Check the "[galactic][synchrotron]" section of the configurations."""
+ comp = "galactic/synchrotron"
+ comp_enabled = configs.getn("common/components")
results = {}
- results.update(
- _check_missing(configs, ["galactic/synchrotron/template_freq",
- "galactic/synchrotron/template_unit"])
- )
- results.update(
- _check_existence(configs, ["galactic/synchrotron/template",
- "galactic/synchrotron/indexmap"])
- )
- if configs.getn("galactic/synchrotron/save"):
- results.update(_check_missing(configs,
- "galactic/synchrotron/output_dir"))
+ if comp in comp_enabled:
+ # Only validate the configs if this component is enabled
+ results.update(
+ _check_missing(configs, [comp+"/template_freq",
+ comp+"/template_unit"])
+ )
+ results.update(
+ _check_existence(configs, [comp+"/template", comp+"/indexmap"])
+ )
+ if configs.getn(comp+"/save"):
+ results.update(_check_missing(configs, comp+"/output_dir"))
return results
def check_galactic_freefree(configs):
"""Check the "[galactic][freefree]" section of the configurations."""
+ comp = "galactic/freefree"
+ comp_enabled = configs.getn("common/components")
results = {}
- results.update(
- _check_missing(configs, ["galactic/freefree/halphamap_unit",
- "galactic/freefree/dustmap_unit"])
- )
- results.update(
- _check_existence(configs, ["galactic/freefree/halphamap",
- "galactic/freefree/dustmap"])
- )
- if configs.getn("galactic/freefree/save"):
- results.update(_check_missing(configs,
- "galactic/freefree/output_dir"))
+ if comp in comp_enabled:
+ # Only validate the configs if this component is enabled
+ results.update(
+ _check_missing(configs, [comp+"/halphamap_unit",
+ comp+"/dustmap_unit"])
+ )
+ results.update(
+ _check_existence(configs, [comp+"/halphamap", comp+"/dustmap"])
+ )
+ if configs.getn(comp+"/save"):
+ results.update(_check_missing(configs, comp+"/output_dir"))
return results