aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-09-02 13:06:30 +0800
committerAaron LI <aly@aaronly.me>2017-09-02 13:06:30 +0800
commit6d58d41451935466a9cbaaf0502e843f3d7904ee (patch)
tree0b0bbe78403d8f42f4fdf1704336dc7dd074713d
parenta214637f11d7c8277f2127db3ff0c3731e6c6b80 (diff)
downloadatoolbox-6d58d41451935466a9cbaaf0502e843f3d7904ee.tar.bz2
ps2d.py: Default to obtain pixel size from FITS header
-rwxr-xr-xastro/ps2d.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/astro/ps2d.py b/astro/ps2d.py
index 5e8d2a6..8852e97 100755
--- a/astro/ps2d.py
+++ b/astro/ps2d.py
@@ -395,9 +395,9 @@ def main():
parser.add_argument("-C", "--clobber", dest="clobber",
action="store_true",
help="overwrite existing file")
- parser.add_argument("-p", "--pixelsize", dest="pixelsize",
- type=float, required=True,
- help="image cube pixel size; unit: [arcsec]")
+ parser.add_argument("-p", "--pixelsize", dest="pixelsize", type=float,
+ help="image cube pixel size [arcsec] (default: " +
+ "obtain from FITS header WCS info)")
parser.add_argument("--window", dest="window",
choices=["nuttall"],
help="apply window along frequency axis " +
@@ -413,7 +413,12 @@ def main():
wcs = WCS(f[0].header)
nfreq = cube.shape[0]
frequencies = get_frequencies(wcs, nfreq)
- ps2d = PS2D(cube=cube, pixelsize=args.pixelsize, frequencies=frequencies,
+ if args.pixelsize:
+ pixelsize = args.pixelsize # [arcsec]
+ else:
+ pixelsize = wcs.wcs.cdelt[0] * 3600 # [deg] -> [arcsec]
+
+ ps2d = PS2D(cube=cube, pixelsize=pixelsize, frequencies=frequencies,
window_name=args.window)
ps2d.calc_ps3d()
ps2d.calc_ps2d()