From 707e9b522e7ac69ccf7bdd8e6795201f01c33f22 Mon Sep 17 00:00:00 2001 From: dencheva Date: Fri, 19 Aug 2011 16:28:32 +0000 Subject: 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 --- lib/stwcs/distortion/models.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lib/stwcs/distortion/models.py') 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): """ -- cgit