aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-08-26 15:41:31 +0800
committerAaron LI <aly@aaronly.me>2017-08-26 15:41:31 +0800
commit71e9aeeb7f98f96926490af2723e2ebd414632f0 (patch)
tree6b07543ea11f3e8df771612d0e60936d15daf2cb /fg21sim
parent52159dc2bde2a1201c50bdc7506fd2c75aa2968f (diff)
downloadfg21sim-71e9aeeb7f98f96926490af2723e2ebd414632f0.tar.bz2
sky.py: Allow to set "header"; add "add_history()"
XXX: how to avoid the duplicate @header.setter???
Diffstat (limited to 'fg21sim')
-rw-r--r--fg21sim/sky.py23
1 files changed, 23 insertions, 0 deletions
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):
"""