From d4e96f2d3fd1f266609c9d0f6b3661682b423333 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sat, 2 Sep 2017 14:05:24 +0800 Subject: ps2d.py: Warn about wrong data unit The input image cube data should in unit of [K] (brightness temperature). --- astro/ps2d.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'astro') 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: -- cgit v1.2.2