aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/configs/checkers.py
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2017-05-16 14:21:58 +0800
committerAaron LI <aaronly.me@outlook.com>2017-05-16 15:26:46 +0800
commit02d9b9bc2263d4eabee8a07bbf8c7606255fa761 (patch)
treec3f05984a124d16f8251b3b68131663b2aaf054a /fg21sim/configs/checkers.py
parentd19f16e0d5a2f753fbc323fa13c438327ff3e058 (diff)
downloadfg21sim-02d9b9bc2263d4eabee8a07bbf8c7606255fa761.tar.bz2
configs: Use separate section "foregrounds" to config components
Also update copyright information.
Diffstat (limited to 'fg21sim/configs/checkers.py')
-rw-r--r--fg21sim/configs/checkers.py41
1 files changed, 26 insertions, 15 deletions
diff --git a/fg21sim/configs/checkers.py b/fg21sim/configs/checkers.py
index 7bbcdd7..74d61e3 100644
--- a/fg21sim/configs/checkers.py
+++ b/fg21sim/configs/checkers.py
@@ -101,26 +101,37 @@ 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")
+ comp_enabled = configs.foregrounds[0]
+ if comp not in comp_enabled:
+ return {}
+
results = {}
- 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"))
+ # 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+"/add_smallscales"):
+ # "lmax" must be greater than "lmin"
+ key = comp + "/lmax"
+ res = _check_missing(configs, [key, comp+"/lmin"])
+ if res == {}:
+ if configs.getn(key) <= configs.getn(comp+"/lmin"):
+ results[key] = "not greater than 'lmin'"
+ else:
+ results.update(res)
+ 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")
+ comp_enabled = configs.foregrounds[0]
results = {}
if comp in comp_enabled:
# Only validate the configs if this component is enabled
@@ -139,7 +150,7 @@ def check_galactic_freefree(configs):
def check_galactic_snr(configs):
"""Check the "[galactic][snr]" section of the configurations."""
comp = "galactic/snr"
- comp_enabled = configs.getn("common/components")
+ comp_enabled = configs.foregrounds[0]
results = {}
if comp in comp_enabled:
# Only validate the configs if this component is enabled
@@ -156,7 +167,7 @@ def check_extragalactic_clusters(configs):
Check the "[extragalactic][clusters]" section of the configurations.
"""
comp = "extragalactic/clusters"
- comp_enabled = configs.getn("common/components")
+ comp_enabled = configs.foregrounds[0]
results = {}
if comp in comp_enabled:
# Only validate the configs if this component is enabled