summaryrefslogtreecommitdiff
path: root/wcsutil/wcscorr.py
diff options
context:
space:
mode:
authorhack <hack@stsci.edu>2011-05-03 13:35:13 -0400
committerhack <hack@stsci.edu>2011-05-03 13:35:13 -0400
commit2907aea16f4f8242acfd7ac0209d3975c710a2a8 (patch)
tree908b5484ceb7819fa0e48bf6f6123ab1365302b4 /wcsutil/wcscorr.py
parent60bed196174249ac28b0e2d5428d5a2179d9f95a (diff)
downloadstwcs_hcf-2907aea16f4f8242acfd7ac0209d3975c710a2a8.tar.gz
This update to STWCS includes the following revisions:
- add EXTVER keyword to WCSCORR table extension in 'init_wcscorr()' - revised how pad rows are defined when creating a WCSCORR table - added logic to only work with NPOLFILE and D2IMFILE related keywords in input files that have been updated to use those reference files - added logic to only delete WCS's from IMAGE extensions to avoid problems of trying to delete a WCS from a table extension git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci_python/trunk/stwcs@12710 fe389314-cf27-0410-b35b-8c050e845b92
Diffstat (limited to 'wcsutil/wcscorr.py')
-rw-r--r--wcsutil/wcscorr.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/wcsutil/wcscorr.py b/wcsutil/wcscorr.py
index fae48ce..054626b 100644
--- a/wcsutil/wcscorr.py
+++ b/wcsutil/wcscorr.py
@@ -57,6 +57,7 @@ def init_wcscorr(input, force=False):
comment='Number of updated rows in table')
wcsext.header.update('EXTNAME', 'WCSCORR',
comment='Table with WCS Update history')
+ wcsext.header.update('EXTVER', 1)
used_wcskeys = None
wcs1 = stwcs.wcsutil.HSTWCS(fimg,ext=('SCI',1))
@@ -262,7 +263,7 @@ def update_wcscorr(dest, source=None, extname='SCI', wcs_id=None):
wcs_keys = [wcs_key] # We're only interested in this one
# create new table for hdr and populate it with the newly updated values
- new_table = create_wcscorr(numrows=len(wcs_keys) * numext)
+ new_table = create_wcscorr(numrows=numext, padding=numext)
old_table = dest['WCSCORR']
idx = -1
@@ -307,7 +308,7 @@ def update_wcscorr(dest, source=None, extname='SCI', wcs_id=None):
rowind = find_wcscorr_row(old_table.data, {'wcs_id':''})
old_nrows = np.where(rowind)[0][0]
new_nrows = new_table.data.shape[0]
-
+
# check to see if there is room for the new row
if (old_nrows + new_nrows) > old_table.data.shape[0]:
pad_rows = 5 * new_nrows
@@ -322,7 +323,7 @@ def update_wcscorr(dest, source=None, extname='SCI', wcs_id=None):
upd_table.data.field(name)[old_nrows:old_nrows + new_nrows] = \
new_table.data.field(name)
upd_table.header.update('TROWS', old_nrows + new_nrows)
-
+
# replace old extension with newly updated table extension
dest['WCSCORR'] = upd_table
@@ -425,6 +426,7 @@ def create_wcscorr(descrip=False, numrows=1, padding=0):
dtype='S'))
# create list of remaining columns to be added to table
col_list = [id_col, extver_col, wcskey_col] # start with selector columns
+
for c in col_names:
cdef = copy.deepcopy(c[1])
col_list.append(pyfits.Column(name=c[0], format=cdef['format'],