From 7db2b0e21e3d2ad11a98ca894ec5945470ed3a5f Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Tue, 22 Aug 2017 12:27:03 +0800 Subject: fits2skymodel.py: Make sure input FITS has unit "K" (Kelvin) --- astro/oskar/fits2skymodel.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'astro/oskar') 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] -- cgit v1.2.2