From c3a8a79697b724cb51c955c0f52046036f7f6139 Mon Sep 17 00:00:00 2001 From: hack Date: Tue, 15 Nov 2011 21:37:46 +0000 Subject: Fixes a bug in the creation of headerlets without NPOLFILE or D2IMFILE. This was found by Ray when running 'tweakreg' on ACS/HRC data, with the problem and subsequent fix being verified using ACS/HRC dither box data. git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci_python/trunk/stwcs@14014 fe389314-cf27-0410-b35b-8c050e845b92 --- lib/stwcs/updatewcs/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/stwcs/updatewcs/utils.py') diff --git a/lib/stwcs/updatewcs/utils.py b/lib/stwcs/updatewcs/utils.py index 460ddb3..4a00fb2 100644 --- a/lib/stwcs/updatewcs/utils.py +++ b/lib/stwcs/updatewcs/utils.py @@ -69,7 +69,7 @@ def construct_distname(fobj,wcsobj): """ idcname = extract_rootname(fobj[0].header.get('IDCTAB', "NONE"), suffix='_idc') - if idcname is None and wcsobj.sip is not None: + if (idcname is None or idcname=='NONE') and wcsobj.sip is not None: idcname = 'UNKNOWN' npolname = build_npolname(fobj) @@ -122,6 +122,8 @@ def build_sipname(fobj): def build_npolname(fobj): try: npolfile = extract_rootname(fobj[0].header["NPOLFILE"],suffix='_npl') + if npolfile == 'NONE': + npolfile = 'NOMODEL' except KeyError: if fileutil.countExtn(fobj, 'WCSDVARR'): npolfile = 'UNKNOWN' @@ -132,6 +134,8 @@ def build_npolname(fobj): def build_d2imname(fobj): try: d2imfile = extract_rootname(fobj[0].header["D2IMFILE"],suffix='_d2i') + if d2imfile == 'NONE': + d2imfile = 'NOMODEL' except KeyError: if fileutil.countExtn(fobj, 'D2IMARR'): d2imfile = 'UNKNOWN' -- cgit