aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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):