From a427998442d55bde843fd4f2f2bd70bc8c4f24f2 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sun, 11 Jun 2017 22:09:08 +0800 Subject: astro/21cm/get_slice_zfreq.py: Fix header keywords usage --- astro/21cm/get_slice_zfreq.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/astro/21cm/get_slice_zfreq.py b/astro/21cm/get_slice_zfreq.py index c67d513..6805b4a 100755 --- a/astro/21cm/get_slice_zfreq.py +++ b/astro/21cm/get_slice_zfreq.py @@ -97,7 +97,16 @@ def main(): print("z=%05.2f, freq=%06.2f MHz : %s" % (z, f, outfile)) zslice = cube.get_slice(z) header = fits.Header() - header["BUNIT"] = cube.header.get("BUNIT") + try: + header["BUNIT"] = (cube.header["BUNIT"], + cube.header.comments["BUNIT"]) + except KeyError: + pass + try: + header["LSIDE"] = (cube.header["LSIDE"], + cube.header.comments["LSIDE"]) + except KeyError: + pass header["REDSHIFT"] = (z, "Slice where interpolated") header["FREQ"] = (f, "21cm signal frequency [MHz]") header.add_history(" ".join(sys.argv)) -- cgit v1.2.2