diff options
-rw-r--r-- | distortion/models.py | 8 | ||||
-rw-r--r-- | distortion/mutil.py | 62 | ||||
-rw-r--r-- | updatewcs/corrections.py | 20 | ||||
-rw-r--r-- | updatewcs/dgeo.py | 2 |
4 files changed, 46 insertions, 46 deletions
diff --git a/distortion/models.py b/distortion/models.py index d4651fa..96d5d72 100644 --- a/distortion/models.py +++ b/distortion/models.py @@ -3,7 +3,7 @@ from __future__ import division # confidence high import types # Import PyDrizzle utility modules import mutil -import numpy as N +import numpy as np import mutil from mutil import combin @@ -72,8 +72,8 @@ class GeometryModel: to the reference position of the chip. """ - _cxs = N.zeros(shape=cx.shape,dtype=cx.dtype) - _cys = N.zeros(shape=cy.shape,dtype=cy.dtype) + _cxs = np.zeros(shape=cx.shape,dtype=cx.dtype) + _cys = np.zeros(shape=cy.shape,dtype=cy.dtype) _k = self.norder + 1 # loop over each input coefficient for m in xrange(_k): @@ -219,7 +219,7 @@ class GeometryModel: _cy[0,0] = 0. if isinstance(_p,types.ListType) or isinstance(_p,types.TupleType): - _p = N.array(_p,dtype=N.float64) + _p = np.array(_p,dtype=np.float64) _convert = yes dxy = _p - (self.refpix['XREF'],self.refpix['YREF']) diff --git a/distortion/mutil.py b/distortion/mutil.py index 5f17be9..44b46cd 100644 --- a/distortion/mutil.py +++ b/distortion/mutil.py @@ -1,7 +1,7 @@ from __future__ import division # confidence high from pytools import fileutil -import numpy as N +import numpy as np import string import calendar @@ -90,8 +90,8 @@ def readIDCtab (tabname, chip=1, date=None, direction='forward', else: order = norder - fx = N.zeros(shape=(order+1,order+1),dtype=N.float64) - fy = N.zeros(shape=(order+1,order+1),dtype=N.float64) + fx = np.zeros(shape=(order+1,order+1),dtype=np.float64) + fy = np.zeros(shape=(order+1,order+1),dtype=np.float64) #Determine row from which to get the coefficients. # How many rows do we have in the table... @@ -342,21 +342,21 @@ def readWCSCoeffs(header): _yorder = header['b_order'] order = max(max(_xorder,_yorder),3) - fx = N.zeros(shape=(order+1,order+1),dtype=N.float64) - fy = N.zeros(shape=(order+1,order+1),dtype=N.float64) + fx = np.zeros(shape=(order+1,order+1),dtype=np.float64) + fy = np.zeros(shape=(order+1,order+1),dtype=np.float64) # Read in CD matrix _cd11 = header['cd1_1'] _cd12 = header['cd1_2'] _cd21 = header['cd2_1'] _cd22 = header['cd2_2'] - _cdmat = N.array([[_cd11,_cd12],[_cd21,_cd22]]) - _theta = N.arctan2(-_cd12,_cd22) - _rotmat = N.array([[N.cos(_theta),N.sin(_theta)], - [-N.sin(_theta),N.cos(_theta)]]) - _rCD = N.dot(_rotmat,_cdmat) - _skew = N.arcsin(-_rCD[1][0] / _rCD[0][0]) - _scale = _rCD[0][0] * N.cos(_skew) * 3600. + _cdmat = np.array([[_cd11,_cd12],[_cd21,_cd22]]) + _theta = np.arctan2(-_cd12,_cd22) + _rotmat = np.array([[np.cos(_theta),np.sin(_theta)], + [-np.sin(_theta),np.cos(_theta)]]) + _rCD = np.dot(_rotmat,_cdmat) + _skew = np.arcsin(-_rCD[1][0] / _rCD[0][0]) + _scale = _rCD[0][0] * np.cos(_skew) * 3600. _scale2 = _rCD[1][1] * 3600. # Set up refpix @@ -440,17 +440,17 @@ def readTraugerTable(idcfile,wavelength): # Now, convert the coefficients into a Numeric array # with the right coefficients in the right place. # Populate output values now... - fx = N.zeros(shape=(order+1,order+1),dtype=N.float64) - fy = N.zeros(shape=(order+1,order+1),dtype=N.float64) + fx = np.zeros(shape=(order+1,order+1),dtype=np.float64) + fy = np.zeros(shape=(order+1,order+1),dtype=np.float64) # Assign the coefficients to their array positions fx[0,0] = 0. - fx[1] = N.array([a_coeffs[2],a_coeffs[1],0.,0.],dtype=N.float64) - fx[2] = N.array([a_coeffs[5],a_coeffs[4],a_coeffs[3],0.],dtype=N.float64) - fx[3] = N.array([a_coeffs[9],a_coeffs[8],a_coeffs[7],a_coeffs[6]],dtype=N.float64) + fx[1] = np.array([a_coeffs[2],a_coeffs[1],0.,0.],dtype=np.float64) + fx[2] = np.array([a_coeffs[5],a_coeffs[4],a_coeffs[3],0.],dtype=np.float64) + fx[3] = np.array([a_coeffs[9],a_coeffs[8],a_coeffs[7],a_coeffs[6]],dtype=np.float64) fy[0,0] = 0. - fy[1] = N.array([b_coeffs[2],b_coeffs[1],0.,0.],dtype=N.float64) - fy[2] = N.array([b_coeffs[5],b_coeffs[4],b_coeffs[3],0.],dtype=N.float64) - fy[3] = N.array([b_coeffs[9],b_coeffs[8],b_coeffs[7],b_coeffs[6]],dtype=N.float64) + fy[1] = np.array([b_coeffs[2],b_coeffs[1],0.,0.],dtype=np.float64) + fy[2] = np.array([b_coeffs[5],b_coeffs[4],b_coeffs[3],0.],dtype=np.float64) + fy[3] = np.array([b_coeffs[9],b_coeffs[8],b_coeffs[7],b_coeffs[6]],dtype=np.float64) # Used in Pattern.computeOffsets() refpix = {} @@ -517,17 +517,17 @@ def readCubicTable(idcfile): # Now, convert the coefficients into a Numeric array # with the right coefficients in the right place. # Populate output values now... - fx = N.zeros(shape=(order+1,order+1),dtype=N.float64) - fy = N.zeros(shape=(order+1,order+1),dtype=N.float64) + fx = np.zeros(shape=(order+1,order+1),dtype=np.float64) + fy = np.zeros(shape=(order+1,order+1),dtype=np.float64) # Assign the coefficients to their array positions fx[0,0] = 0. - fx[1] = N.array([a_coeffs[2],a_coeffs[1],0.,0.],dtype=N.float64) - fx[2] = N.array([a_coeffs[5],a_coeffs[4],a_coeffs[3],0.],dtype=N.float64) - fx[3] = N.array([a_coeffs[9],a_coeffs[8],a_coeffs[7],a_coeffs[6]],dtype=N.float64) + fx[1] = np.array([a_coeffs[2],a_coeffs[1],0.,0.],dtype=np.float64) + fx[2] = np.array([a_coeffs[5],a_coeffs[4],a_coeffs[3],0.],dtype=np.float64) + fx[3] = np.array([a_coeffs[9],a_coeffs[8],a_coeffs[7],a_coeffs[6]],dtype=np.float64) fy[0,0] = 0. - fy[1] = N.array([b_coeffs[2],b_coeffs[1],0.,0.],dtype=N.float64) - fy[2] = N.array([b_coeffs[5],b_coeffs[4],b_coeffs[3],0.],dtype=N.float64) - fy[3] = N.array([b_coeffs[9],b_coeffs[8],b_coeffs[7],b_coeffs[6]],dtype=N.float64) + fy[1] = np.array([b_coeffs[2],b_coeffs[1],0.,0.],dtype=np.float64) + fy[2] = np.array([b_coeffs[5],b_coeffs[4],b_coeffs[3],0.],dtype=np.float64) + fy[3] = np.array([b_coeffs[9],b_coeffs[8],b_coeffs[7],b_coeffs[6]],dtype=np.float64) # Used in Pattern.computeOffsets() refpix = {} @@ -561,8 +561,8 @@ def defaultModel(): """ order = 3 - fx = N.zeros(shape=(order+1,order+1),dtype=N.float64) - fy = N.zeros(shape=(order+1,order+1),dtype=N.float64) + fx = np.zeros(shape=(order+1,order+1),dtype=np.float64) + fy = np.zeros(shape=(order+1,order+1),dtype=np.float64) fx[1,1] = 1. fy[1,0] = 1. @@ -588,7 +588,7 @@ def defaultModel(): # the specified wavelength for use with Trauger coefficients def _MgF2(lam): _sig = pow((1.0e7/lam),2) - return N.sqrt(1.0 + 2.590355e10/(5.312993e10-_sig) + + return np.sqrt(1.0 + 2.590355e10/(5.312993e10-_sig) + 4.4543708e9/(11.17083e9-_sig) + 4.0838897e5/(1.766361e5-_sig)) diff --git a/updatewcs/corrections.py b/updatewcs/corrections.py index 6709664..b20fc3f 100644 --- a/updatewcs/corrections.py +++ b/updatewcs/corrections.py @@ -1,7 +1,7 @@ from __future__ import division # confidence high import datetime -import numpy +import numpy as np from numpy import linalg from pytools import fileutil from stwcs.utils import diff_angles @@ -56,11 +56,11 @@ class TDDCorr(object): theta_v2v3 = 2.234529 mrotp = fileutil.buildRotMatrix(theta_v2v3) mrotn = fileutil.buildRotMatrix(-theta_v2v3) - 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) + tdd_mat = np.array([[1+(beta/2048.), alpha/2048.],[alpha/2048.,1-(beta/2048.)]],np.float64) + abmat1 = np.dot(tdd_mat, mrotn) + abmat2 = np.dot(mrotp,abmat1) xshape, yshape = hwcs.idcmodel.cx.shape, hwcs.idcmodel.cy.shape - icxy = numpy.dot(abmat2,[hwcs.idcmodel.cx.ravel(), hwcs.idcmodel.cy.ravel()]) + icxy = np.dot(abmat2,[hwcs.idcmodel.cx.ravel(), hwcs.idcmodel.cy.ravel()]) hwcs.idcmodel.cx = icxy[0] hwcs.idcmodel.cy = icxy[1] hwcs.idcmodel.cx.shape = xshape @@ -127,15 +127,15 @@ class CompSIP(object): 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) + matr = np.array([[cx[1,1],cx[1,0]], [cy[1,1],cy[1,0]]], dtype=np.float) imatr = linalg.inv(matr) - akeys1 = numpy.zeros((order+1,order+1), dtype=numpy.float) - bkeys1 = numpy.zeros((order+1,order+1), dtype=numpy.float) + akeys1 = np.zeros((order+1,order+1), dtype=np.float) + bkeys1 = np.zeros((order+1,order+1), dtype=np.float) for n in range(order+1): for m in range(order+1): if n >= m and n>=2: - idcval = numpy.array([[cx[n,m]],[cy[n,m]]]) - sipval = numpy.dot(imatr, idcval) + idcval = np.array([[cx[n,m]],[cy[n,m]]]) + sipval = np.dot(imatr, idcval) akeys1[m,n-m] = sipval[0] bkeys1[m,n-m] = sipval[1] Akey="A_%d_%d" % (m,n-m) diff --git a/updatewcs/dgeo.py b/updatewcs/dgeo.py index bed3191..11562ef 100644 --- a/updatewcs/dgeo.py +++ b/updatewcs/dgeo.py @@ -130,7 +130,7 @@ class DGEOCorr(object): values = {cperror: 0.0, cpdis: 'Lookup', dpext: wdvarr_ver, dpnaxes: 2, dpaxis1: 1, dpaxis2: 2} - comments = {cperror: 'Maximum error of dgeo correction for axis %s' % (wdvarr_ver//2 + 1), + comments = {cperror: 'Maximum error of dgeo correction for axis %s' % j, cpdis: 'Prior distortion funcion type', dpext: 'Version number of WCSDVARR extension containing lookup distortion table', dpnaxes: 'Number of independent variables in distortion function', |