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/mosaic.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/mosaic.py')
| -rw-r--r-- | lib/stwcs/wcsutil/mosaic.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/stwcs/wcsutil/mosaic.py b/lib/stwcs/wcsutil/mosaic.py index 7efefc3..9d2d0a3 100644 --- a/lib/stwcs/wcsutil/mosaic.py +++ b/lib/stwcs/wcsutil/mosaic.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, print_function import numpy as np from matplotlib import pyplot as plt from astropy.io import fits @@ -86,10 +86,10 @@ def updatehdr(fname, wcsobj, wkey, wcsname, ext=1, clobber=False): hdr = fits.getheader(fname, ext=ext) all_keys = list(string.ascii_uppercase) if wkey.upper() not in all_keys: - raise KeyError, "wkey must be one character: A-Z" + raise KeyError("wkey must be one character: A-Z") if wkey not in altwcs.available_wcskeys(hdr): if not clobber: - raise ValueError, "wkey %s is already in use. Use clobber=True to overwrite it or specify a different key." %wkey + raise ValueError("wkey %s is already in use. Use clobber=True to overwrite it or specify a different key." %wkey) else: altwcs.deleteWCS(fname, ext=ext, wcskey='V') f = fits.open(fname, mode='update') @@ -97,7 +97,7 @@ def updatehdr(fname, wcsobj, wkey, wcsname, ext=1, clobber=False): hwcs = wcs2header(wcsobj) wcsnamekey = 'WCSNAME' + wkey f[ext].header[wcsnamekey] = wcsname - for k in hwcs.keys(): + for k in hwcs: f[ext].header[k[:7]+wkey] = hwcs[k] f.close() @@ -164,17 +164,17 @@ def readWCS(input, exts=None, extname=None): continue fobj.close() if fomited != []: - print "These files were skipped:" + print("These files were skipped:") for f in fomited: - print f + print(f) return wcso def validateExt(ext): if not isinstance(ext, int) and not isinstance(ext, tuple) \ and not isinstance(ext, list): - print "Ext must be integer, tuple, a list of int extension numbers, \ - or a list of tuples representing a fits extension, for example ('sci', 1)." + print("Ext must be integer, tuple, a list of int extension numbers, \ + or a list of tuples representing a fits extension, for example ('sci', 1).") return False else: return True |
