summaryrefslogtreecommitdiff
path: root/wcsutil/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'wcsutil/__init__.py')
-rw-r--r--wcsutil/__init__.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/wcsutil/__init__.py b/wcsutil/__init__.py
index a4f4d31..e569291 100644
--- a/wcsutil/__init__.py
+++ b/wcsutil/__init__.py
@@ -28,7 +28,7 @@ class HSTWCS(WCS):
instrument specific attributes needed by the correction classes.
"""
- def __init__(self, input=None, ext=None, instrument=None, detector=None):
+ def __init__(self, fobj=None, ext=None, instrument=None, detector=None):
"""
:Parameters:
`fobj`: string or PyFITS HDUList object or None
@@ -49,9 +49,9 @@ class HSTWCS(WCS):
self.inst_kw = ins_spec_kw
if instrument == None:
- filename, hdr0, ehdr, fobj = self.parseInput(f=input, ext=ext)
+ filename, hdr0, ehdr, phdu = self.parseInput(f=fobj, ext=ext)
self.filename = filename
- WCS.__init__(self, ehdr, fobj=fobj)
+ WCS.__init__(self, ehdr, fobj=phdu)
self.setHDR0kw(hdr0, ehdr)
self.setInstrSpecKw(hdr0, ehdr)
self.setPscale()
@@ -70,7 +70,7 @@ class HSTWCS(WCS):
def parseInput(self, f=None, ext=None):
if isinstance(f, str):
# create an HSTWCS object from a filename
- fobj = pyfits.open(f)
+
if ext != None:
filename = f
extnum = ext
@@ -81,6 +81,7 @@ class HSTWCS(WCS):
extnum = 0
else:
extnum = fileutil.parseExtn(extname)
+ phdu = pyfits.open(filename)
hdr0 = pyfits.getheader(filename)
try:
ehdr = pyfits.getheader(filename, ext=extnum)
@@ -88,7 +89,7 @@ class HSTWCS(WCS):
print 'Unable to get extension %d. /n' % ext
elif isinstance(f, pyfits.HDUList):
- fobj = f
+ phdu = f
if ext == None:
extnum = 0
else:
@@ -97,7 +98,7 @@ class HSTWCS(WCS):
hdr0 = f[0].header
filename = hdr0.get('FILENAME', "")
- return filename, hdr0, ehdr, fobj
+ return filename, hdr0, ehdr, phdu
def setHDR0kw(self, primhdr, ehdr):
# Set attributes from kw defined in the primary header.