diff options
author | bsimon <bsimon@stsci.edu> | 2015-05-04 14:30:51 -0400 |
---|---|---|
committer | bsimon <bsimon@stsci.edu> | 2015-05-04 14:30:51 -0400 |
commit | 354c99daa69a8cc4eff3b081ec2c0cdce9df102c (patch) | |
tree | 16cd6d316dc1892952726e6aa5eb5abbad94ce5d /lib/stwcs/wcsutil/convertwcs.py | |
parent | a750294506fb6270c44b791928ab8d5630a22ca2 (diff) | |
download | stwcs_hcf-354c99daa69a8cc4eff3b081ec2c0cdce9df102c.tar.gz |
Updated files to run under python 2 and 3
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stwcs/trunk@39775 fe389314-cf27-0410-b35b-8c050e845b92
Diffstat (limited to 'lib/stwcs/wcsutil/convertwcs.py')
-rw-r--r-- | lib/stwcs/wcsutil/convertwcs.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/stwcs/wcsutil/convertwcs.py b/lib/stwcs/wcsutil/convertwcs.py index 7ece2a0..a384eb1 100644 --- a/lib/stwcs/wcsutil/convertwcs.py +++ b/lib/stwcs/wcsutil/convertwcs.py @@ -1,4 +1,4 @@ -from astropy.io import fits +from __future__ import print_function try: import stwcs from stwcs import wcsutil @@ -23,9 +23,9 @@ def archive_prefix_OPUS_WCS(fobj,extname='SCI'): """ if stwcs is None: - print '=====================' - print 'The STWCS package is needed to convert an old-style OPUS WCS to an alternate WCS' - print '=====================' + print('=====================') + print('The STWCS package is needed to convert an old-style OPUS WCS to an alternate WCS') + print('=====================') raise ImportError @@ -41,7 +41,7 @@ def archive_prefix_OPUS_WCS(fobj,extname='SCI'): numextn = fileutil.countExtn(fobj) extlist = [] - for e in xrange(1,numextn+1): + for e in range(1,numextn+1): extlist.append(('sci',e)) # Insure that the 'O' alternate WCS is present @@ -57,10 +57,10 @@ def archive_prefix_OPUS_WCS(fobj,extname='SCI'): # create HSTWCS object from PRIMARY WCS wcsobj = wcsutil.HSTWCS(fobj,ext=ext,wcskey='O') # get list of WCS keywords - wcskeys = wcsobj.wcs2header().keys() + wcskeys = list(wcsobj.wcs2header().keys()) # For each SCI extension... - for e in xrange(1,numextn+1): + for e in range(1,numextn+1): # Now, look for any WCS keywords with a prefix of 'O' for key in wcskeys: okey = 'O'+key[:7] @@ -98,7 +98,7 @@ def create_prefix_OPUS_WCS(fobj,extname='SCI'): else: # check to make sure this FITS obj has been opened in update mode if fobj.fileinfo(0)['filemode'] != 'update': - print 'File not opened with "mode=update". Quitting...' + print('File not opened with "mode=update". Quitting...') raise IOError # check for existance of O-prefix WCS @@ -108,7 +108,7 @@ def create_prefix_OPUS_WCS(fobj,extname='SCI'): numextn = fileutil.countExtn(fobj,extname=extname) if numextn == 0: extname = '' - for extn in xrange(1,numextn+1): + for extn in range(1,numextn+1): hdr = fobj[(extname,extn)].header for okey in owcskeys: hdr[okey] = hdr[okey[1:]+'O'] |