summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordencheva <dencheva@stsci.edu>2011-06-03 14:54:49 -0400
committerdencheva <dencheva@stsci.edu>2011-06-03 14:54:49 -0400
commit0c69f81c515b080bfa80a1ffd6a5af2275067259 (patch)
tree93714260e287eb92e46ea4dc295b6c62db363a97
parent52bb48686b1d02c0de422ddf6faa8be8b8c8c78f (diff)
downloadstwcs_hcf-0c69f81c515b080bfa80a1ffd6a5af2275067259.tar.gz
Headerlet.apply was not removing kw with reference files from the primary header which resulted in kw duplication after the headerlet was applied. Added code which cleans the primary header before applying the headerlet.
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci_python/trunk/stwcs@13052 fe389314-cf27-0410-b35b-8c050e845b92
-rw-r--r--wcsutil/headerlet.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/wcsutil/headerlet.py b/wcsutil/headerlet.py
index 856be86..a30f06b 100644
--- a/wcsutil/headerlet.py
+++ b/wcsutil/headerlet.py
@@ -598,7 +598,8 @@ class Headerlet(pyfits.HDUList):
del dest[idx].header.ascard['VAFACTOR']
except KeyError:
pass
-
+
+ self._removeRefFiles(dest[0])
self._removeAltWCS(dest, ext=range(numext))
numwdvarr = countExtn(dest, 'WCSDVARR')
numd2im = countExtn(dest, 'D2IMARR')
@@ -606,7 +607,18 @@ class Headerlet(pyfits.HDUList):
del dest[('WCSDVARR', idx)]
for idx in range(1, numd2im + 1):
del dest[('D2IMARR', idx)]
-
+
+ def _removeRefFiles(self, phdu):
+ """
+ phdu: Primary HDU
+ """
+ refkw = ['IDCTAB', 'NPOLFILE', 'D2IMFILE']
+ for kw in refkw:
+ try:
+ del phdu.header.ascard[kw]
+ except KeyError:
+ pass
+
def _removeSIP(self, ext):
"""
Remove the SIP distortion of a FITS extension