summaryrefslogtreecommitdiff
path: root/lib/stwcs/updatewcs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stwcs/updatewcs')
-rw-r--r--lib/stwcs/updatewcs/__init__.py10
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):
"""