summaryrefslogtreecommitdiff
path: root/updatewcs/det2im.py
diff options
context:
space:
mode:
authordencheva <dencheva@stsci.edu>2009-10-13 17:17:15 -0400
committerdencheva <dencheva@stsci.edu>2009-10-13 17:17:15 -0400
commit89d2a4afc0c4961baaa1ce47354f544ffc02f942 (patch)
tree2b279359d90399d1c0f05686acda754a6850b651 /updatewcs/det2im.py
parenta4d8cb52c1bc7649b13c292eb56f2059f38cfc95 (diff)
downloadstwcs_hcf-89d2a4afc0c4961baaa1ce47354f544ffc02f942.tar.gz
Changes to the WCSDVARR extension header which allow mapping of the dgeo table to image coordinates when the science image is a subarray.
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci_python/trunk/stwcs@8334 fe389314-cf27-0410-b35b-8c050e845b92
Diffstat (limited to 'updatewcs/det2im.py')
-rw-r--r--updatewcs/det2im.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/updatewcs/det2im.py b/updatewcs/det2im.py
index 90fe339..c8e9ab8 100644
--- a/updatewcs/det2im.py
+++ b/updatewcs/det2im.py
@@ -42,8 +42,8 @@ class DET2IMCorr(object):
getAxisCorr = classmethod(getAxisCorr)
def applyDet2ImCorr(cls,fobj, axiscorr):
- d2imfile = fileutil.osfn(fobj[0].header['D2IMFILE'])
- hdu = cls.createDgeoHDU(d2imfile, axiscorr)
+
+ hdu = cls.createDgeoHDU(fobj, axiscorr)
d2imarr_ind = cls.getD2imIndex(fobj)
if d2imarr_ind:
fobj[d2imarr_ind] = hdu
@@ -63,30 +63,32 @@ class DET2IMCorr(object):
return index
getD2imIndex = classmethod(getD2imIndex)
- def createDgeoHDU(cls, d2imfile, axiscorr):
-
+ def createDgeoHDU(cls, fobj, axiscorr):
+ d2imfile = fileutil.osfn(fobj[0].header['D2IMFILE'])
d2im_data = pyfits.getdata(d2imfile, ext=1)
- d2im_hdr = cls.createDet2ImHdr(d2im_data.shape, axiscorr)
+ sci_hdr = fobj['sci',1].header
+ d2im_hdr = cls.createDet2ImHdr(sci_hdr, d2im_data.shape, axiscorr)
hdu = pyfits.ImageHDU(header=d2im_hdr, data=d2im_data)
return hdu
createDgeoHDU = classmethod(createDgeoHDU)
- def createDet2ImHdr(cls, data_shape, axiscorr):
+ def createDet2ImHdr(cls, sci_hdr, data_shape, axiscorr):
"""
Creates a header for the D2IMARR extension based on the
reference file recorded in D2IMFILE keyword in the primary header.
"""
-
+ ltv1 = sci_hdr.get('LTV1', 0.0)
+ ltv2 = sci_hdr.get('LTV2', 0.0)
naxis1 = data_shape[0]
naxis2 = 0
crpix1 = 0.0
crpix2 = 0.0
cdelt1 = 1.0
cdelt2 = 1.0
- crval1 = 0.0
- crval2 = 0.0
+ crval1 = 0.0 + ltv1
+ crval2 = 0.0 + ltv2
keys = ['XTENSION','BITPIX','NAXIS','NAXIS1','NAXIS2',
'EXTNAME','EXTVER','PCOUNT','GCOUNT','CRPIX1',
'CDELT1','CRVAL1','CRPIX2','CDELT2','CRVAL2', 'AXISCORR']