aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-06-11 22:09:08 +0800
committerAaron LI <aly@aaronly.me>2017-06-11 22:09:08 +0800
commita427998442d55bde843fd4f2f2bd70bc8c4f24f2 (patch)
treee31219ba96a3fc9a7c38f586e670f7d35703f80d
parentfa8208c993f5d74e67f506ed963b33bf4342401d (diff)
downloadatoolbox-a427998442d55bde843fd4f2f2bd70bc8c4f24f2.tar.bz2
astro/21cm/get_slice_zfreq.py: Fix header keywords usage
-rwxr-xr-xastro/21cm/get_slice_zfreq.py11
1 files changed, 10 insertions, 1 deletions
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))