From 71e9aeeb7f98f96926490af2723e2ebd414632f0 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sat, 26 Aug 2017 15:41:31 +0800 Subject: sky.py: Allow to set "header"; add "add_history()" XXX: how to avoid the duplicate @header.setter??? --- fg21sim/sky.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'fg21sim') diff --git a/fg21sim/sky.py b/fg21sim/sky.py index 17ffd62..7fac16d 100644 --- a/fg21sim/sky.py +++ b/fg21sim/sky.py @@ -257,6 +257,14 @@ class SkyBase: "File creation date") return hdr + @header.setter + def header(self, hdr): + """ + Update the supplied header to the FITS header, but do NOT + overwrite the original keywords. + """ + self.header_.extend(hdr, update=False) + def add_header(self, key, value, comment=None): """ Add/update a key to the FITS header. @@ -266,6 +274,12 @@ class SkyBase: else: self.header_[key] = (value, comment) + def add_history(self, history): + """ + Add history to the FITS header. + """ + self.header_.add_history(history) + def copy(self): """ Return a (deep) copy of this instance. @@ -584,10 +598,19 @@ class SkyPatch(SkyBase): """ hdr = super().header hdr.extend(self.wcs.to_header(), update=True) + hdr["OBJECT"] = "Sky Patch" + hdr["EXTNAME"] = "IMAGE" hdr["RA0"] = (self.center[0], "R.A. of patch center [deg]") hdr["DEC0"] = (self.center[1], "Dec. of patch center [deg]") return hdr + @header.setter + def header(self, hdr): + """ + XXX: How to avoid this duplicate??? + """ + self.header_.extend(hdr, update=False) + @property def wcs(self): """ -- cgit v1.2.2