From 2d06201a0520014216d6e4e640a18e50c97f8999 Mon Sep 17 00:00:00 2001 From: sienkiew Date: Tue, 29 Jan 2013 22:36:48 +0000 Subject: fixing variable problems from import order git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stwcs/trunk@21885 fe389314-cf27-0410-b35b-8c050e845b92 --- lib/stwcs/updatewcs/__init__.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/stwcs/updatewcs/__init__.py b/lib/stwcs/updatewcs/__init__.py index 622ac35..7dbffbf 100644 --- a/lib/stwcs/updatewcs/__init__.py +++ b/lib/stwcs/updatewcs/__init__.py @@ -5,12 +5,8 @@ import pyfits import numpy as np from stwcs import wcsutil from stwcs.wcsutil import HSTWCS -from stwcs import __version__ as stwcsversion +import stwcs import pywcs -try: - from pywcs import __version__ as pywcsversion -except: - pywcsversion = 'UNKNOWN' import utils, corrections, makewcs import npol, det2im @@ -170,24 +166,24 @@ def makecorr(fname, allowed_corr): f[1].header.update(kw, kw2update[kw]) # Finally record the version of the software which updated the WCS if f[0].header.has_key('HISTORY'): - f[0].header.update(key='UPWCSVER', value=stwcsversion, + f[0].header.update(key='UPWCSVER', value=stwcs.__version__, comment="Version of STWCS used to updated the WCS", before='HISTORY') - f[0].header.update(key='PYWCSVER', value=pywcsversion, + f[0].header.update(key='PYWCSVER', value=pywcs.__version__, comment="Version of PYWCS used to updated the WCS", before='HISTORY') elif f[0].header.has_key('ASN_MTYP'): - f[0].header.update(key='UPWCSVER', value=stwcsversion, + f[0].header.update(key='UPWCSVER', value=stwcs.__version__, comment="Version of STWCS used to updated the WCS", after='ASN_MTYP') - f[0].header.update(key='PYWCSVER', value=pywcsversion, + f[0].header.update(key='PYWCSVER', value=pywcs.__version__, comment="Version of PYWCS used to updated the WCS", after='ASN_MTYP') else: # Find index of last non-blank card, and insert this new keyword after that card for i in range(len(f[0].header) - 1, 0, -1): if f[0].header[i].strip() != '': break - f[0].header.set('UPWCSVER', stwcsversion, + f[0].header.set('UPWCSVER', stwcs.__version__, "Version of STWCS used to updated the WCS", after=i) - f[0].header.set('PYWCSVER', pywcsversion, + f[0].header.set('PYWCSVER', pywcs.__version__, "Version of PYWCS used to updated the WCS", after=i) # add additional keywords to be used by headerlets -- cgit