aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-07-23 09:38:27 +0800
committerAaron LI <aly@aaronly.me>2017-07-23 09:38:27 +0800
commite9c6dbe6d3dafff46ae2b065ff11b9f9a5a28741 (patch)
tree00088464985a55975bd931b32110fb42676e79cb /bin
parent4476a0ca0e22d6a35bb07da87956d21ec7c49074 (diff)
downloadfg21sim-e9c6dbe6d3dafff46ae2b065ff11b9f9a5a28741.tar.bz2
Update bin scripts to use global "CONFIGS"
Also update copyright year/email and minor cleanups Signed-off-by: Aaron LI <aly@aaronly.me>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/fg21sim-download-cluster-data15
-rwxr-xr-xbin/fg21sim-download-data6
-rwxr-xr-xbin/fg21sim-download-snr-data15
-rwxr-xr-xbin/fg21sim-webui6
-rwxr-xr-xbin/get-healpix-patch16
-rwxr-xr-xbin/healpix2hpx13
-rwxr-xr-xbin/hpx2healpix13
-rwxr-xr-xbin/make-ska1low-model5
-rwxr-xr-xbin/zea2healpix13
9 files changed, 42 insertions, 60 deletions
diff --git a/bin/fg21sim-download-cluster-data b/bin/fg21sim-download-cluster-data
index a3708fd..ed49f5a 100755
--- a/bin/fg21sim-download-cluster-data
+++ b/bin/fg21sim-download-cluster-data
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (c) 2016 Weitian LI <liweitianux@live.com>
+# Copyright (c) 2016-2017 Weitian LI <weitian@aaronly.me>
# MIT license
"""
@@ -65,7 +65,7 @@ import csv
import urllib.request
import tarfile
-from fg21sim.configs import configs
+from fg21sim.configs import CONFIGS
from fg21sim.utils import setup_logging
@@ -96,17 +96,12 @@ def main():
help="be quiet so do not log messages to screen")
args = parser.parse_args()
- if args.quiet:
- log_stream = ""
- else:
- log_stream = None
-
- tool = os.path.basename(sys.argv[0])
-
- setup_logging(dict_config=configs.logging,
+ log_stream = "" if args.quiet else None
+ setup_logging(dict_config=CONFIGS.logging,
level=args.loglevel,
stream=log_stream,
logfile=args.logfile)
+ tool = os.path.basename(sys.argv[0])
logger = logging.getLogger(tool)
logger.info("COMMAND: {0}".format(" ".join(sys.argv)))
diff --git a/bin/fg21sim-download-data b/bin/fg21sim-download-data
index d4d03b4..d1fdf8a 100755
--- a/bin/fg21sim-download-data
+++ b/bin/fg21sim-download-data
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (c) 2016 Weitian LI <liweitianux@live.com>
+# Copyright (c) 2016-2017 Weitian LI <weitian@aaronly.me>
# MIT license
"""
@@ -13,7 +13,7 @@ import argparse
import logging
import json
-from fg21sim.configs import configs
+from fg21sim.configs import CONFIGS
from fg21sim.utils import setup_logging
from fg21sim.utils.download import download_file
@@ -30,7 +30,7 @@ def main():
args = parser.parse_args()
tool = os.path.basename(sys.argv[0])
- setup_logging(dict_config=configs.logging)
+ setup_logging(dict_config=CONFIGS.logging)
logger = logging.getLogger(tool)
logger.info("COMMAND: {0}".format(" ".join(sys.argv)))
diff --git a/bin/fg21sim-download-snr-data b/bin/fg21sim-download-snr-data
index b88ab10..a6ace8c 100755
--- a/bin/fg21sim-download-snr-data
+++ b/bin/fg21sim-download-snr-data
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (c) 2016 Weitian LI <liweitianux@live.com>
+# Copyright (c) 2016-2017 Weitian LI <weitian@aaronly.me>
# MIT license
"""
@@ -19,7 +19,7 @@ import argparse
import logging
import csv
-from fg21sim.configs import configs
+from fg21sim.configs import CONFIGS
from fg21sim.utils import setup_logging
from fg21sim.data import retrieve_snr_data_green, SNRDataGreen
@@ -51,17 +51,12 @@ def main():
help="be quiet so do not log messages to screen")
args = parser.parse_args()
- if args.quiet:
- log_stream = ""
- else:
- log_stream = None
-
- tool = os.path.basename(sys.argv[0])
-
- setup_logging(dict_config=configs.logging,
+ log_stream = "" if args.quiet else None
+ setup_logging(dict_config=CONFIGS.logging,
level=args.loglevel,
stream=log_stream,
logfile=args.logfile)
+ tool = os.path.basename(sys.argv[0])
logger = logging.getLogger(tool)
logger.info("COMMAND: {0}".format(" ".join(sys.argv)))
diff --git a/bin/fg21sim-webui b/bin/fg21sim-webui
index 364b8fb..9db0be0 100755
--- a/bin/fg21sim-webui
+++ b/bin/fg21sim-webui
@@ -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
"""
@@ -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.configs import CONFIGS
from fg21sim.utils import setup_logging
from fg21sim.webui import Application
@@ -48,7 +48,7 @@ def main():
options.host = "0.0.0.0"
loglevel = "DEBUG" if options.debug else None
- setup_logging(dict_config=configs.logging, level=loglevel)
+ setup_logging(dict_config=CONFIGS.logging, level=loglevel)
tool = os.path.basename(sys.argv[0])
logger = logging.getLogger(tool)
logger.info("COMMAND: {0}".format(" ".join(sys.argv)))
diff --git a/bin/get-healpix-patch b/bin/get-healpix-patch
index 0dc27f6..078128e 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.configs import CONFIGS
from fg21sim.sky import SkyPatch
from fg21sim.utils import setup_logging
from fg21sim.utils.fits import read_fits_healpix
@@ -49,18 +49,18 @@ def main():
parser.add_argument("outfile", help="output extracted sky patch")
args = parser.parse_args()
- setup_logging(dict_config=configs.logging)
+ setup_logging(dict_config=CONFIGS.logging)
tool = os.path.basename(sys.argv[0])
logger = logging.getLogger(tool)
logger.info("COMMAND: {0}".format(" ".join(sys.argv)))
if args.config:
- configs.read_userconfig(args.config)
- center = (configs.getn("sky/patch/xcenter"),
- configs.getn("sky/patch/ycenter")) # [ deg ]
- size = (configs.getn("sky/patch/xsize"),
- configs.getn("sky/patch/ysize"))
- pixelsize = configs.getn("sky/patch/pixelsize") # [ arcsec ]
+ CONFIGS.read_userconfig(args.config)
+ center = (CONFIGS.getn("sky/patch/xcenter"),
+ CONFIGS.getn("sky/patch/ycenter")) # [ deg ]
+ size = (CONFIGS.getn("sky/patch/xsize"),
+ CONFIGS.getn("sky/patch/ysize"))
+ pixelsize = CONFIGS.getn("sky/patch/pixelsize") # [ arcsec ]
elif not all([args.center, args.size, args.pixelsize]):
raise ValueError("--center, --size, and --pixelsize are " +
"required when --config is missing!")
diff --git a/bin/healpix2hpx b/bin/healpix2hpx
index ed4b66e..63770e9 100755
--- a/bin/healpix2hpx
+++ b/bin/healpix2hpx
@@ -1,6 +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
"""
@@ -14,7 +15,7 @@ import argparse
import logging
import fg21sim
-from fg21sim.configs import configs
+from fg21sim.configs import CONFIGS
from fg21sim.utils import setup_logging
@@ -35,15 +36,11 @@ def main():
help="be quiet so do not log messages to screen")
args = parser.parse_args()
- if args.quiet:
- log_stream = ""
- else:
- log_stream = None
-
tool = os.path.basename(sys.argv[0])
pkgname = fg21sim.__pkgname__
- setup_logging(dict_config=configs.logging,
+ log_stream = "" if args.quiet else None
+ setup_logging(dict_config=CONFIGS.logging,
level=args.loglevel,
stream=log_stream,
logfile=args.logfile)
diff --git a/bin/hpx2healpix b/bin/hpx2healpix
index e5460c8..2c09057 100755
--- a/bin/hpx2healpix
+++ b/bin/hpx2healpix
@@ -1,6 +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
"""
@@ -14,7 +15,7 @@ import argparse
import logging
import fg21sim
-from fg21sim.configs import configs
+from fg21sim.configs import CONFIGS
from fg21sim.utils import setup_logging
@@ -35,15 +36,11 @@ def main():
help="be quiet so do not log messages to screen")
args = parser.parse_args()
- if args.quiet:
- log_stream = ""
- else:
- log_stream = None
-
tool = os.path.basename(sys.argv[0])
pkgname = fg21sim.__pkgname__
- setup_logging(dict_config=configs.logging,
+ log_stream = "" if args.quiet else None
+ setup_logging(dict_config=CONFIGS.logging,
level=args.loglevel,
stream=log_stream,
logfile=args.logfile)
diff --git a/bin/make-ska1low-model b/bin/make-ska1low-model
index 641d5a2..8ae69dc 100755
--- a/bin/make-ska1low-model
+++ b/bin/make-ska1low-model
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
+# -*- mode: python -*-
#
# Copyright (c) 2017 Weitian LI <weitian@aaronly.me>
# MIT license
@@ -17,7 +18,7 @@ import logging
from pkg_resources import resource_exists, resource_filename
-from fg21sim.configs import configs
+from fg21sim.configs import CONFIGS
from fg21sim.utils import setup_logging
from fg21sim.uvsim import telescope
@@ -52,7 +53,7 @@ def main():
args = parser.parse_args()
loglevel = "DEBUG" if args.debug else "INFO"
- setup_logging(dict_config=configs.logging, level=loglevel)
+ setup_logging(dict_config=CONFIGS.logging, level=loglevel)
tool = os.path.basename(sys.argv[0])
logger = logging.getLogger(tool)
logger.info("COMMAND: {0}".format(" ".join(sys.argv)))
diff --git a/bin/zea2healpix b/bin/zea2healpix
index 4eb25a9..827615d 100755
--- a/bin/zea2healpix
+++ b/bin/zea2healpix
@@ -1,6 +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
"""
@@ -21,7 +22,7 @@ import argparse
import logging
import fg21sim
-from fg21sim.configs import configs
+from fg21sim.configs import CONFIGS
from fg21sim.utils import setup_logging
@@ -51,15 +52,11 @@ def main():
help="be quiet so do not log messages to screen")
args = parser.parse_args()
- if args.quiet:
- log_stream = ""
- else:
- log_stream = None
-
tool = os.path.basename(sys.argv[0])
pkgname = fg21sim.__pkgname__
- setup_logging(dict_config=configs.logging,
+ log_stream = "" if args.quiet else None
+ setup_logging(dict_config=CONFIGS.logging,
level=args.loglevel,
stream=log_stream,
logfile=args.logfile)