summaryrefslogtreecommitdiff
path: root/wcsutil/wcscorr.py
diff options
context:
space:
mode:
authorembray <embray@stsci.edu>2011-04-06 10:58:08 -0400
committerembray <embray@stsci.edu>2011-04-06 10:58:08 -0400
commit2b4cab9ce484f6489fb6134de93b4d2f5d60ce94 (patch)
tree1cb116f3fecfc49e722c3a06d175d4557272df0c /wcsutil/wcscorr.py
parentda2184b6d431d1aa18fa081e7685701a90c13a3b (diff)
downloadstwcs_hcf-2b4cab9ce484f6489fb6134de93b4d2f5d60ce94.tar.gz
`Headerlet.apply()` now appends the headerlet of the original WCS to the *end*
of the file's HDU list. And it now also applies the new headerlet to the HDU list under that, and update's the WCSCORR table with rows for the WCSs in the new headerlet. This should achieve most of the basic requirements for headerlet functionality, though I still need to look into reversing the application of a headerlet... git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci_python/trunk/stwcs@12398 fe389314-cf27-0410-b35b-8c050e845b92
Diffstat (limited to 'wcsutil/wcscorr.py')
-rw-r--r--wcsutil/wcscorr.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/wcsutil/wcscorr.py b/wcsutil/wcscorr.py
index 5a592c3..ccc1fb7 100644
--- a/wcsutil/wcscorr.py
+++ b/wcsutil/wcscorr.py
@@ -238,6 +238,7 @@ def update_wcscorr(dest, source=None, extname='SCI', wcs_id=None):
# extension version; if this should not be assumed then this can be
# modified...
wcs_keys = altwcs.wcskeys(source[(extname, 1)].header)
+ wcs_keys = filter(None, wcs_keys)
wcshdr = stwcs.wcsutil.HSTWCS(source, ext=(extname, 1)).wcs2header()
wcs_keywords = wcshdr.keys()
@@ -290,9 +291,10 @@ def update_wcscorr(dest, source=None, extname='SCI', wcs_id=None):
if key in new_table.data.names:
new_table.data.field(key)[idx] = wcshdr[key + wcs_key]
+ prihdr = source[0].header
for key in DEFAULT_PRI_KEYS:
- if key in new_table.data.names:
- new_table.data.field(key)[idx] = source[0].header[key]
+ if key in new_table.data.names and prihdr.has_key(key):
+ new_table.data.field(key)[idx] = prihdr[key]
# If idx was never incremented, no rows were added, so there's nothing else
# to do...