From a8ed62510538b02dd415e484cf9019d9a2549839 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Tue, 11 Oct 2016 10:31:43 +0800 Subject: 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! --- bin/fg21sim | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'bin/fg21sim') 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__": -- cgit v1.2.2