From 8f3235bba033064c7f212fbffbb58afca3414c10 Mon Sep 17 00:00:00 2001 From: hack Date: Mon, 30 Jan 2012 16:15:02 +0000 Subject: Revised 'wcscorr.init_wcscorr()' to generate an initial table with enough rows to accomodate all WCS solutions recorded in input image header. git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci_python/trunk/stwcs@14690 fe389314-cf27-0410-b35b-8c050e845b92 --- lib/stwcs/wcsutil/wcscorr.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/stwcs/wcsutil') diff --git a/lib/stwcs/wcsutil/wcscorr.py b/lib/stwcs/wcsutil/wcscorr.py index 7c5b387..7dd8578 100644 --- a/lib/stwcs/wcsutil/wcscorr.py +++ b/lib/stwcs/wcsutil/wcscorr.py @@ -51,14 +51,17 @@ def init_wcscorr(input, force=False): else: del fimg['wcscorr'] print 'Initializing new WCSCORR table for ',fimg.filename() + + used_wcskeys = altwcs.wcskeys(fimg['SCI', 1].header) # define the primary columns of the WCSEXT table with initial rows for each # SCI extension for the original OPUS solution numsci = fileutil.countExtn(fimg) + numwcs = len(used_wcskeys) # create new table with more rows than needed initially to make it easier to # add new rows later - wcsext = create_wcscorr(descrip=True,numrows=numsci, padding=numsci * 4) + wcsext = create_wcscorr(descrip=True,numrows=numsci, padding=(numsci*numwcs) + numsci * 4) # Assign the correct EXTNAME value to this table extension wcsext.header.update('TROWS', numsci * 2, comment='Number of updated rows in table') @@ -67,7 +70,6 @@ def init_wcscorr(input, force=False): wcsext.header.update('EXTVER', 1) # define set of WCS keywords which need to be managed and copied to the table - used_wcskeys = altwcs.wcskeys(fimg['SCI', 1].header) wcs1 = stwcs.wcsutil.HSTWCS(fimg,ext=('SCI',1)) idc2header = True if wcs1.idcscale is None: -- cgit