diff options
author | hack <hack@stsci.edu> | 2012-04-11 17:18:59 -0400 |
---|---|---|
committer | hack <hack@stsci.edu> | 2012-04-11 17:18:59 -0400 |
commit | c58735cfd7b383612abf9684c8ace58413269124 (patch) | |
tree | 6a0de47cddfa80a4b6d17b27a1188093185c3db0 /lib/stwcs/wcsutil/headerlet.py | |
parent | 40f51d6c4d33b516015f3b0b94b51bbe0d1f2b7e (diff) | |
download | stwcs_hcf-c58735cfd7b383612abf9684c8ace58413269124.tar.gz |
Based on a report by Andy, a bug was fixed in the headerlet code that had resulted in duplication of entries in the WCSCORR table when updating an image with a headerlet. The 'attach_to_file' method of the Headerlet class was modified to only update the WCSCORR table upon request, as it gets called by other routines which are already updating WCSCORR.
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci_python/trunk/stwcs@16151 fe389314-cf27-0410-b35b-8c050e845b92
Diffstat (limited to 'lib/stwcs/wcsutil/headerlet.py')
-rw-r--r-- | lib/stwcs/wcsutil/headerlet.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/stwcs/wcsutil/headerlet.py b/lib/stwcs/wcsutil/headerlet.py index baf7481..fe26393 100644 --- a/lib/stwcs/wcsutil/headerlet.py +++ b/lib/stwcs/wcsutil/headerlet.py @@ -1286,7 +1286,7 @@ def attach_headerlet(filename, hdrlet, logging=False, logmode='a'): """ hlet = Headerlet(hdrlet, logging=logging, logmode='a') - hlet.attach_to_file(filename) + hlet.attach_to_file(filename,archive=True) @with_logging @@ -2186,7 +2186,7 @@ class Headerlet(pyfits.HDUList): if close_dest: fobj.close() - def attach_to_file(self, fobj): + def attach_to_file(self, fobj, archive=False): """ Attach Headerlet as an HeaderletHDU to a science file @@ -2194,6 +2194,8 @@ class Headerlet(pyfits.HDUList): ---------- fobj: string, HDUList science file/HDUList to which the headerlet should be applied + archive: string + Specifies whether or not to update WCSCORR table when attaching Notes ----- @@ -2213,8 +2215,8 @@ class Headerlet(pyfits.HDUList): new_hlt = HeaderletHDU.fromheaderlet(self) new_hlt.header.update('extver', numhlt + 1) fobj.append(new_hlt) - - wcscorr.update_wcscorr(fobj, self, 'SIPWCS', active=False) + if archive: + wcscorr.update_wcscorr(fobj, self, 'SIPWCS', active=False) else: message = "Observation %s cannot be updated with headerlet" % (fname) |