aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/get-healpix-patch13
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)