From c8e62dd6826ccdb0401d5eaaf26906e68f2e1a68 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sat, 26 Aug 2017 21:01:58 +0800 Subject: Update logging messages; also remove creator __name__ This script is invoked on the CLI, and will have __name__ of __main__ --- bin/get-healpix-patch | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'bin') 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__": -- cgit v1.2.2