diff options
Diffstat (limited to 'stwcs/wcsutil/altwcs.py')
-rw-r--r-- | stwcs/wcsutil/altwcs.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/stwcs/wcsutil/altwcs.py b/stwcs/wcsutil/altwcs.py index 64cdc87..050a15e 100644 --- a/stwcs/wcsutil/altwcs.py +++ b/stwcs/wcsutil/altwcs.py @@ -356,7 +356,10 @@ def deleteWCS(fname, ext, wcskey=" ", wcsname=" "): if hwcs is None: continue for k in hwcs[::-1]: - del hdr[k] + try: + del hdr[k] + except KeyError: + pass prexts.append(i) if prexts != []: print('Deleted all instances of WCS with key %s in extensions' % wkey, prexts) @@ -455,7 +458,7 @@ def _restore(fobj, ukey, fromextnum, if kw in fobj[toextension].header: fobj[toextension].header[kw] = 0.0 - + # header operations |