From 32bc2e5f436167432cfbf67fd6c0b162080449c9 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sat, 26 Aug 2017 15:42:19 +0800 Subject: get-healpix-patch: Update against sky.py --- bin/get-healpix-patch | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'bin/get-healpix-patch') diff --git a/bin/get-healpix-patch b/bin/get-healpix-patch index a837ad4..2fa21c6 100755 --- a/bin/get-healpix-patch +++ b/bin/get-healpix-patch @@ -81,12 +81,19 @@ 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"] logger.info("Reprojecting HEALPix map to sky patch ...") + try: + coordsys = hpheader["COORDSYS"] + except KeyError: + logger.warning("missing COORDSYS keyword: %s" % args.infile) + logger.warning("assuming 'Galactic'") + coordsys = "Galactic" image, __ = reproject_from_healpix( - input_data=(hpdata, hpheader["COORDSYS"]), + input_data=(hpdata, coordsys), output_projection=sky.wcs, shape_out=size) if args.smooth: sigma = (2.0 * hp.nside2resol(nside, arcmin=True) * @@ -95,9 +102,7 @@ def main(): logger.info("Smoothed sky patch using Gaussian filter of " + "sigma = %.2f [pixel]" % sigma) sky.header = hpheader.copy(strip=True) - sky.header["OBJECT"] = "Sky Patch" - sky.header["EXTNAME"] = "IMAGE" - sky.header.add_history(" ".join(sys.argv)) + 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) -- cgit v1.2.2