aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-07-19 16:34:40 +0800
committerAaron LI <aly@aaronly.me>2017-07-19 16:34:40 +0800
commit9b7f99bbd0eca0e611601dd936c1f7948f8cd58a (patch)
treecde8dd145d1a560213fa1f4eacefe9ad80b7e40b /bin
parentbfc2b52d6c12553290742fcf793e48b1133e7dad (diff)
downloadfg21sim-9b7f99bbd0eca0e611601dd936c1f7948f8cd58a.tar.bz2
Use [arcsec] as the unit for pixel size and resolution
Signed-off-by: Aaron LI <aly@aaronly.me>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/get-healpix-patch10
1 files changed, 6 insertions, 4 deletions
diff --git a/bin/get-healpix-patch b/bin/get-healpix-patch
index 7f01f78..0dc27f6 100755
--- a/bin/get-healpix-patch
+++ b/bin/get-healpix-patch
@@ -22,6 +22,7 @@ from fg21sim.configs import configs
from fg21sim.sky import SkyPatch
from fg21sim.utils import setup_logging
from fg21sim.utils.fits import read_fits_healpix
+from fg21sim.utils.units import UnitConversions as AUC
def main():
@@ -39,7 +40,7 @@ def main():
help="size of the sky patch; " +
"format: xsize,ysize; unit: pixel")
parser.add_argument("--pixelsize", dest="pixelsize", type=float,
- help="pixel size of the sky patch; unit: arcmin")
+ help="pixel size of the sky patch; unit: [arcsec]")
parser.add_argument("-S", "--smooth", dest="smooth", action="store_true",
help="Smooth the output patch using a Gaussian " +
"filter whose sigma is 2x the pixel size " +
@@ -59,7 +60,7 @@ def main():
configs.getn("sky/patch/ycenter")) # [ deg ]
size = (configs.getn("sky/patch/xsize"),
configs.getn("sky/patch/ysize"))
- pixelsize = configs.getn("sky/patch/pixelsize") # [ arcmin ]
+ pixelsize = configs.getn("sky/patch/pixelsize") # [ arcsec ]
elif not all([args.center, args.size, args.pixelsize]):
raise ValueError("--center, --size, and --pixelsize are " +
"required when --config is missing!")
@@ -75,7 +76,7 @@ def main():
logger.info("patch center: (%.3f, %.3f) [deg]" % center)
logger.info("patch size: (%d, %d) pixels" % size)
- logger.info("patch pixel size: %.1f [arcmin]" % pixelsize)
+ logger.info("patch pixel size: %.1f [arcsec]" % pixelsize)
sky = SkyPatch(size=size, pixelsize=pixelsize, center=center)
logger.info("Read HEALPix map from file: %s" % args.infile)
@@ -86,7 +87,8 @@ def main():
input_data=(hpdata, hpheader["COORDSYS"]),
output_projection=sky.wcs, shape_out=size)
if args.smooth:
- sigma = 2 * hp.nside2resol(nside, arcmin=True) / pixelsize
+ sigma = (2.0 * hp.nside2resol(nside, arcmin=True) *
+ AUC.arcmin2arcsec / pixelsize)
image = scipy.ndimage.gaussian_filter(image, sigma=sigma)
logger.info("Smoothed sky patch using Gaussian filter of " +
"sigma = %.2f [pixel]" % sigma)