summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordencheva <dencheva@stsci.edu>2013-04-17 13:10:50 -0400
committerdencheva <dencheva@stsci.edu>2013-04-17 13:10:50 -0400
commit182bb8fa28ca7df112e96019be60784ac502fd1a (patch)
tree3367ba8f81b0c73a53553cf1f3688e03f599d854
parent17348f6a47aef2c9fcbaf437df7e92d3b7c6827d (diff)
downloadstwcs_hcf-182bb8fa28ca7df112e96019be60784ac502fd1a.tar.gz
The update failed when a new idctab was provided because it tried to remove a WCS with wkey=' ' and wcsname=' '. Fixed. Also write the name of d2imfile used to the sci extension.
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stwcs/trunk@24315 fe389314-cf27-0410-b35b-8c050e845b92
-rw-r--r--lib/stwcs/updatewcs/__init__.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/stwcs/updatewcs/__init__.py b/lib/stwcs/updatewcs/__init__.py
index 7dbffbf..37ab6e3 100644
--- a/lib/stwcs/updatewcs/__init__.py
+++ b/lib/stwcs/updatewcs/__init__.py
@@ -119,8 +119,10 @@ def makecorr(fname, allowed_corr):
rwcs.readModel(update=True,header=f[nrefext].header)
if 'DET2IMCorr' in allowed_corr:
- det2im.DET2IMCorr.updateWCS(f)
-
+ kw2update = det2im.DET2IMCorr.updateWCS(f)
+ for kw in kw2update:
+ f[1].header.update(kw, kw2update[kw])
+
for i in range(len(f))[1:]:
extn = f[i]
@@ -319,8 +321,6 @@ def checkFiles(input):
newfiles.append(newfilename)
if removed_files:
logger.warning('\n\tThe following files will be removed from the list of files to be processed %s' % removed_files)
- #for f in removed_files:
- # print f
newfiles = checkFiles(newfiles)[0]
logger.info("\n\tThese files passed the input check and will be processed: %s" % newfiles)
@@ -345,6 +345,11 @@ def cleanWCS(fname):
# We are deleting all of them except the original OPUS WCS.nvalidates all WCS's.
f = pyfits.open(fname, mode='update')
keys = wcsutil.wcskeys(f[1].header)
+ # Remove the primary WCS from the list
+ try:
+ keys.remove(' ')
+ except ValueError:
+ pass
fext = range(len(f))
for key in keys:
wcsutil.deleteWCS(fname, ext=fext, wcskey=key)