summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordencheva <dencheva@stsci.edu>2011-08-19 12:28:32 -0400
committerdencheva <dencheva@stsci.edu>2011-08-19 12:28:32 -0400
commit707e9b522e7ac69ccf7bdd8e6795201f01c33f22 (patch)
treed75bcd3a940bb20feffc18418c34180124f1140d
parent01a72d0468f4d71876b20be05806efdd90f65f54 (diff)
downloadstwcs_hcf-707e9b522e7ac69ccf7bdd8e6795201f01c33f22.tar.gz
Cleaning the model.shift method
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci_python/trunk/stwcs@13641 fe389314-cf27-0410-b35b-8c050e845b92
-rw-r--r--lib/stwcs/distortion/models.py13
-rw-r--r--lib/stwcs/updatewcs/makewcs.py4
2 files changed, 9 insertions, 8 deletions
diff --git a/lib/stwcs/distortion/models.py b/lib/stwcs/distortion/models.py
index 96d5d72..db48a9f 100644
--- a/lib/stwcs/distortion/models.py
+++ b/lib/stwcs/distortion/models.py
@@ -63,7 +63,7 @@ class GeometryModel:
self.pscale = 1.0
- def shift(self,cx,cy,xs,ys):
+ def shift(self, xs, ys):
"""
Shift reference position of coefficients to new center
where (xs,ys) = old-reference-position - subarray/image center.
@@ -72,8 +72,8 @@ class GeometryModel:
to the reference position of the chip.
"""
- _cxs = np.zeros(shape=cx.shape,dtype=cx.dtype)
- _cys = np.zeros(shape=cy.shape,dtype=cy.dtype)
+ _cxs = np.zeros(shape=self.cx.shape,dtype=self.cx.dtype)
+ _cys = np.zeros(shape=self.cy.shape,dtype=self.cy.dtype)
_k = self.norder + 1
# loop over each input coefficient
for m in xrange(_k):
@@ -86,9 +86,10 @@ class GeometryModel:
_jlist = range(n, i - (m-n)+1)
# sum from n to i-(m-n)
for j in _jlist:
- _cxs[m,n] += cx[i,j]*combin(j,n)*combin((i-j),(m-n))*pow(xs,(j-n))*pow(ys,((i-j)-(m-n)))
- _cys[m,n] += cy[i,j]*combin(j,n)*combin((i-j),(m-n))*pow(xs,(j-n))*pow(ys,((i-j)-(m-n)))
- return _cxs,_cys
+ _cxs[m,n] += self.cx[i,j]*combin(j,n)*combin((i-j),(m-n))*pow(xs,(j-n))*pow(ys,((i-j)-(m-n)))
+ _cys[m,n] += self.cy[i,j]*combin(j,n)*combin((i-j),(m-n))*pow(xs,(j-n))*pow(ys,((i-j)-(m-n)))
+ self.cx = _cxs.copy()
+ self.cy = _cys.copy()
def convert(self, tmpname, xref=None,yref=None,delta=yes):
"""
diff --git a/lib/stwcs/updatewcs/makewcs.py b/lib/stwcs/updatewcs/makewcs.py
index 42bd3e6..0946b26 100644
--- a/lib/stwcs/updatewcs/makewcs.py
+++ b/lib/stwcs/updatewcs/makewcs.py
@@ -73,7 +73,7 @@ class MakeWCS(object):
if ltv1 != 0. or ltv2 != 0.:
offsetx = ext_wcs.wcs.crpix[0] - ltv1 - ext_wcs.idcmodel.refpix['XREF']
offsety = ext_wcs.wcs.crpix[1] - ltv2 - ext_wcs.idcmodel.refpix['YREF']
- ext_wcs.idcmodel.cx, ext_wcs.idcmodel.cy = ext_wcs.idcmodel.shift(ext_wcs.idcmodel.cx,ext_wcs.idcmodel.cy,offsetx,offsety)
+ ext_wcs.idcmodel.shift(offsetx,offsety)
fx, fy = ext_wcs.idcmodel.cx, ext_wcs.idcmodel.cy
@@ -142,7 +142,7 @@ class MakeWCS(object):
if ref_wcs.ltv1 != 0. or ref_wcs.ltv2 != 0.:
offsetx = ref_wcs.wcs.crpix[0] - ltv1 - ref_wcs.idcmodel.refpix['XREF']
offsety = ref_wcs.wcs.crpix[1] - ltv2 - ref_wcs.idcmodel.refpix['YREF']
- ref_wcs.idcmodel.cx, ref_wcs.idcmodel.cy = ref_wcs.idcmodel.shift(ref_wcs.idcmodel.cx,ref_wcs.idcmodel.cy,offsetx,offsety)
+ ref_wcs.idcmodel.shift(offsetx,offsety)
rfx, rfy = ref_wcs.idcmodel.cx, ref_wcs.idcmodel.cy