summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--updatewcs/__init__.py21
-rw-r--r--updatewcs/apply_corrections.py33
-rw-r--r--wcsutil/__init__.py2
3 files changed, 37 insertions, 19 deletions
diff --git a/updatewcs/__init__.py b/updatewcs/__init__.py
index a2d0690..71987e7 100644
--- a/updatewcs/__init__.py
+++ b/updatewcs/__init__.py
@@ -18,7 +18,13 @@ def updatewcs(input, vacorr=True, tddcorr=True, dgeocorr=True, checkfiles=True,
"""
Purpose
=======
- Applies corrections to the WCS keywords.
+ Updates HST science files with the best available calibration information.
+ This allows users to retrieve from the archive self contained science files
+ which do not require additional reference files.
+
+ Basic WCS keywords are updated in the process and new keywords (following WCS
+ Paper IV and the SIP convention) as well as new extensions are added to the science files.
+
Example
=======
@@ -192,3 +198,16 @@ def checkFiles(input):
return newfiles
+
+def getCorrections(instrument):
+ """
+ Print corrections available for an instrument
+
+ :Parameters:
+ `instrument`: string, one of 'WFPC2', 'NICMOS', 'STIS', 'ACS', 'WFC3'
+ """
+ acorr = apply_corrections.allowed_corrections[instrument]
+
+ print "The following corrections will be performed for instrument %s\n" % instrument
+ for c in acorr: print c,': ' , apply_corrections.cnames[c]
+ \ No newline at end of file
diff --git a/updatewcs/apply_corrections.py b/updatewcs/apply_corrections.py
index 665d0f4..c6e0f04 100644
--- a/updatewcs/apply_corrections.py
+++ b/updatewcs/apply_corrections.py
@@ -17,6 +17,14 @@ allowed_corrections={'WFPC2': ['DET2IMCorr', 'MakeWCS','CompSIP', 'VACorr'],
'NICMOS': ['MakeWCS', 'CompSIP','VACorr'],
'WFC3': ['MakeWCS', 'CompSIP','VACorr'],
}
+
+cnames = {'DET2IMCorr': 'Detector to Image Correction',
+ 'TDDCorr': 'Time Dependent Distortion Correction',
+ 'MakeWCS': 'Recalculate basic WCS keywords based on the distortion model',
+ 'CompSIP': 'Given IDCTAB distortion model calculate the SIP coefficients',
+ 'VACorr': 'Velocity Aberration Correction',
+ 'DGEOCorr': 'Lookup Table Distortion'
+ }
def setCorrections(fname, vacorr=True, tddcorr=True, dgeocorr=True, d2imcorr=True):
"""
@@ -30,15 +38,14 @@ def setCorrections(fname, vacorr=True, tddcorr=True, dgeocorr=True, d2imcorr=Tru
# make a copy of this list !
acorr = allowed_corrections[instrument][:]
- #First check if idctab was updated
- if not foundIDCTAB(fname):# and not foundSIP(fname):
+ # 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):
acorr.remove('TDDCorr')
acorr.remove('MakeWCS')
- acorr.remove('CompSIP')
- elif not foundIDCTAB(fname) and foundSIP(fname):
- print 'IDCTAB not found, using SIP coefficients\n'
-
- #check if idctab is present on disk
+ acorr.remove('CompSIP')
+
if 'VACorr' in acorr and vacorr==False: acorr.remove('VACorr')
if 'TDDCorr' in acorr:
tddcorr = applyTDDCorr(fname, tddcorr)
@@ -50,6 +57,7 @@ def setCorrections(fname, vacorr=True, tddcorr=True, dgeocorr=True, d2imcorr=Tru
if 'DET2IMCorr' in acorr:
d2imcorr = applyD2ImCorr(fname, d2imcorr)
if d2imcorr == False: acorr.remove('DET2IMCorr')
+ print acorr
return acorr
def foundIDCTAB(fname):
@@ -65,16 +73,7 @@ def foundIDCTAB(fname):
except KeyError:
idctab_found = False
return idctab_found
-
-def foundSIP(fname):
- sip_found = False
- try:
- idcscale = pyfits.getval(fname, 'IDCSCALE')
- sip_found = True
- except KeyError:
- sip_found = False
- return sip_found
-
+
def applyTDDCorr(fname, utddcorr):
"""
The default value of tddcorr for all ACS images is True.
diff --git a/wcsutil/__init__.py b/wcsutil/__init__.py
index fd01499..3afb218 100644
--- a/wcsutil/__init__.py
+++ b/wcsutil/__init__.py
@@ -217,7 +217,7 @@ class HSTWCS(WCS):
self.idcmodel = model
- def readModelFromIDCTAB(self, header=hdr, update=False):
+ def readModelFromIDCTAB(self, header=None, update=False):
"""
Purpose
=======