summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/stwcs/updatewcs/__init__.py7
-rw-r--r--lib/stwcs/updatewcs/apply_corrections.py11
-rw-r--r--lib/stwcs/wcsutil/altwcs.py2
3 files changed, 13 insertions, 7 deletions
diff --git a/lib/stwcs/updatewcs/__init__.py b/lib/stwcs/updatewcs/__init__.py
index d09f5a8..7bca5f7 100644
--- a/lib/stwcs/updatewcs/__init__.py
+++ b/lib/stwcs/updatewcs/__init__.py
@@ -343,6 +343,8 @@ def newIDCTAB(fname):
if idctab == oldidctab:
return False
else:
+ if not os.path.exists(idctab):
+ print("IDCTAB {0} not found".format(idctab))
return True
def cleanWCS(fname):
@@ -357,7 +359,10 @@ def cleanWCS(fname):
pass
fext = list(range(len(f)))
for key in keys:
- wcsutil.deleteWCS(fname, ext=fext, wcskey=key)
+ try:
+ wcsutil.deleteWCS(fname, ext=fext, wcskey=key)
+ except KeyError:
+ pass
def getCorrections(instrument):
"""
diff --git a/lib/stwcs/updatewcs/apply_corrections.py b/lib/stwcs/updatewcs/apply_corrections.py
index 2871a46..4d52311 100644
--- a/lib/stwcs/updatewcs/apply_corrections.py
+++ b/lib/stwcs/updatewcs/apply_corrections.py
@@ -41,14 +41,14 @@ def setCorrections(fname, vacorr=True, tddcorr=True, npolcorr=True, d2imcorr=Tru
instrument = fits.getval(fname, 'INSTRUME')
# make a copy of this list !
acorr = allowed_corrections[instrument][:]
-
+ print('in setCoorections', acorr)
# Check if idctab is present on disk
# If kw IDCTAB is present in the header but the file is
# not found on disk, do not run TDDCorr, MakeCWS and CompSIP
- if not foundIDCTAB(fname):
- if 'TDDCorr' in acorr: acorr.remove('TDDCorr')
- if 'MakeWCS' in acorr: acorr.remove('MakeWCS')
- if 'CompSIP' in acorr: acorr.remove('CompSIP')
+ #if not foundIDCTAB(fname):
+ #if 'TDDCorr' in acorr: acorr.remove('TDDCorr')
+ #if 'MakeWCS' in acorr: acorr.remove('MakeWCS')
+ #if 'CompSIP' in acorr: acorr.remove('CompSIP')
if 'VACorr' in acorr and vacorr==False: acorr.remove('VACorr')
if 'TDDCorr' in acorr:
@@ -74,6 +74,7 @@ def foundIDCTAB(fname):
if os.path.exists(idctab):
return True
else:
+ print("IDCTAB file {0} not found".format(idctab))
return False
def applyTDDCorr(fname, utddcorr):
diff --git a/lib/stwcs/wcsutil/altwcs.py b/lib/stwcs/wcsutil/altwcs.py
index 293f22d..4e11890 100644
--- a/lib/stwcs/wcsutil/altwcs.py
+++ b/lib/stwcs/wcsutil/altwcs.py
@@ -327,7 +327,7 @@ def deleteWCS(fname, ext, wcskey=" ", wcsname=" "):
return
wcskeyext = ext[0]
-
+ print('wcskeyext', wcskeyext, ext)
if not wcskeys and not wcsname:
raise KeyError("Either wcskey or wcsname should be specified")