From 45e63d7b69a77bda12aa44aea4a4effc2ba90e53 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Wed, 5 Oct 2016 10:13:31 +0800 Subject: Update to use the "write_fits_healpix()" function --- bin/hpx2healpix | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'bin') diff --git a/bin/hpx2healpix b/bin/hpx2healpix index ce83553..ac65fbd 100755 --- a/bin/hpx2healpix +++ b/bin/hpx2healpix @@ -18,18 +18,7 @@ from astropy.io import fits import fg21sim from fg21sim.configs import configs -from fg21sim.utils import hpx2healpix, setup_logging - - -# Reference: -# http://docs.astropy.org/en/stable/io/fits/usage/table.html#column-creation -FITS_COLUMN_FORMATS = { - np.dtype("int16"): "I", - np.dtype("int32"): "J", - np.dtype("int64"): "K", - np.dtype("float32"): "E", - np.dtype("float64"): "D", -} +from fg21sim.utils import hpx2healpix, write_fits_healpix, setup_logging def main(): @@ -82,11 +71,8 @@ def main(): if args.float: logger.info("HEALPix data: use single-precision float numbers") hp_data = hp_data.astype(np.float32) - hdu = fits.BinTableHDU.from_columns([ - fits.Column(name="I", array=hp_data, - format=FITS_COLUMN_FORMATS.get(hp_data.dtype)) - ], header=hp_header) - hdu.writeto(args.outfile, clobber=args.clobber, checksum=True) + write_fits_healpix(args.outfile, hpmap=hp_data, header=hp_header, + clobber=args.clobber) logger.info("HEALPix data write to FITS file: %s" % args.outfile) -- cgit v1.2.2