From 2b4cab9ce484f6489fb6134de93b4d2f5d60ce94 Mon Sep 17 00:00:00 2001 From: embray Date: Wed, 6 Apr 2011 14:58:08 +0000 Subject: `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 --- wcsutil/wcscorr.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'wcsutil/wcscorr.py') 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... -- cgit