aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2017-05-16 15:26:58 +0800
committerAaron LI <aaronly.me@outlook.com>2017-05-16 19:09:27 +0800
commit3c07a41448ddce396ffb98e105fca4ae5d6a74ee (patch)
tree5ccc6580492575b27826e8b79752819ae194a2ee /fg21sim
parent02d9b9bc2263d4eabee8a07bbf8c7606255fa761 (diff)
downloadfg21sim-3c07a41448ddce396ffb98e105fca4ae5d6a74ee.tar.bz2
configs: New "sky" section, and remove "common" section
* Update checkers accordingly
Diffstat (limited to 'fg21sim')
-rw-r--r--fg21sim/configs/00-general.conf.spec45
-rw-r--r--fg21sim/configs/10-galactic.conf.spec9
-rw-r--r--fg21sim/configs/checkers.py50
-rw-r--r--fg21sim/galactic/synchrotron.py4
4 files changed, 69 insertions, 39 deletions
diff --git a/fg21sim/configs/00-general.conf.spec b/fg21sim/configs/00-general.conf.spec
index aa2a29a..ba432c5 100644
--- a/fg21sim/configs/00-general.conf.spec
+++ b/fg21sim/configs/00-general.conf.spec
@@ -7,19 +7,6 @@
# behaviors, or will be used in other configuration sections.
-# Common/general configurations for the simulation
-[common]
-# HEALPix Nside value, i.e., pixel resolution
-# NOTE: also update "lmax" below.
-nside = integer(min=1, default=1024)
-
-# Range of multipole monents (l) of the angular power spectrum.
-# The power spectrum will be cut off to a constant for multipole l < lmin.
-# Generally, lmax = 3 * nside - 1
-lmin = integer(min=0, default=10)
-lmax = integer(min=1, default=3071)
-
-
# Foreground components to be simulated
[foregrounds]
# Diffuse Galactic synchrotron emission (unpolarized)
@@ -39,6 +26,38 @@ extragalactic/clusters = boolean(default=True)
extragalactic/pointsources = boolean(default=False)
+# Simulation sky/region configurations
+[sky]
+# Type of the input/output simulation sky
+# + patch:
+# Input sky template is only a (square) patch of the sky.
+# The simulated output maps have the same coverage/field as the
+# input template, as well as the coordinate projection.
+# + healpix:
+# Input sky template covers (almost) all sky, and stored in
+# HEALPix format. The simulated output maps will also be
+# all-sky using the HEALPix projection.
+type = option("patch", "healpix", default="patch")
+
+ # Configurations for input sky patch
+ [[patch]]
+ # The (R.A., Dec.) coordinate of the input patch center [ deg ]
+ xcenter = float(default=0.0, min=0.0, max=360.0)
+ ycenter = float(default=0.0, min=-90.0, max=90.0)
+
+ # The (pixel) dimensions of the input patch
+ xsize = integer(default=None, min=1)
+ ysize = integer(default=None, min=1)
+
+ # Pixel size [ arcmin ]
+ pixelsize = float(default=None, min=0.0)
+
+ # Configurations for input HEALPix sky
+ [[healpix]]
+ # HEALPix Nside value, i.e., pixel resolution
+ nside = integer(min=1, default=1024)
+
+
# Frequencies specification of the simulation products
[frequency]
# Unit of the frequency value
diff --git a/fg21sim/configs/10-galactic.conf.spec b/fg21sim/configs/10-galactic.conf.spec
index e565297..c01aed7 100644
--- a/fg21sim/configs/10-galactic.conf.spec
+++ b/fg21sim/configs/10-galactic.conf.spec
@@ -33,8 +33,15 @@
# Spectral index map
indexmap = string(default=None)
- # Whether add fluctuations on the small scales
+ # Whether add fluctuations on the small scales according the angular
+ # power spectrum prediction?
add_smallscales = boolean(default=True)
+ # Range of multipole moments (l) of the angular power spectrum.
+ # The power spectrum will be cut off to a constant for multipole l < lmin.
+ # NOTE: Update the ``lmax`` accordingly w.r.t. ``sky/healpix/nside``.
+ # Generally, lmax = 3 * nside - 1
+ lmin = integer(min=0, default=10)
+ lmax = integer(min=1, default=3071)
# Filename prefix for this component
prefix = string(default="gsync")
diff --git a/fg21sim/configs/checkers.py b/fg21sim/configs/checkers.py
index 74d61e3..ffb1e63 100644
--- a/fg21sim/configs/checkers.py
+++ b/fg21sim/configs/checkers.py
@@ -50,29 +50,32 @@ def _is_power2(n):
return (n and not (n & (n-1)))
-def check_common(configs):
- """Check the "[common]" section of the configurations."""
+def check_foregrounds(configs):
+ """Check the "[foregrounds]" section of the configurations."""
results = {}
- # "common/nside" must be a power of 2
- key = "common/nside"
- res = _check_missing(configs, key)
- if res == {}:
- if not _is_power2(configs.getn(key)):
- results[key] = "not a power of 2"
- else:
- results.update(res)
- # "common/lmax" must be greater than "common/lmin"
- key = "common/lmax"
- res = _check_missing(configs, [key, "common/lmin"])
- if res == {}:
- if configs.getn(key) <= configs.getn("common/lmin"):
- results[key] = "not greater than 'common/lmin'"
- else:
- results.update(res)
- # Check enabled components
- key = "common/components"
- if len(configs.getn(key)) == 0:
- results[key] = "no components enabled/selected"
+ # Check enabled foreground components
+ fg = configs.foregrounds
+ if len(fg[0]) == 0:
+ results["foregrounds"] = "no foreground components enabled"
+ return results
+
+
+def check_sky(configs):
+ """Check the "[sky]" section of the configurations."""
+ results = {}
+ skytype = configs.getn("sky/type")
+ if skytype == "patch":
+ sec = "sky/patch"
+ elif skytype == "healpix":
+ sec = "sky/healpix"
+ # "nside" must be a power of 2
+ key = sec + "/nside"
+ res = _check_missing(configs, key)
+ if res == {}:
+ if not _is_power2(configs.getn(key)):
+ results[key] = "not a power of 2"
+ else:
+ results.update(res)
return results
@@ -181,7 +184,8 @@ def check_extragalactic_clusters(configs):
# Available checkers to validate the configurations
_CHECKERS = [
- check_common,
+ check_foregrounds,
+ check_sky,
check_frequency,
check_output,
check_galactic_synchrotron,
diff --git a/fg21sim/galactic/synchrotron.py b/fg21sim/galactic/synchrotron.py
index 22949b2..09eefd6 100644
--- a/fg21sim/galactic/synchrotron.py
+++ b/fg21sim/galactic/synchrotron.py
@@ -55,6 +55,8 @@ class Synchrotron:
self.configs.getn(comp+"/template_unit"))
self.indexmap_path = self.configs.get_path(comp+"/indexmap")
self.smallscales = self.configs.getn(comp+"/add_smallscales")
+ self.lmin = self.configs.getn(comp+"/lmin")
+ self.lmax = self.configs.getn(comp+"/lmax")
self.prefix = self.configs.getn(comp+"/prefix")
self.save = self.configs.getn(comp+"/save")
self.output_dir = self.configs.get_path(comp+"/output_dir")
@@ -64,8 +66,6 @@ class Synchrotron:
self.checksum = self.configs.getn("output/checksum")
self.clobber = self.configs.getn("output/clobber")
self.nside = self.configs.getn("common/nside")
- self.lmin = self.configs.getn("common/lmin")
- self.lmax = self.configs.getn("common/lmax")
self.freq_unit = au.Unit(self.configs.getn("frequency/unit"))
#
logger.info("Loaded and setup configurations")