summaryrefslogtreecommitdiff
path: root/lib/stwcs/updatewcs/utils.py
diff options
context:
space:
mode:
authorhack <hack@stsci.edu>2014-05-23 16:05:51 -0400
committerhack <hack@stsci.edu>2014-05-23 16:05:51 -0400
commit664676db3ae5fb278b8026e5d90834dd6aced4aa (patch)
treeb100b622208771ec29116123c69ea22e6a42e080 /lib/stwcs/updatewcs/utils.py
parent3e30b1900c4181ca0091bc887c677efd7e7f7df4 (diff)
downloadstwcs_hcf-664676db3ae5fb278b8026e5d90834dd6aced4aa.tar.gz
STWCS v1.2.1: This version fixes a typo in altwcs._restore(), adds TDD_CYA and TDD_CYB as new header keywords for 2014 TDD correction, and updated _restore() to reset those keywords to 0.0 everytime so that if TDDCORR=OMIT, it will be obvious.
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stwcs/trunk@31920 fe389314-cf27-0410-b35b-8c050e845b92
Diffstat (limited to 'lib/stwcs/updatewcs/utils.py')
-rw-r--r--lib/stwcs/updatewcs/utils.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/stwcs/updatewcs/utils.py b/lib/stwcs/updatewcs/utils.py
index 7bdd6fe..e5f4deb 100644
--- a/lib/stwcs/updatewcs/utils.py
+++ b/lib/stwcs/updatewcs/utils.py
@@ -137,8 +137,10 @@ def build_sipname(fobj, fname=None, sipname=None):
"""
try:
idctab = fobj[0].header['IDCTAB']
+ idcname = extract_rootname(idctab,suffix='_idc')
except KeyError:
idctab = 'N/A'
+ idcname= 'N/A'
if not fname:
try:
fname = fobj.filename()
@@ -147,15 +149,16 @@ def build_sipname(fobj, fname=None, sipname=None):
if not sipname:
try:
sipname = fobj[0].header["SIPNAME"]
+ if idcname == 'N/A' or idcname not in sipname:
+ raise KeyError
except KeyError:
- try:
- idcname = extract_rootname(fobj[0].header["IDCTAB"],suffix='_idc')
+ if idcname != 'N/A':
try:
rootname = fobj[0].header['rootname']
except KeyError:
rootname = fname
sipname = rootname +'_'+ idcname
- except KeyError:
+ else:
if 'A_ORDER' in fobj[1].header or 'B_ORDER' in fobj[1].header:
sipname = 'UNKNOWN'
else: