aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-08-26 21:01:58 +0800
committerAaron LI <aly@aaronly.me>2017-08-26 21:07:09 +0800
commitc8e62dd6826ccdb0401d5eaaf26906e68f2e1a68 (patch)
tree62ca7cefa43f757bd6154cea51a774cb6e2e03e3 /bin
parentd65f3ba19d0d4af9b47b1fe6b5c3ab3cb25bca5c (diff)
downloadfg21sim-c8e62dd6826ccdb0401d5eaaf26906e68f2e1a68.tar.bz2
Update logging messages; also remove creator __name__
This script is invoked on the CLI, and will have __name__ of __main__
Diffstat (limited to 'bin')
-rwxr-xr-xbin/get-healpix-patch15
1 files changed, 8 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__":