diff options
Diffstat (limited to 'fg21sim')
| -rw-r--r-- | fg21sim/configs/00-general.conf.spec | 45 | ||||
| -rw-r--r-- | fg21sim/configs/10-galactic.conf.spec | 9 | ||||
| -rw-r--r-- | fg21sim/configs/checkers.py | 50 | ||||
| -rw-r--r-- | fg21sim/galactic/synchrotron.py | 4 | 
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")  | 
