From 38ab63fc5191a4893f6f46d9b8b40ae988f66c88 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Mon, 31 Jul 2017 19:48:43 +0800 Subject: Add `fg21sim.share` module to hold globally shared "CONFIGS" & "COSMO" Signed-off-by: Aaron LI --- bin/fg21sim | 4 ++-- bin/fg21sim-download-cluster-data | 2 +- bin/fg21sim-download-data | 2 +- bin/fg21sim-download-snr-data | 2 +- bin/fg21sim-webui | 2 +- bin/get-healpix-patch | 2 +- bin/healpix2hpx | 2 +- bin/hpx2healpix | 2 +- bin/make-ska1low-model | 2 +- bin/zea2healpix | 2 +- fg21sim/configs/__init__.py | 2 -- fg21sim/extragalactic/clusters/formation.py | 2 +- fg21sim/extragalactic/clusters/halo.py | 3 +-- fg21sim/extragalactic/clusters/helper.py | 3 +-- fg21sim/extragalactic/clusters/main.py | 3 +-- fg21sim/utils/__init__.py | 2 -- fg21sim/utils/cosmology.py | 2 +- 17 files changed, 16 insertions(+), 23 deletions(-) diff --git a/bin/fg21sim b/bin/fg21sim index c80e5ca..1f3e434 100755 --- a/bin/fg21sim +++ b/bin/fg21sim @@ -14,8 +14,8 @@ import argparse import logging import time -from fg21sim.configs import CONFIGS -from fg21sim.utils import setup_logging, COSMO +from fg21sim.share import CONFIGS, COSMO +from fg21sim.utils import setup_logging def main(): diff --git a/bin/fg21sim-download-cluster-data b/bin/fg21sim-download-cluster-data index ed49f5a..c1aafc5 100755 --- a/bin/fg21sim-download-cluster-data +++ b/bin/fg21sim-download-cluster-data @@ -65,7 +65,7 @@ import csv import urllib.request import tarfile -from fg21sim.configs import CONFIGS +from fg21sim.share import CONFIGS from fg21sim.utils import setup_logging diff --git a/bin/fg21sim-download-data b/bin/fg21sim-download-data index d1fdf8a..67dbd33 100755 --- a/bin/fg21sim-download-data +++ b/bin/fg21sim-download-data @@ -13,7 +13,7 @@ import argparse import logging import json -from fg21sim.configs import CONFIGS +from fg21sim.share import CONFIGS from fg21sim.utils import setup_logging from fg21sim.utils.download import download_file diff --git a/bin/fg21sim-download-snr-data b/bin/fg21sim-download-snr-data index a6ace8c..bf2b33d 100755 --- a/bin/fg21sim-download-snr-data +++ b/bin/fg21sim-download-snr-data @@ -19,7 +19,7 @@ import argparse import logging import csv -from fg21sim.configs import CONFIGS +from fg21sim.share import CONFIGS from fg21sim.utils import setup_logging from fg21sim.data import retrieve_snr_data_green, SNRDataGreen diff --git a/bin/fg21sim-webui b/bin/fg21sim-webui index 9db0be0..f0a9527 100755 --- a/bin/fg21sim-webui +++ b/bin/fg21sim-webui @@ -23,7 +23,7 @@ import webbrowser import tornado.ioloop from tornado.options import define, options, parse_command_line -from fg21sim.configs import CONFIGS +from fg21sim.share import CONFIGS from fg21sim.utils import setup_logging from fg21sim.webui import Application diff --git a/bin/get-healpix-patch b/bin/get-healpix-patch index 078128e..b1245e8 100755 --- a/bin/get-healpix-patch +++ b/bin/get-healpix-patch @@ -18,7 +18,7 @@ import scipy.ndimage import healpy as hp from reproject import reproject_from_healpix -from fg21sim.configs import CONFIGS +from fg21sim.share import CONFIGS from fg21sim.sky import SkyPatch from fg21sim.utils import setup_logging from fg21sim.utils.fits import read_fits_healpix diff --git a/bin/healpix2hpx b/bin/healpix2hpx index 63770e9..5f8e294 100755 --- a/bin/healpix2hpx +++ b/bin/healpix2hpx @@ -15,7 +15,7 @@ import argparse import logging import fg21sim -from fg21sim.configs import CONFIGS +from fg21sim.share import CONFIGS from fg21sim.utils import setup_logging diff --git a/bin/hpx2healpix b/bin/hpx2healpix index 2c09057..b5de5e6 100755 --- a/bin/hpx2healpix +++ b/bin/hpx2healpix @@ -15,7 +15,7 @@ import argparse import logging import fg21sim -from fg21sim.configs import CONFIGS +from fg21sim.share import CONFIGS from fg21sim.utils import setup_logging diff --git a/bin/make-ska1low-model b/bin/make-ska1low-model index 8ae69dc..df88d27 100755 --- a/bin/make-ska1low-model +++ b/bin/make-ska1low-model @@ -18,7 +18,7 @@ import logging from pkg_resources import resource_exists, resource_filename -from fg21sim.configs import CONFIGS +from fg21sim.share import CONFIGS from fg21sim.utils import setup_logging from fg21sim.uvsim import telescope diff --git a/bin/zea2healpix b/bin/zea2healpix index 827615d..4e3242b 100755 --- a/bin/zea2healpix +++ b/bin/zea2healpix @@ -22,7 +22,7 @@ import argparse import logging import fg21sim -from fg21sim.configs import CONFIGS +from fg21sim.share import CONFIGS from fg21sim.utils import setup_logging diff --git a/fg21sim/configs/__init__.py b/fg21sim/configs/__init__.py index 7670c90..d06c12b 100644 --- a/fg21sim/configs/__init__.py +++ b/fg21sim/configs/__init__.py @@ -3,5 +3,3 @@ from .manager import ConfigManager from .checkers import check_configs - -CONFIGS = ConfigManager() diff --git a/fg21sim/extragalactic/clusters/formation.py b/fg21sim/extragalactic/clusters/formation.py index a9c9acc..dc41e00 100644 --- a/fg21sim/extragalactic/clusters/formation.py +++ b/fg21sim/extragalactic/clusters/formation.py @@ -24,7 +24,7 @@ import scipy.special import scipy.optimize from .mergertree import MergerTree -from ...utils import COSMO +from ...share import COSMO logger = logging.getLogger(__name__) diff --git a/fg21sim/extragalactic/clusters/halo.py b/fg21sim/extragalactic/clusters/halo.py index 7230a81..333da4e 100644 --- a/fg21sim/extragalactic/clusters/halo.py +++ b/fg21sim/extragalactic/clusters/halo.py @@ -45,8 +45,7 @@ import numpy as np from . import helper from .solver import FokkerPlanckSolver from .emission import SynchrotronEmission -from ...configs import CONFIGS -from ...utils import COSMO +from ...share import CONFIGS, COSMO from ...utils.units import (Units as AU, UnitConversions as AUC) from ...utils.convert import Fnu_to_Tb_fast diff --git a/fg21sim/extragalactic/clusters/helper.py b/fg21sim/extragalactic/clusters/helper.py index 1367374..0d66dee 100644 --- a/fg21sim/extragalactic/clusters/helper.py +++ b/fg21sim/extragalactic/clusters/helper.py @@ -31,8 +31,7 @@ References import numpy as np from scipy import integrate -from ...configs import CONFIGS -from ...utils import COSMO +from ...share import CONFIGS, COSMO from ...utils.units import (Units as AU, Constants as AC, UnitConversions as AUC) diff --git a/fg21sim/extragalactic/clusters/main.py b/fg21sim/extragalactic/clusters/main.py index a280bb9..c3e4068 100644 --- a/fg21sim/extragalactic/clusters/main.py +++ b/fg21sim/extragalactic/clusters/main.py @@ -24,8 +24,7 @@ import pandas as pd from .formation import ClusterFormation from .halo import RadioHalo -from ...configs import CONFIGS -from ...utils import COSMO +from ...share import CONFIGS, COSMO from ...utils.io import dataframe_to_csv from ...sky import get_sky diff --git a/fg21sim/utils/__init__.py b/fg21sim/utils/__init__.py index 5b61027..2f9f57f 100644 --- a/fg21sim/utils/__init__.py +++ b/fg21sim/utils/__init__.py @@ -3,5 +3,3 @@ from .logging import setup_logging from .cosmology import Cosmology - -COSMO = Cosmology() diff --git a/fg21sim/utils/cosmology.py b/fg21sim/utils/cosmology.py index 23a5e1f..dc5f126 100644 --- a/fg21sim/utils/cosmology.py +++ b/fg21sim/utils/cosmology.py @@ -40,7 +40,7 @@ import numpy as np from scipy import integrate from astropy.cosmology import FlatLambdaCDM -from ..configs import CONFIGS +from ..share import CONFIGS from .units import (UnitConversions as AUC, Constants as AC) -- cgit v1.2.2