aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2016-10-11 10:31:43 +0800
committerAaron LI <aaronly.me@outlook.com>2016-10-11 10:31:43 +0800
commita8ed62510538b02dd415e484cf9019d9a2549839 (patch)
tree3ef83c751e1694d944e0e104a53d89c29477ae16
parente252342e4fb0c106734e5659203d36985242bc7c (diff)
downloadfg21sim-a8ed62510538b02dd415e484cf9019d9a2549839.tar.bz2
Update bin/fg21sim to support Galactic free-free component
* bin/fg21sim: check the "common/components" config to simulate the enabled components; * bin/fg21sim: add Galactic free-free component support; * galactic/freefree.py: fix missing attributes. NOTE: simulated free-free maps are WRONG!! Need check/debug!
-rwxr-xr-xbin/fg21sim28
-rw-r--r--fg21sim/galactic/freefree.py4
2 files changed, 28 insertions, 4 deletions
diff --git a/bin/fg21sim b/bin/fg21sim
index 8098ac3..2b087a7 100755
--- a/bin/fg21sim
+++ b/bin/fg21sim
@@ -18,6 +18,7 @@ import numpy as np
from fg21sim.configs import configs, validate_configs
from fg21sim.utils import setup_logging
from fg21sim.galactic import Synchrotron as GalacticSynchrotron
+from fg21sim.galactic import FreeFree as GalacticFreeFree
def main():
@@ -57,10 +58,29 @@ def main():
min=frequencies.min(), max=frequencies.max(),
num=len(frequencies), unit=freq_unit))
- logger.info("Simulating the Galactic synchrotron foreground ...")
- gsynchrotron = GalacticSynchrotron(configs)
- map_gsync = gsynchrotron.simulate(frequencies)
- logger.info("Done simulate Galactic synchrotron foreground!")
+ # XXX/TODO: move the supported components and id's to a module/file
+ fg_components = configs.getn("common/components")
+ logger.info("Enabled simulation components: {0}".format(
+ ", ".join(fg_components)))
+ fg_maps = {}
+
+ # Galactic synchrotron
+ id_gsync = "galactic/synchrotron"
+ if id_gsync in fg_components:
+ logger.info("Simulating the Galactic synchrotron foreground ...")
+ gsynchrotron = GalacticSynchrotron(configs)
+ hpmap_gsync = gsynchrotron.simulate(frequencies)
+ logger.info("Done simulate Galactic synchrotron foreground!")
+ fg_maps[id_gsync] = hpmap_gsync
+
+ # Galactic free-free
+ id_gfree = "galactic/freefree"
+ if id_gfree in fg_components:
+ logger.info("Simulating the Galactic free-free foreground ...")
+ gfreefree = GalacticFreeFree(configs)
+ hpmap_gfree = gfreefree.simulate(frequencies)
+ logger.info("Done simulate Galactic free-free foreground!")
+ fg_maps[id_gfree] = hpmap_gfree
if __name__ == "__main__":
diff --git a/fg21sim/galactic/freefree.py b/fg21sim/galactic/freefree.py
index 9a51777..28a92d6 100644
--- a/fg21sim/galactic/freefree.py
+++ b/fg21sim/galactic/freefree.py
@@ -83,6 +83,10 @@ class FreeFree:
self.filename_pattern = self.configs.getn("output/filename_pattern")
self.use_float = self.configs.getn("output/use_float")
self.clobber = self.configs.getn("output/clobber")
+ #
+ self.nside = self.configs.getn("common/nside")
+ self.freq_unit = au.Unit(self.configs.getn("frequency/unit"))
+ #
logger.info("Loaded and set up configurations")
def _load_halphamap(self):