aboutsummaryrefslogtreecommitdiffstats
path: root/astro/oskar/fits2skymodel.py
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-08-22 12:27:03 +0800
committerAaron LI <aly@aaronly.me>2017-08-22 12:27:03 +0800
commit7db2b0e21e3d2ad11a98ca894ec5945470ed3a5f (patch)
tree6f185a48f29acf150801abaf2d806d3de4343eb0 /astro/oskar/fits2skymodel.py
parentc8b7038f671615f06f6c766c4378aa6d5c4d8490 (diff)
downloadatoolbox-7db2b0e21e3d2ad11a98ca894ec5945470ed3a5f.tar.bz2
fits2skymodel.py: Make sure input FITS has unit "K" (Kelvin)
Diffstat (limited to 'astro/oskar/fits2skymodel.py')
-rwxr-xr-xastro/oskar/fits2skymodel.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/astro/oskar/fits2skymodel.py b/astro/oskar/fits2skymodel.py
index 46fe883..cc66092 100755
--- a/astro/oskar/fits2skymodel.py
+++ b/astro/oskar/fits2skymodel.py
@@ -264,6 +264,14 @@ def main():
image = f[0].data
header = f[0].header
logger.info("Read image slice: %s" % args.infile)
+
+ # Check data unit
+ unit = header.get("BUNIT")
+ if unit is None:
+ logger.warning("input FITS file of unknown data unit!")
+ elif unit.upper() not in ["K", "KELVIN"]:
+ logger.error("input FITS file of wrong data unit: %s" % unit)
+
freq = args.freq if args.freq else header["FREQ"] # [MHz]
if args.pixelsize:
pixelsize = args.pixelsize # [arcsec]