aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-09-02 14:05:24 +0800
committerAaron LI <aly@aaronly.me>2017-09-02 14:05:24 +0800
commitd4e96f2d3fd1f266609c9d0f6b3661682b423333 (patch)
tree444193744e909a8f490ef24592ae86e1c92f55d6
parent5ded5c345829f3372ad196648eecd7e0b60bd427 (diff)
downloadatoolbox-d4e96f2d3fd1f266609c9d0f6b3661682b423333.tar.bz2
ps2d.py: Warn about wrong data unit
The input image cube data should in unit of [K] (brightness temperature).
-rwxr-xr-xastro/ps2d.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/astro/ps2d.py b/astro/ps2d.py
index cc4fdea..d17da66 100755
--- a/astro/ps2d.py
+++ b/astro/ps2d.py
@@ -410,7 +410,14 @@ def main():
with fits.open(args.infile) as f:
cube = f[0].data
- wcs = WCS(f[0].header)
+ header = f[0].header
+ bunit = header.get("BUNIT", "UNKNOWN")
+ if bunit.upper() not in ["K", "KELVIN", "MK"]:
+ logger.warning("Wrong data unit: %s" % bunit)
+ else:
+ logger.info("Data unit: %s" % bunit)
+
+ wcs = WCS(header)
nfreq = cube.shape[0]
frequencies = get_frequencies(wcs, nfreq)
if args.pixelsize: