diff options
author | Aaron LI <aly@aaronly.me> | 2017-08-26 15:42:19 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2017-08-26 15:42:19 +0800 |
commit | 32bc2e5f436167432cfbf67fd6c0b162080449c9 (patch) | |
tree | 16cd20c7af347226c1bdf0e5f11490b63815eac3 | |
parent | 71e9aeeb7f98f96926490af2723e2ebd414632f0 (diff) | |
download | fg21sim-32bc2e5f436167432cfbf67fd6c0b162080449c9.tar.bz2 |
get-healpix-patch: Update against sky.py
-rwxr-xr-x | bin/get-healpix-patch | 13 |
1 files changed, 9 insertions, 4 deletions
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) |