summaryrefslogtreecommitdiff
path: root/updatewcs/corrections.py
diff options
context:
space:
mode:
authordencheva <dencheva@stsci.edu>2008-10-22 11:09:18 -0400
committerdencheva <dencheva@stsci.edu>2008-10-22 11:09:18 -0400
commitf0d0edf3c0778abbd1f56ab172ca3eb7daa5c11a (patch)
tree625cd2cc7dde83ddd7b3410896082eb3e96ccf39 /updatewcs/corrections.py
parentb003de463c45950a475892c8f5316c2f13a7536f (diff)
downloadstwcs_hcf-f0d0edf3c0778abbd1f56ab172ca3eb7daa5c11a.tar.gz
Many changes to match the changes in pywcs.
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/development/trunk/hstwcs@7189 fe389314-cf27-0410-b35b-8c050e845b92
Diffstat (limited to 'updatewcs/corrections.py')
-rw-r--r--updatewcs/corrections.py58
1 files changed, 29 insertions, 29 deletions
diff --git a/updatewcs/corrections.py b/updatewcs/corrections.py
index ac49833..dc4eeff 100644
--- a/updatewcs/corrections.py
+++ b/updatewcs/corrections.py
@@ -25,21 +25,21 @@ class TDDCorr(object):
A reference HSTWCS object
"""
- def updateWCS(cls, wcs, refwcs):
+ def updateWCS(cls, ext_wcs, ref_wcs):
"""
- Calculates alpha and beta for ACS/WFC data.
- Writes 2 new kw to the extension header: TDDALPHA and TDDBETA
- sets TDDCORR to COMPLETE
"""
- alpha, beta = cls.set_alpha_beta(wcs)
- cls.apply_tdd2idc(wcs, alpha, beta)
+ alpha, beta = cls.set_alpha_beta(ext_wcs)
+ cls.apply_tdd2idc(ext_wcs, alpha, beta)
newkw = {'TDDALPHA': alpha, 'TDDBETA':beta, 'TDDCORR': 'COMPLETE'}
return newkw
updateWCS = classmethod(updateWCS)
- def apply_tdd2idc(cls,wcs, alpha, beta):
+ def apply_tdd2idc(cls,ext_wcs, alpha, beta):
"""
Applies TDD to the idctab coefficients of a ACS/WFC observation.
This should be always the first correction.
@@ -53,23 +53,23 @@ class TDDCorr(object):
tdd_mat = numpy.array([[1+(beta/2048.), alpha/2048.],[alpha/2048.,1-(beta/2048.)]],numpy.float64)
abmat1 = numpy.dot(tdd_mat, mrotn)
abmat2 = numpy.dot(mrotp,abmat1)
- xshape, yshape = wcs.idcmodel.cx.shape, wcs.idcmodel.cy.shape
- icxy = numpy.dot(abmat2,[wcs.idcmodel.cx.ravel(),wcs.idcmodel.cy.ravel()])
- wcs.idcmodel.cx = icxy[0]
- wcs.idcmodel.cy = icxy[1]
- wcs.idcmodel.cx.shape = xshape
- wcs.idcmodel.cy.shape = yshape
- wcs.set()
+ xshape, yshape = ext_wcs.idcmodel.cx.shape, ext_wcs.idcmodel.cy.shape
+ icxy = numpy.dot(abmat2,[ext_wcs.idcmodel.cx.ravel(),ext_wcs.idcmodel.cy.ravel()])
+ ext_wcs.idcmodel.cx = icxy[0]
+ ext_wcs.idcmodel.cy = icxy[1]
+ ext_wcs.idcmodel.cx.shape = xshape
+ ext_wcs.idcmodel.cy.shape = yshape
+ ext_wcs.wcs.set()
apply_tdd2idc = classmethod(apply_tdd2idc)
- def set_alpha_beta(cls, wcs):
+ def set_alpha_beta(cls, ext_wcs):
"""
Compute the time dependent distortion skew terms
default date of 2004.5 = 2004-7-1
"""
dday = 2004.5
- year,month,day = wcs.date_obs.split('-')
+ year,month,day = ext_wcs.date_obs.split('-')
rdate = datetime.datetime(int(year),int(month),int(day))
rday = float(rdate.strftime("%j"))/365.25 + rdate.year
alpha = 0.095 + 0.090*(rday-dday)/2.5
@@ -89,18 +89,18 @@ class VACorr(object):
"""
- def updateWCS(cls, wcs, refwcs):
- if wcs.vafactor != 1:
- wcs.cd = wcs.cd * wcs.vafactor
- crval1 = wcs.crval[0]
- crval2 = wcs.crval[1]
- wcs.crval[0] = wcs.crval[0] + wcs.vafactor*diff_angles(wcs.crval[0], crval1)
- wcs.crval[1] = wcs.crval[1] + wcs.vafactor*diff_angles(wcs.crval[1], crval2)
+ def updateWCS(cls, ext_wcs, ref_wcs):
+ if ext_wcs.vafactor != 1:
+ ext_wcs.wcs.cd = ext_wcs.wcs.cd * ext_wcs.vafactor
+ crval1 = ext_wcs.wcs.crval[0]
+ crval2 = ext_wcs.wcs.crval[1]
+ ext_wcs.wcs.crval[0] = ext_wcs.wcs.crval[0] + ext_wcs.vafactor*diff_angles(ext_wcs.wcs.crval[0], crval1)
+ ext_wcs.wcs.crval[1] = ext_wcs.wcs.crval[1] + ext_wcs.vafactor*diff_angles(ext_wcs.wcs.crval[1], crval2)
- kw2update={'CD1_1': wcs.cd[0,0], 'CD1_2':wcs.cd[0,1],
- 'CD2_1':wcs.cd[1,0], 'CD2_2':wcs.cd[1,1],
- 'CRVAL1':wcs.crval[0], 'CRVAL2':wcs.crval[1]}
- wcs.set()
+ kw2update={'CD1_1': ext_wcs.wcs.cd[0,0], 'CD1_2':ext_wcs.wcs.cd[0,1],
+ 'CD2_1':ext_wcs.wcs.cd[1,0], 'CD2_2':ext_wcs.wcs.cd[1,1],
+ 'CRVAL1':ext_wcs.wcs.crval[0], 'CRVAL2':ext_wcs.wcs.crval[1]}
+ ext_wcs.wcs.set()
else:
pass
return kw2update
@@ -115,15 +115,15 @@ class CompSIP(object):
Compute SIP coefficients from idc table coefficients.
"""
- def updateWCS(cls, wcs, refwcs):
+ def updateWCS(cls, ext_wcs, ref_wcs):
kw2update = {}
- order = wcs.idcmodel.norder
+ order = ext_wcs.idcmodel.norder
kw2update['A_ORDER'] = order
kw2update['B_ORDER'] = order
- pscale = wcs.idcmodel.refpix['PSCALE']
+ pscale = ext_wcs.idcmodel.refpix['PSCALE']
- cx = wcs.idcmodel.cx
- cy = wcs.idcmodel.cy
+ cx = ext_wcs.idcmodel.cx
+ cy = ext_wcs.idcmodel.cy
matr = numpy.array([[cx[1,1],cx[1,0]], [cy[1,1],cy[1,0]]], dtype=numpy.float)
imatr = linalg.inv(matr)