summaryrefslogtreecommitdiff
path: root/lib/stwcs/wcsutil/headerlet.py
diff options
context:
space:
mode:
authorhack <hack@stsci.edu>2013-08-28 16:19:06 -0400
committerhack <hack@stsci.edu>2013-08-28 16:19:06 -0400
commit8c221f5690af65370273647e3d2a0c5da02c060d (patch)
tree8b7db26b5b6b9f914662d5a44e75b67bbf46b33f /lib/stwcs/wcsutil/headerlet.py
parent9e0a421a1940d081192046938df10aee8aec6819 (diff)
downloadstwcs_hcf-8c221f5690af65370273647e3d2a0c5da02c060d.tar.gz
Problems with using apply_headerlet_as_primary() on WFPC2 data have been corrected in this revision. These included counting the D2IM arrays correctly and eliminating a typo for a variable. These changes were tested using both a WFPC2 image and the same ACS image that demonstrated the previous bug.
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stwcs/trunk@26500 fe389314-cf27-0410-b35b-8c050e845b92
Diffstat (limited to 'lib/stwcs/wcsutil/headerlet.py')
-rw-r--r--lib/stwcs/wcsutil/headerlet.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/stwcs/wcsutil/headerlet.py b/lib/stwcs/wcsutil/headerlet.py
index 14e00c6..f349fa5 100644
--- a/lib/stwcs/wcsutil/headerlet.py
+++ b/lib/stwcs/wcsutil/headerlet.py
@@ -1906,7 +1906,10 @@ class Headerlet(pyfits.HDUList):
if 'D2IM2.EXTVER' in priwcs[0].header:
priwcs[0].header['D2IM2.EXTVER'] = self[('SIPWCS', i)].header['D2IM2.EXTVER']
priwcs[('D2IMARR', 2)].header['EXTVER'] = self[('SIPWCS', i)].header['D2IM2.EXTVER']
- numd2im = 2
+ # D2IM1 will NOT exist for WFPC2 data...
+ if 'D2IM1.EXTVER' in priwcs[0].header:
+ # only set number of D2IM extensions to 2 if D2IM1 exists
+ numd2im = 2
if sipwcs.cpdis1 or sipwcs.cpdis2:
try:
@@ -1940,7 +1943,7 @@ class Headerlet(pyfits.HDUList):
whdu.update_ext_version(self[('SIPWCS', i)].header['D2IM1.EXTVER'])
fobj.append(whdu)
if sipwcs.det2im2:
- whdu = priwcs[('D2IMARR', i*num2dim)].copy()
+ whdu = priwcs[('D2IMARR', i*numd2im)].copy()
whdu.update_ext_version(self[('SIPWCS', i)].header['D2IM2.EXTVER'])
fobj.append(whdu)