summaryrefslogtreecommitdiff
path: root/wcsutil/getinput.py
diff options
context:
space:
mode:
authorembray <embray@stsci.edu>2011-06-22 19:24:07 -0400
committerembray <embray@stsci.edu>2011-06-22 19:24:07 -0400
commitd93a10017d62f39d80167b45c1044a5e113f5994 (patch)
tree07967ea82a8550f8a8423bbe30046e798cf6c98e /wcsutil/getinput.py
parent708b4f32ac133fdb6157ec6e243dc76e32f9a84b (diff)
downloadstwcs_hcf-d93a10017d62f39d80167b45c1044a5e113f5994.tar.gz
Redoing the r13221-13223 merge in the actual trunk now. This updates trunk to the setup_refactoring branch (however, coords, pysynphot, and pywcs are still being pulled from the astrolib setup_refactoring branch. Will have to do that separately then update the svn:externals)
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci_python/trunk/stwcs@13225 fe389314-cf27-0410-b35b-8c050e845b92
Diffstat (limited to 'wcsutil/getinput.py')
-rw-r--r--wcsutil/getinput.py62
1 files changed, 0 insertions, 62 deletions
diff --git a/wcsutil/getinput.py b/wcsutil/getinput.py
deleted file mode 100644
index a2d9781..0000000
--- a/wcsutil/getinput.py
+++ /dev/null
@@ -1,62 +0,0 @@
-import pyfits
-from pytools import irafglob, fileutil, parseinput
-
-def parseSingleInput(f=None, ext=None):
- if isinstance(f, str):
- # create an HSTWCS object from a filename
- if ext != None:
- filename = f
- if isinstance(ext,tuple):
- if ext[0] == '':
- extnum = ext[1] # handle ext=('',1)
- else:
- extnum = ext
- else:
- extnum = int(ext)
- elif ext == None:
- filename, ext = fileutil.parseFilename(f)
- ext = fileutil.parseExtn(ext)
- if ext[0] == '':
- extnum = int(ext[1]) #handle ext=('',extnum)
- else:
- extnum = ext
- phdu = pyfits.open(filename)
- hdr0 = pyfits.getheader(filename)
- try:
- ehdr = pyfits.getheader(filename, ext=extnum)
- except (IndexError,KeyError):
- print 'Unable to get extension.', extnum
- raise
-
- elif isinstance(f, pyfits.HDUList):
- phdu = f
- if ext == None:
- extnum = 0
- else:
- extnum = ext
- ehdr = f[extnum].header
- hdr0 = f[0].header
- filename = hdr0.get('FILENAME', "")
-
- else:
- raise ValueError('Input must be a file name string or a pyfits file object')
-
- return filename, hdr0, ehdr, phdu
-
-
-def parseMultipleInput(input):
- if isinstance(input, str):
- if input[0] == '@':
- # input is an @ file
- filelist = irafglob.irafglob(input)
- else:
- try:
- filelist, output = parseinput.parseinput(input)
- except IOError: raise
- elif isinstance(input, list):
- if isinstance(input[0], wcsutil.HSTWCS):
- # a list of HSTWCS objects
- return input
- else:
- filelist = input[:]
- return filelist \ No newline at end of file