aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-08-26 20:34:13 +0800
committerAaron LI <aly@aaronly.me>2017-08-26 20:34:13 +0800
commit20b428146982bd762390c17f83e5e46e955d8859 (patch)
treef9826bf880b0bf7890328e1d9536100d5dfff8d2
parent9f713b6b099a960488ce1b6aed6ef76be43471b5 (diff)
downloadfg21sim-20b428146982bd762390c17f83e5e46e955d8859.tar.bz2
sky.py: Replace @header.setter with method "merge_header()"
* Avoid the duplicate "@header.setter" in the inherited classes * Update get-healpix-patch
-rwxr-xr-xbin/get-healpix-patch2
-rw-r--r--fg21sim/sky.py16
2 files changed, 5 insertions, 13 deletions
diff --git a/bin/get-healpix-patch b/bin/get-healpix-patch
index 2fa21c6..9d82ffd 100755
--- a/bin/get-healpix-patch
+++ b/bin/get-healpix-patch
@@ -101,7 +101,7 @@ def main():
image = scipy.ndimage.gaussian_filter(image, sigma=sigma)
logger.info("Smoothed sky patch using Gaussian filter of " +
"sigma = %.2f [pixel]" % sigma)
- sky.header = hpheader.copy(strip=True)
+ sky.merge_header(hpheader.copy(strip=True))
sky.add_history(" ".join(sys.argv))
sky.data = image
sky.write(args.outfile, clobber=args.clobber)
diff --git a/fg21sim/sky.py b/fg21sim/sky.py
index 7fac16d..a8b0705 100644
--- a/fg21sim/sky.py
+++ b/fg21sim/sky.py
@@ -257,13 +257,12 @@ class SkyBase:
"File creation date")
return hdr
- @header.setter
- def header(self, hdr):
+ def merge_header(self, header, update=False):
"""
- Update the supplied header to the FITS header, but do NOT
- overwrite the original keywords.
+ Merge the supplied header to the instance's FITS header.
+ Do not overwrite the original keywords by default (``update=False``).
"""
- self.header_.extend(hdr, update=False)
+ self.header_.extend(header, update=update)
def add_header(self, key, value, comment=None):
"""
@@ -604,13 +603,6 @@ class SkyPatch(SkyBase):
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):
"""