summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordencheva <dencheva@stsci.edu>2009-02-05 13:13:57 -0500
committerdencheva <dencheva@stsci.edu>2009-02-05 13:13:57 -0500
commitcc6eb9ab94b41a2f5ab513d21971bc6bfaa036c4 (patch)
tree8d6d9cf46f663745f631d497e46dc40558774c47
parent0c06bf709697cfb06ed400a6e4d4d26112e4b3a9 (diff)
downloadstwcs_hcf-cc6eb9ab94b41a2f5ab513d21971bc6bfaa036c4.tar.gz
Added verison numbers and 'origin' kw to pywcs calls
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/development/trunk/updatewcs@7523 fe389314-cf27-0410-b35b-8c050e845b92
-rw-r--r--hstwcs/__init__.py1
-rwxr-xr-xhstwcs/alignwcs.py4
-rw-r--r--hstwcs/apply_corrections.py5
-rw-r--r--hstwcs/makewcs.py6
-rw-r--r--lib/__init__.py5
-rw-r--r--wcsutil/__init__.py2
6 files changed, 15 insertions, 8 deletions
diff --git a/hstwcs/__init__.py b/hstwcs/__init__.py
index 2d280c4..84f6cec 100644
--- a/hstwcs/__init__.py
+++ b/hstwcs/__init__.py
@@ -15,6 +15,7 @@ import apply_corrections
__docformat__ = 'restructuredtext'
+__version__ = '0.3'
def updatewcs(input, vacorr=True, tddcorr=True, dgeocorr=True, checkfiles=True):
"""
diff --git a/hstwcs/alignwcs.py b/hstwcs/alignwcs.py
index 9bdef8e..db96ef6 100755
--- a/hstwcs/alignwcs.py
+++ b/hstwcs/alignwcs.py
@@ -64,8 +64,8 @@ def apply_shifts(asndict, outwcs):
extver = extn.header['extver']
owcs = pywcs.WCS(extn.header, f)
crvals = np.array([owcs.wcs.crval])
- px = outwcs.wcs.s2p_fits(crvals)['pixcrd'] + shifts
- ncrvals = outwcs.all_pix2sky_fits(px)
+ px = outwcs.wcs.s2p(crvals, 1)['pixcrd'] + shifts
+ ncrvals = outwcs.all_pix2sky(px, 1)
pyfits.setval(filename, 'CRVAL1', value=ncrvals[0,0], ext=extver)
pyfits.setval(filename, 'CRVAL2', value=ncrvals[0,1], ext=extver)
print 'Updated %s with shifts ' % filename, shifts
diff --git a/hstwcs/apply_corrections.py b/hstwcs/apply_corrections.py
index 1a3b726..22dfbbc 100644
--- a/hstwcs/apply_corrections.py
+++ b/hstwcs/apply_corrections.py
@@ -97,8 +97,6 @@ def applyDgeoCorr(fname, udgeocorr):
print 'DGEO correction will not be applied\n'
applyDGEOCorr = False
return applyDGEOCorr
- if isOldStyleDGEO(fname, fdgeo0):
- applyDGEOCorr = False
try:
# get DGEOFILE kw from first extension header
fdgeo1 = pyfits.getval(fname, 'DGEOFILE', ext=1)
@@ -120,7 +118,8 @@ def applyDgeoCorr(fname, udgeocorr):
print 'DGEOFILE keyword not found in primary header'
applyDGEOCorr = False
-
+ if isOldStyleDGEO(fname, fdgeo0):
+ applyDGEOCorr = False
return (applyDGEOCorr and udgeocorr)
def isOldStyleDGEO(fname, dgname):
diff --git a/hstwcs/makewcs.py b/hstwcs/makewcs.py
index d016583..650d251 100644
--- a/hstwcs/makewcs.py
+++ b/hstwcs/makewcs.py
@@ -93,7 +93,7 @@ class MakeWCS(object):
dY=(off*cos(theta)) + offshifty
px = numpy.array([[dX,dY]])
- newcrval = ref_wcs.wcs.p2s_fits(px)['world'][0]
+ newcrval = ref_wcs.wcs.p2s(px, 1)['world'][0]
newcrpix = numpy.array([ext_wcs.idcmodel.refpix['XREF'] + ltvoffx,
ext_wcs.idcmodel.refpix['YREF'] + ltvoffy])
ext_wcs.wcs.crval = newcrval
@@ -116,7 +116,7 @@ class MakeWCS(object):
# Rotate the vectors
dxy = numpy.dot(rrmat, delmat)
- wc = ref_wcs.wcs.p2s_fits(px + dxy)['world']
+ wc = ref_wcs.wcs.p2s((px + dxy), 1)['world']
# Calculate the new CDs and convert to degrees
cd11 = utils.diff_angles(wc[0,0],newcrval[0])*cos(newcrval[1]*pi/180.0)
@@ -143,7 +143,7 @@ class MakeWCS(object):
rref = numpy.array([[ref_wcs.idcmodel.refpix['XREF']+ltvoffx ,
ref_wcs.idcmodel.refpix['YREF']+ltvoffy]])
- crval = ref_wcs.wcs.p2s_fits(rref)['world'][0]
+ crval = ref_wcs.wcs.p2s(rref, 1)['world'][0]
# Convert the PA_V3 orientation to the orientation at the aperture
# This is for the reference chip only - we use this for the
# reference tangent plane definition
diff --git a/lib/__init__.py b/lib/__init__.py
index 4f383fe..4c58e9b 100644
--- a/lib/__init__.py
+++ b/lib/__init__.py
@@ -8,3 +8,8 @@ from pytools import fileutil
DEGTORAD = fileutil.DEGTORAD
RADTODEG = fileutil.RADTODEG
+try:
+ import svn_version
+ __svn_version__ = svn_version.__svn_version__
+except ImportError:
+ __svn_version__ = 'Unable to determine SVN revision' \ No newline at end of file
diff --git a/wcsutil/__init__.py b/wcsutil/__init__.py
index 0f2e83d..b682032 100644
--- a/wcsutil/__init__.py
+++ b/wcsutil/__init__.py
@@ -14,6 +14,8 @@ from mappings import inst_mappings, ins_spec_kw
from mappings import basic_wcs, prim_hdr_kw
__docformat__ = 'restructuredtext'
+__version__ = '0.3'
+
class HSTWCS(WCS):
"""