diff options
author | Aaron LI <aly@aaronly.me> | 2017-08-26 21:01:58 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2017-08-26 21:07:09 +0800 |
commit | c8e62dd6826ccdb0401d5eaaf26906e68f2e1a68 (patch) | |
tree | 62ca7cefa43f757bd6154cea51a774cb6e2e03e3 | |
parent | d65f3ba19d0d4af9b47b1fe6b5c3ab3cb25bca5c (diff) | |
download | fg21sim-c8e62dd6826ccdb0401d5eaaf26906e68f2e1a68.tar.bz2 |
Update logging messages; also remove creator __name__
This script is invoked on the CLI, and will have __name__ of
__main__
-rwxr-xr-x | bin/get-healpix-patch | 15 | ||||
-rw-r--r-- | fg21sim/foregrounds.py | 1 |
2 files changed, 9 insertions, 7 deletions
diff --git a/bin/get-healpix-patch b/bin/get-healpix-patch index 551279a..5e4fceb 100755 --- a/bin/get-healpix-patch +++ b/bin/get-healpix-patch @@ -84,7 +84,6 @@ def main(): logger.info("patch pixel size: %.1f [arcsec]" % pixelsize) sky = SkyPatch(size=size, pixelsize=pixelsize, center=center) - sky.creator = __name__ logger.info("Read HEALPix map from file: %s" % args.infile) hpdata, hpheader = read_fits_healpix(args.infile) nside = hpheader["NSIDE"] @@ -92,12 +91,13 @@ def main(): try: coordsys = hpheader["COORDSYS"] except KeyError: - logger.warning("missing COORDSYS keyword: %s" % args.infile) - logger.warning("assuming 'Galactic'") + logger.warning("No 'COORDSYS' keyword for file: %s" % args.infile) + logger.warning("Assume to use the 'Galactic' coordinate") coordsys = "Galactic" - image, __ = reproject_from_healpix( - input_data=(hpdata, coordsys), - output_projection=sky.wcs, shape_out=size) + image, __ = reproject_from_healpix(input_data=(hpdata, coordsys), + output_projection=sky.wcs, + shape_out=size) + if args.smooth: logger.info("Smoothing the sky patch with a Gaussian filter ...") sigma = (args.sigma_npix * hp.nside2resol(nside, arcmin=True) * @@ -105,11 +105,12 @@ def main(): image = scipy.ndimage.gaussian_filter(image, sigma=sigma) logger.info("Smoothed sky patch using Gaussian filter of " + "sigma = %.2f [pixel]" % sigma) + sky.merge_header(hpheader.copy(strip=True)) sky.add_history(" ".join(sys.argv)) sky.data = image sky.write(args.outfile, clobber=args.clobber) - logger.info("Write sky patch to file: %s" % args.outfile) + logger.info("Written extracted sky patch to file: %s" % args.outfile) if __name__ == "__main__": diff --git a/fg21sim/foregrounds.py b/fg21sim/foregrounds.py index 02f5c65..be17068 100644 --- a/fg21sim/foregrounds.py +++ b/fg21sim/foregrounds.py @@ -137,6 +137,7 @@ class Foregrounds: logger.info("==================================================") for compId, t1, t2 in timers: logger.info("%s : %.3f [s]" % (compID, t2-t1)) + logger.info("--------------------------------------------------") def postprocess(self): """ |