diff options
author | dencheva <dencheva@stsci.edu> | 2015-05-29 11:07:47 -0400 |
---|---|---|
committer | dencheva <dencheva@stsci.edu> | 2015-05-29 11:07:47 -0400 |
commit | 8effc9a9897ffc5767d022fadb74d68dbf00c378 (patch) | |
tree | 4621cbccee8416b01a751d99bad6a7b41aaf7dfe /lib/stwcs/updatewcs | |
parent | 5d85267c6eb4f6cacaa10e1c0439ad8b5778adaa (diff) | |
download | stwcs_hcf-8effc9a9897ffc5767d022fadb74d68dbf00c378.tar.gz |
Add RADESYS to headers. Fixed cleanWCS which was trying to delete WCS keywords from the primary header and raising an error. Resolves #1173.
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stwcs/trunk@40546 fe389314-cf27-0410-b35b-8c050e845b92
Diffstat (limited to 'lib/stwcs/updatewcs')
-rw-r--r-- | lib/stwcs/updatewcs/__init__.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/stwcs/updatewcs/__init__.py b/lib/stwcs/updatewcs/__init__.py index d09f5a8..9509dbd 100644 --- a/lib/stwcs/updatewcs/__init__.py +++ b/lib/stwcs/updatewcs/__init__.py @@ -347,7 +347,7 @@ def newIDCTAB(fname): def cleanWCS(fname): # A new IDCTAB means all previously computed WCS's are invalid - # We are deleting all of them except the original OPUS WCS.nvalidates all WCS's. + # We are deleting all of them except the original OPUS WCS. f = fits.open(fname, mode='update') keys = wcsutil.wcskeys(f[1].header) # Remove the primary WCS from the list @@ -355,9 +355,13 @@ def cleanWCS(fname): keys.remove(' ') except ValueError: pass - fext = list(range(len(f))) + fext = list(range(1, len(f))) for key in keys: - wcsutil.deleteWCS(fname, ext=fext, wcskey=key) + try: + wcsutil.deleteWCS(fname, ext=fext, wcskey=key) + except KeyError: + # Some extensions don't have the alternate (or any) WCS keywords + continue def getCorrections(instrument): """ |