diff options
| -rwxr-xr-x | bin/fg21sim | 11 | ||||
| -rw-r--r-- | fg21sim/utils/cosmology.py | 2 | 
2 files changed, 9 insertions, 4 deletions
| diff --git a/bin/fg21sim b/bin/fg21sim index 0e58551..c25aef3 100755 --- a/bin/fg21sim +++ b/bin/fg21sim @@ -1,7 +1,7 @@  #!/usr/bin/env python3  # -*- mode: python -*-  # -# Copyright (c) 2016 Weitian LI <liweitianux@live.com> +# Copyright (c) 2016-2017 Weitian LI <weitian@aaronly.me>  # MIT license  """ @@ -15,12 +15,13 @@ import logging  import time  from fg21sim.configs import configs -from fg21sim.utils import setup_logging +from fg21sim.utils import setup_logging, cosmo  def main():      parser = argparse.ArgumentParser( -        description="Simulate the radio foregrounds for 21cm EoR signal") +        description="Simulate the radio foregrounds for 21cm EoR signal", +        epilog="Set environment variable 'DEBUG_FG21SIM=1' to force debug!")      parser.add_argument("config", help="user configuration file")      parser.add_argument("-l", "--log", dest="loglevel", default=None,                          choices=["DEBUG", "INFO", "WARNING", @@ -55,6 +56,10 @@ def main():      configs.save(configfile_dump, clobber=True, backup=True)      logger.info("Saved current configurations to file: %s" % configfile_dump) +    # Setup cosmology model +    logger.info("Setup cosmology model with parameters from configs ...") +    cosmo.setup(**configs.cosmology) +      logger.info("Importing modules + Numba JIT, waiting ...")      from fg21sim.foregrounds import Foregrounds      fg = Foregrounds(configs) diff --git a/fg21sim/utils/cosmology.py b/fg21sim/utils/cosmology.py index 3a4d5fd..fd9f1ff 100644 --- a/fg21sim/utils/cosmology.py +++ b/fg21sim/utils/cosmology.py @@ -65,7 +65,7 @@ class Cosmology:          """          Setup/update the parameters of the cosmology model.          """ -        for key, value in kwargs: +        for key, value in kwargs.items():              if key in ["H0", "Om0", "Ob0", "sigma8"]:                  setattr(self, key, value)              else: | 
