summaryrefslogtreecommitdiff
path: root/lib/stwcs/distortion
diff options
context:
space:
mode:
authorhack <hack@stsci.edu>2013-04-30 16:55:57 -0400
committerhack <hack@stsci.edu>2013-04-30 16:55:57 -0400
commit05d1dce7d577d746482a7cb33d83703ab0b6e769 (patch)
treea57ddf5997004e18a88ff632a6c3de2b42959c4c /lib/stwcs/distortion
parent7d529dbb88ec1e47611373638b72ca8d648246a3 (diff)
downloadstwcs_hcf-05d1dce7d577d746482a7cb33d83703ab0b6e769.tar.gz
This update removes all references to .has_key() method, including those for list and dict comprehension, but primarily to work with PyFITS 3.2.dev checked in on 29-Apr-2013. [Trac Ticket #1007]
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stwcs/trunk@24552 fe389314-cf27-0410-b35b-8c050e845b92
Diffstat (limited to 'lib/stwcs/distortion')
-rw-r--r--lib/stwcs/distortion/coeff_converter.py6
-rw-r--r--lib/stwcs/distortion/models.py4
-rw-r--r--lib/stwcs/distortion/mutil.py10
3 files changed, 10 insertions, 10 deletions
diff --git a/lib/stwcs/distortion/coeff_converter.py b/lib/stwcs/distortion/coeff_converter.py
index bbad867..a0ff1a4 100644
--- a/lib/stwcs/distortion/coeff_converter.py
+++ b/lib/stwcs/distortion/coeff_converter.py
@@ -76,8 +76,8 @@ def _read_sip_kw(header):
If no SIP header keywords are found, None is returned.
"""
- if header.has_key("A_ORDER"):
- if not header.has_key("B_ORDER"):
+ if "A_ORDER" in header:
+ if "B_ORDER" not in header:
raise ValueError(
"A_ORDER provided without corresponding B_ORDER "
"keyword for SIP distortion")
@@ -93,7 +93,7 @@ def _read_sip_kw(header):
for i in range(m+1):
for j in range(m-i+1):
b[i, j] = header.get("B_%d_%d" % (i, j), 0.0)
- elif header.has_key("B_ORDER"):
+ elif "B_ORDER" in header:
raise ValueError(
"B_ORDER provided without corresponding A_ORDER "
"keyword for SIP distortion")
diff --git a/lib/stwcs/distortion/models.py b/lib/stwcs/distortion/models.py
index db48a9f..3e7d2b4 100644
--- a/lib/stwcs/distortion/models.py
+++ b/lib/stwcs/distortion/models.py
@@ -273,7 +273,7 @@ class IDCModel(GeometryModel):
chip=chip,direction=direction,filter1=filter1,filter2=filter2,
date=date, offtab=offtab)
- if self.refpix.has_key('empty_model') and self.refpix['empty_model']:
+ if 'empty_model' in self.refpix and self.refpix['empty_model']:
pass
else:
self.refpix['PSCALE'] = self.refpix['PSCALE'] * binned
@@ -296,7 +296,7 @@ class WCSModel(GeometryModel):
GeometryModel.__init__(self)
- if header.has_key('rootname'):
+ if 'rootname' in header:
self.name = header['rootname']
else:
self.name = rootname
diff --git a/lib/stwcs/distortion/mutil.py b/lib/stwcs/distortion/mutil.py
index fc97606..02fc4c2 100644
--- a/lib/stwcs/distortion/mutil.py
+++ b/lib/stwcs/distortion/mutil.py
@@ -67,10 +67,10 @@ def readIDCtab (tabname, chip=1, date=None, direction='forward',
#First thing we need, is to read in the coefficients from the IDC
# table and populate the Fx and Fy matrices.
- if ftab['PRIMARY'].header.has_key('DETECTOR'):
+ if 'DETECTOR' in ftab['PRIMARY'].header:
detector = ftab['PRIMARY'].header['DETECTOR']
else:
- if ftab['PRIMARY'].header.has_key('CAMERA'):
+ if 'CAMERA' in ftab['PRIMARY'].header:
detector = str(ftab['PRIMARY'].header['CAMERA'])
else:
detector = 1
@@ -263,7 +263,7 @@ def read_tdd_coeffs(phdr):
skew_coeffs['TDD_A'] = None
skew_coeffs['TDD_B'] = None
- if phdr.has_key("TDDORDER"):
+ if "TDDORDER" in phdr:
n = int(phdr["TDDORDER"])
else:
print 'TDDORDER kw not present, using default TDD correction'
@@ -438,7 +438,7 @@ def readWCSCoeffs(header):
for i in xrange(_xorder+1):
for j in xrange(i+1):
xcname = cxstr+str(j)+'_'+str(i-j)
- if header.has_key(xcname):
+ if xcname in header:
fx[i,j] = header[xcname]
# Extract Y coeffs separately as a different order may
@@ -446,7 +446,7 @@ def readWCSCoeffs(header):
for i in xrange(_yorder+1):
for j in xrange(i+1):
ycname = cystr+str(j)+'_'+str(i-j)
- if header.has_key(ycname):
+ if ycname in header:
fy[i,j] = header[ycname]
# Now set the linear terms