本文整理汇总了Python中stsci.tools.parseinput.parseinput函数的典型用法代码示例。如果您正苦于以下问题:Python parseinput函数的具体用法?Python parseinput怎么用?Python parseinput使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parseinput函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: run
def run(configObj=None):
# start by interpreting filename and hdrlet inputs
filename = parseinput.parseinput(configObj['filename'])[0]
hdrlet = parseinput.parseinput(configObj['hdrlet'])[0]
if configObj['primary']:
# Call function with properly interpreted input parameters
# Syntax: apply_headerlet_as_primary(filename, hdrlet, attach=True,
# archive=True, force=False, verbose=False)
headerlet.apply_headerlet_as_primary(filename,
hdrlet, attach=configObj['attach'],
archive=configObj['archive'], force=configObj['force'],
logging=configObj['logging'])
else:
wcsname = configObj['wcsname']
if wcsname in ['', ' ', 'INDEF']: wcsname = None
wcskey = configObj['wcskey']
if wcskey == '': wcskey = None
# Call function with properly interpreted input parameters
# apply_headerlet_as_alternate(filename, hdrlet, attach=True,
# wcskey=None, wcsname=None, verbose=False)
headerlet.apply_headerlet_as_alternate(filename,
hdrlet, attach=configObj['attach'],
wcsname=wcsname, wcskey=wcskey,
logging=configObj['logging'])
开发者ID:jhunkeler,项目名称:stwcs,代码行数:26,代码来源:apply_headerlet.py
示例2: wf3ccd
def wf3ccd(input, output="", dqicorr="PERFORM", atodcorr="PERFORM",blevcorr="PERFORM",
biascorr="PERFORM", flashcorr="PERFORM", verbose=False, quiet=True ):
"""Run the ``wf3ccd.e`` executable as from the shell."""
call_list = ['wf3ccd.e']
if verbose:
call_list += ['-v','-t']
if (dqicorr == "PERFORM"):
call_list.append('-dqi')
if (atodcorr == "PERFORM"):
call_list.append('-atod')
if (blevcorr == "PERFORM"):
call_list.append('-blev')
if (biascorr == "PERFORM"):
call_list.append('-bias')
if (flashcorr == "PERFORM"):
call_list.append('-flash')
infiles, dummpy_out= parseinput.parseinput(input)
call_list.append(','.join(infiles))
call_list.append(str(output))
subprocess.call(call_list)
开发者ID:josePhoenix,项目名称:wfc3tools,代码行数:29,代码来源:wf3ccd.py
示例3: wf32d
def wf32d(input, output="", dqicorr="PERFORM", darkcorr="PERFORM",flatcorr="PERFORM",
shadcorr="PERFORM", photcorr="PERFORM", verbose=False, quiet=True ):
""" Call the wf32d.e executable """
if verbose:
call_list += ['-v','-t']
if debug:
call_list.append('-d')
if (darkcorr == "PERFORM"):
call_list.append('-dark')
if (dqicorr == "PERFORM"):
call_list.append('-dqi')
if (flatcorr == "PERFORM"):
call_list.append('-flat')
if (shadcorr == "PERFORM"):
call_list.append('-shad')
if (photcorr == "PERFORM"):
call_list.append('-phot')
infiles, dummpy_out= parseinput.parseinput(input)
call_list.append(','.join(infiles))
call_list.append(str(output))
subprocess.call(call_list)
开发者ID:josePhoenix,项目名称:wfc3tools,代码行数:31,代码来源:wf32d.py
示例4: wf3cte
def wf3cte(input, out=None, parallel=True, verbose=False, log_func=print):
"""Run the ``wf3cte.e`` executable as from the shell."""
call_list = ['wf3cte.e']
if verbose:
call_list.append('-v')
if not parallel:
call_list.append('-1')
infiles, dummy_out = parseinput.parseinput(input)
call_list.append(','.join(infiles))
if out:
call_list.append(str(out))
print(call_list)
proc = subprocess.Popen(
call_list,
stderr=subprocess.STDOUT,
stdout=subprocess.PIPE,
)
if log_func is not None:
for line in proc.stdout:
log_func(line.decode('utf8'))
return_code = proc.wait()
if return_code != 0:
raise RuntimeError("wf3cte.e exited with code {}".format(return_code))
开发者ID:sosey,项目名称:wfc3tools,代码行数:31,代码来源:wf3cte.py
示例5: acssum
def acssum(input, output, exec_path='', time_stamps=False, verbose=False,
quiet=False):
"""
Run the acssum.e executable as from the shell.
Parameters
----------
input : str or list of str
Input filenames in one of these formats:
* a Python list of filenames
* a partial filename with wildcards ('\*flt.fits')
* filename of an ASN table ('j12345670_asn.fits')
* an at-file (``@input``)
output : str
Output filename.
If `output` is '' and `input` is '\*_asn.fits',
`output` will be automatically set to '\*_sfl.fits'.
Otherwise, it is an error not to provide a specific `output`.
exec_path : str, optional
The complete path to ACSSUM executable.
If not given, run ACSSUM given by 'acssum.e'.
time_stamps : bool, optional
Set to True to turn on the printing of time stamps.
verbose : bool, optional
Set to True for verbose output.
quiet : bool, optional
Set to True for quiet output.
"""
if exec_path:
if not os.path.exists(exec_path):
raise OSError('Executable not found: ' + exec_path)
call_list = [exec_path]
else:
call_list = ['acssum.e']
# Parse input to get list of filenames to process.
# acssum.e only takes 'file1,file2,...'
infiles, dummy_out = parseinput.parseinput(input)
call_list.append(','.join(infiles))
call_list.append(output)
if time_stamps:
call_list.append('-t')
if verbose:
call_list.append('-v')
if quiet:
call_list.append('-q')
subprocess.call(call_list)
开发者ID:SaraOgaz,项目名称:acstools,代码行数:59,代码来源:acssum.py
示例6: calwf3
def calwf3(input=None, output=None, printtime=False, save_tmp=False,
verbose=False, debug=False, parallel=True, version=False,
log_func=print):
call_list = ['calwf3.e']
return_code = None
if version and input is None:
call_list.append('-r')
else:
if printtime:
call_list.append('-t')
if save_tmp:
call_list.append('-s')
if verbose:
call_list.append('-v')
if debug:
call_list.append('-d')
if not parallel:
call_list.append('-1')
infiles, dummy = parseinput.parseinput(input)
if len(parseinput.irafglob(input)) == 0:
raise IOError("No valid image specified")
if len(parseinput.irafglob(input)) > 1:
raise IOError("calwf3 can only accept 1 file for"
"input at a time: {0}".format(infiles))
for image in infiles:
if not os.path.exists(image):
raise IOError("Input file not found: {0}".format(image))
call_list.append(input)
if output:
call_list.append(str(output))
proc = subprocess.Popen(
call_list,
stderr=subprocess.STDOUT,
stdout=subprocess.PIPE,
)
if log_func is not None:
for line in proc.stdout:
log_func(line.decode('utf8'))
return_code = proc.wait()
ec = error_code(return_code)
if ec:
if ec is None:
print("Unknown return code found!")
ec = return_code
raise RuntimeError("calwf3.e exited with code {}".format(ec))
开发者ID:sosey,项目名称:wfc3tools,代码行数:58,代码来源:calwf3.py
示例7: countInput
def countInput(input):
files = parseinput.parseinput(input)
count = len(files[0])
for f in files[0]:
if fileutil.isFits(f)[0]:
try:
ins = fits.getval(f, 'INSTRUME')
except: # allow odd fits files; do not stop the count
ins = None
if ins == 'STIS':
count += (stisObsCount(f)-1)
return count
开发者ID:jhunkeler,项目名称:stsci.tools,代码行数:12,代码来源:check_files.py
示例8: __init__
def __init__( self, input_file, edit_type=None, hdr_key=None, err_key=None, nref_par=None,
force=None, noclean=False, dry_run=1, verbosity=0):
"""constructor
Parameters
-----------
input_file : string
name of the file or filelist to be processed
edit_type : string type of file to update
hdr_key : string
name of keyword to update in file
err_key : string
name of keyword for error estimate
nref_par : string
name of the directory containing the nonlinearity file
force : string
name of algorithm whose value is to be returned
noclean : {'True', 'False'}
flag to force use of UNCLEANed 0th read.
dry_run : {0,1} [Default: 1]
flag to force not writing to header
verbosity : {0,1,2}
verbosity level (0 for quiet, 1 verbose, 2 very verbose)
"""
if (edit_type == None): edit_type = tfbutil.edit_type
if (hdr_key == None): hdr_key = tfbutil.hdr_key
if (err_key == None): err_key = tfbutil.err_key
if (force == None): force = tfbutil.force
self.input_file = input_file
self.edit_type = edit_type
self.hdr_key = hdr_key
self.err_key = err_key
self.nref_par = nref_par
self.force = force
self.noclean = noclean
self.dry_run = dry_run
self.verbosity = verbosity
self.tfb_version = __version__
self.tfb_run = time.asctime()
outlist = parseinput.parseinput(input_file)
self.num_files = parseinput.countinputs(input_file)[0]
self.outlist0 = outlist[0]
if (( dry_run == 0) & (self.verbosity >0)):
print(' The dry_run option has been selected so keys will not be written.')
if (self.verbosity >1):
print(' Temp_from_bias run on ',self.tfb_run, ', version: ', self.tfb_version)
开发者ID:jhunkeler,项目名称:nictools,代码行数:53,代码来源:CalTempFromBias.py
示例9: readWCS
def readWCS(input, exts=None, extname=None):
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[:]
wcso = []
fomited = []
# figure out which FITS extension(s) to use
if exts is None and extname is None:
# Assume it's simple FITS and the data is in the primary HDU
for f in filelist:
try:
wcso = wcsutil.HSTWCS(f)
except AttributeError:
fomited.append(f)
continue
elif exts is not None and validateExt(exts):
exts = [exts]
for f in filelist:
try:
wcso.extend([wcsutil.HSTWCS(f, ext=e) for e in exts])
except KeyError:
fomited.append(f)
continue
elif extname is not None:
for f in filelist:
fobj = fits.open(f)
for i in range(len(fobj)):
try:
ename = fobj[i].header['EXTNAME']
except KeyError:
continue
if ename.lower() == extname.lower():
wcso.append(wcsutil.HSTWCS(f, ext=i))
else:
continue
fobj.close()
if fomited != []:
print("These files were skipped:")
for f in fomited:
print(f)
return wcso
开发者ID:spacetelescope,项目名称:stwcs,代码行数:52,代码来源:mosaic.py
示例10: parseMultipleInput
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], HSTWCS):
## a list of HSTWCS objects
#return input
#else:
filelist = input[:]
return filelist
开发者ID:jhunkeler,项目名称:stwcs,代码行数:16,代码来源:getinput.py
示例11: run
def run(configObj=None):
if configObj['hdrname'] == '' and configObj['hdrext'] is None and \
configObj['distname'] == '':
print('=' * 60)
print('ERROR:')
print(' No valid "hdrname", "hdrext" or "distname" parameter value provided!')
print(' Please restart this task and provide a value for one of these parameters.')
print('=' * 60)
return
filename = parseinput.parseinput(configObj['filename'])[0]
# Call function with properly interpreted input parameters
# Syntax: delete_headerlet(filename, hdrname=None, hdrext=None, distname=None)
headerlet.delete_headerlet(filename,
hdrname=configObj['hdrname'],
hdrext=configObj['hdrext'],
distname=configObj['distname'],
logging=configObj['logging'])
开发者ID:jhunkeler,项目名称:stwcs,代码行数:18,代码来源:delete_headerlet.py
示例12: parse_input
def parse_input(input, prodonly=False, sort_wildcards=True):
catlist = None
if (isinstance(input, list) == False) and \
('_asn' in input or '_asc' in input) :
# Input is an association table
# Get the input files
oldasndict = asnutil.readASNTable(input, prodonly=prodonly)
filelist = [fileutil.buildRootname(fname) for fname in oldasndict['order']]
elif (isinstance(input, list) == False) and \
(input[0] == '@') :
# input is an @ file
f = open(input[1:])
# Read the first line in order to determine whether
# catalog files have been specified in a second column...
line = f.readline()
f.close()
# Parse the @-file with irafglob to extract the input filename
filelist = irafglob.irafglob(input, atfile=atfile_sci)
print(line)
# If there are additional columns for catalog files...
if len(line.split()) > 1:
# ...parse out the names of the catalog files as well
catlist,catdict = parse_atfile_cat(input)
elif (isinstance(input, list)):
# input a python list
filelist = []
for fn in input:
flist, output = parse_input(fn, prodonly=prodonly)
# if wild-cards are given, sort for uniform usage:
if fn.find('*') > -1 and sort_wildcards:
flist.sort()
filelist += flist
else:
# input is either a string or something unrecognizable, so give it a try:
try:
filelist, output = parseinput.parseinput(input)
# if wild-cards are given, sort for uniform usage:
if input.find('*') > -1 and sort_wildcards:
filelist.sort()
except IOError: raise
return filelist,catlist
开发者ID:brechmos-stsci,项目名称:drizzlepac,代码行数:44,代码来源:tweakutils.py
示例13: wf3ir
def wf3ir(input, output=None, verbose=False, quiet=True, log_func=print):
"""Call the wf3ir.e executable """
call_list = ['wf3ir.e']
return_code = None
if verbose:
call_list += ['-v', '-t']
infiles, dummy = parseinput.parseinput(input)
if "_asn" in input:
raise IOError("wf3ir does not accept association tables")
if len(parseinput.irafglob(input)) == 0:
raise IOError("No valid image specified")
if len(parseinput.irafglob(input)) > 1:
raise IOError("wf3ir can only accept 1 file for"
"input at a time: {0}".format(infiles))
for image in infiles:
if not os.path.exists(image):
raise IOError("Input file not found: {0}".format(image))
call_list.append(input)
if output:
call_list.append(str(output))
proc = subprocess.Popen(
call_list,
stderr=subprocess.STDOUT,
stdout=subprocess.PIPE,
)
if log_func is not None:
for line in proc.stdout:
log_func(line.decode('utf8'))
return_code = proc.wait()
ec = error_code(return_code)
if return_code:
if ec is None:
print("Unknown return code found!")
ec = return_code
raise RuntimeError("wf3ir.e exited with code {}".format(ec))
开发者ID:sosey,项目名称:wfc3tools,代码行数:43,代码来源:wf3ir.py
示例14: _process_input_wcs
def _process_input_wcs(infiles, wcskey, updatewcs):
"""
This is a subset of process_input(), for internal use only. This is the
portion of input handling which sets/updates WCS data, and is a performance
hit - a target for parallelization. Returns the expanded list of filenames.
"""
# Run parseinput though it's likely already been done in processFilenames
outfiles = parseinput.parseinput(infiles)[0]
# Disable parallel processing here for now until hardware I/O gets "wider".
# Since this part is IO bound, parallelizing doesn't help more than a little
# in most cases, and may actually slow this down on some desktop nodes.
# cfgval_num_cores = None # get this from paramDict
# pool_size = util.get_pool_size(cfgval_num_cores, len(outfiles))
pool_size = 1
# do the WCS updating
if wcskey in ['', ' ', 'INDEF', None]:
if updatewcs:
log.info('Updating input WCS using "updatewcs"')
else:
log.info('Resetting input WCS to be based on WCS key = %s' % wcskey)
if pool_size > 1:
log.info('Executing %d parallel workers' % pool_size)
subprocs = []
for fname in outfiles:
p = multiprocessing.Process(target=_process_input_wcs_single,
name='processInput._process_input_wcs()', # for err msgs
args=(fname, wcskey, updatewcs) )
subprocs.append(p)
mputil.launch_and_wait(subprocs, pool_size) # blocks till all done
else:
log.info('Executing serially')
for fname in outfiles:
_process_input_wcs_single(fname, wcskey, updatewcs)
return outfiles
开发者ID:jhunkeler,项目名称:drizzlepac,代码行数:39,代码来源:processInput.py
示例15: replace
def replace(input, **pars):
""" Replace pixels in `input` that have a value of `pixvalue`
with a value given by `newvalue`.
"""
pixvalue = pars.get('pixvalue', np.nan)
if pixvalue is None: pixvalue = np.nan # insure that None == np.nan
newvalue = pars.get('newvalue', 0.0)
ext = pars.get('ext',None)
if ext in ['',' ','None',None]:
ext = None
files = parseinput.parseinput(input)[0]
for f in files:
fimg = fits.open(f, mode='update')
if ext is None:
# replace pixels in ALL extensions
extn = [i for i in fimg]
else:
if type(ext) == type([]):
extn = [fimg[e] for e in ext]
else:
extn = [fimg[ext]]
for e in extn:
if e.data is not None and e.is_image: # ignore empty Primary HDUs
print("Converting {}[{},{}] value of {} to {}".format(
f,e.name,e.ver,pixvalue,newvalue))
if np.isnan(pixvalue):
e.data[np.isnan(e.data)] = newvalue
else:
e.data[np.where(e.data == pixvalue)] = newvalue
fimg.close()
开发者ID:brechmos-stsci,项目名称:drizzlepac,代码行数:38,代码来源:pixreplace.py
示例16: buildEmptyDRZ
def buildEmptyDRZ(input, output):
"""
Create an empty DRZ file.
This module creates an empty DRZ file in a valid FITS format so that the HST
pipeline can handle the Multidrizzle zero expossure time exception
where all data has been excluded from processing.
Parameters
----------
input : str
filename of the initial input to process_input
output : str
filename of the default empty _drz.fits file to be generated
"""
# Identify the first input image
inputfile = parseinput.parseinput(input)[0]
if not inputfile:
print('\n******* ERROR *******', file=sys.stderr)
print(
'No input file found! Check specification of parameter '
'"input". ', file=sys.stderr)
print('Quitting...', file=sys.stderr)
print('******* ***** *******\n', file=sys.stderr)
return # raise IOError, "No input file found!"
# Set up output file here...
if output is None:
if len(input) == 1:
oname = fileutil.buildNewRootname(input[0])
else:
oname = 'final'
output = fileutil.buildNewRootname(oname, extn='_drz.fits')
else:
if 'drz' not in output:
output = fileutil.buildNewRootname(output, extn='_drz.fits')
log.info('Setting up output name: %s' % output)
# Open the first image (of the excludedFileList?) to use as a template to build
# the DRZ file.
try :
log.info('Building empty DRZ file from %s' % inputfile[0])
img = fits.open(inputfile[0], memmap=False)
except:
raise IOError('Unable to open file %s \n' % inputfile)
# Create the fitsobject
fitsobj = fits.HDUList()
# Copy the primary header
hdu = img[0].copy()
fitsobj.append(hdu)
# Modify the 'NEXTEND' keyword of the primary header to 3 for the
#'sci, wht, and ctx' extensions of the newly created file.
fitsobj[0].header['NEXTEND'] = 3
# Create the 'SCI' extension
hdu = fits.ImageHDU(header=img['sci', 1].header.copy())
hdu.header['EXTNAME'] = 'SCI'
fitsobj.append(hdu)
# Create the 'WHT' extension
hdu = fits.ImageHDU(header=img['sci', 1].header.copy())
hdu.header['EXTNAME'] = 'WHT'
fitsobj.append(hdu)
# Create the 'CTX' extension
hdu = fits.ImageHDU(header=img['sci', 1].header.copy())
hdu.header['EXTNAME'] = 'CTX'
fitsobj.append(hdu)
# Add HISTORY comments explaining the creation of this file.
fitsobj[0].header.add_history("** AstroDrizzle has created this empty "
"DRZ product because**")
fitsobj[0].header.add_history("** all input images were excluded from "
"processing.**")
# Change the filename in the primary header to reflect the name of the output
# filename.
fitsobj[0].header['FILENAME'] = str(output) # +"_drz.fits"
# Change the ROOTNAME keyword to the ROOTNAME of the output PRODUCT
fitsobj[0].header['ROOTNAME'] = str(output.split('_drz.fits')[0])
# Modify the ASN_MTYP keyword to contain "PROD-DTH" so it can be properly
# ingested into the archive catalog.
# stis has this keyword in the [1] header, so I am directing the code
#t o first look in the primary, then the 1
try:
fitsobj[0].header['ASN_MTYP'] = 'PROD-DTH'
except:
fitsobj[1].header['ASN_MTYP'] = 'PROD-DTH'
# If the file is already on disk delete it and replace it with the
# new file
dirfiles = os.listdir(os.curdir)
#.........这里部分代码省略.........
开发者ID:jhunkeler,项目名称:drizzlepac,代码行数:101,代码来源:processInput.py
示例17: processFilenames
def processFilenames(input=None,output=None,infilesOnly=False):
"""Process the input string which contains the input file information and
return a filelist,output
"""
ivmlist = None
oldasndict = None
if input is None:
print("No input files provided to processInput")
raise ValueError
if not isinstance(input, list) and ('_asn' in input or '_asc' in input):
# Input is an association table
# Get the input files, and run makewcs on them
oldasndict = asnutil.readASNTable(input, prodonly=infilesOnly)
if not infilesOnly:
if output in ["",None,"None"]:
output = oldasndict['output'].lower() # insure output name is lower case
asnhdr = fits.getheader(input, memmap=False)
# Only perform duplication check if not already completed...
dupcheck = asnhdr.get('DUPCHECK',default="PERFORM") == "PERFORM"
#filelist = [fileutil.buildRootname(fname) for fname in oldasndict['order']]
filelist = buildASNList(oldasndict['order'],input,check_for_duplicates=dupcheck)
elif (not isinstance(input, list)) and \
(input[0] == '@') :
# input is an @ file
f = open(input[1:])
# Read the first line in order to determine whether
# IVM files have been specified in a second column...
line = f.readline()
f.close()
# Parse the @-file with irafglob to extract the input filename
filelist = irafglob.irafglob(input, atfile=util.atfile_sci)
# If there is a second column...
if len(line.split()) == 2:
# ...parse out the names of the IVM files as well
ivmlist = irafglob.irafglob(input, atfile=util.atfile_ivm)
if output in ['',None,"None"]:
if len(filelist) == 1:
output = fileutil.buildNewRootname(filelist[0])
else:
output = 'final'
else:
#input is a string or a python list
try:
filelist, output = parseinput.parseinput(input, outputname=output)
if output in ['',None,"None"]:
if len(filelist) == 1:
output = fileutil.buildNewRootname(filelist[0])
else:
output = 'final'
if not isinstance(input, list):
filelist.sort()
except IOError: raise
# sort the list of input files
# this ensures the list of input files has the same order on all platforms
# it can have ifferent order because listdir() uses inode order, not unix type order
#filelist.sort()
return filelist, output, ivmlist, oldasndict
开发者ID:jhunkeler,项目名称:drizzlepac,代码行数:67,代码来源:processInput.py
示例18: destripe_plus
#.........这里部分代码省略.........
.. note::
DQ masks (if used), *will be* combined with user masks specified
in the `scimask1` and `scimask2` parameters (if any).
rpt_clean : int
An integer indicating how many *additional* times stripe cleaning
should be performed on the input image. Default = 0.
atol : float, None
The threshold for maximum absolute value of bias stripe correction
below which repeated cleanings can stop. When `atol` is `None`
cleaning will be repeated `rpt_clean` number of times.
Default = 0.01 [e].
cte_correct : bool
Perform CTE correction.
verbose : bool
Print informational messages. Default = True.
Raises
------
ImportError
``stsci.tools`` not found.
IOError
Input file does not exist.
ValueError
Invalid header values or CALACS version.
"""
# Optional package dependencies
from stsci.tools import parseinput
try:
from stsci.tools.bitmask import interpret_bit_flags
except ImportError:
from stsci.tools.bitmask import (
interpret_bits_value as interpret_bit_flags
)
# process input file(s) and if we have multiple input files - recursively
# call acs_destripe_plus for each input image:
flist = parseinput.parseinput(inputfile)[0]
if isinstance(scimask1, str):
mlist1 = parseinput.parseinput(scimask1)[0]
elif isinstance(scimask1, np.ndarray):
mlist1 = [ scimask1.copy() ]
elif scimask1 is None:
mlist1 = []
elif isinstance(scimask1, list):
mlist1 = []
for m in scimask1:
if isinstance(m, np.ndarray):
mlist1.append(m.copy())
elif isinstance(m, str):
mlist1 += parseinput.parseinput(m)[0]
else:
raise TypeError("'scimask1' must be a list of str or "
"numpy.ndarray values.")
else:
raise TypeError("'scimask1' must be either a str, or a "
"numpy.ndarray, or a list of the two type of "
"values.")
开发者ID:jhunkeler,项目名称:acstools,代码行数:66,代码来源:acs_destripe_plus.py
示例19: acscteforwardmodel
def acscteforwardmodel(input, exec_path='', time_stamps=False, verbose=False,
quiet=False, single_core=False, exe_args=None):
"""
Run the acscteforwardmodel.e executable as from the shell.
Expect input to be ``*_blc_tmp.fits`` or ``*_flc.fits``.
Output is automatically named ``*_ctefmod.fits``.
Parameters
----------
input : str or list of str
Input filenames in one of these formats:
* a single filename ('j1234567q_blc_tmp.fits')
* a Python list of filenames
* a partial filename with wildcards ('\*blc_tmp.fits')
* filename of an ASN table ('j12345670_asn.fits')
* an at-file (``@input``)
exec_path : str, optional
The complete path to ACSCTE forward model executable.
If not given, run ACSCTE given by 'acscteforwardmodel.e'.
time_stamps : bool, optional
Set to True to turn on the printing of time stamps.
verbose : bool, optional
Set to True for verbose output.
quiet : bool, optional
Set to True for quiet output.
single_core : bool, optional
CTE correction in the ACSCTE forward model will by default try to use
all available CPUs on your computer. Set this to True to force the use
of just one CPU.
exe_args : list, optional
Arbitrary arguments passed to underlying executable call.
Note: Implementation uses subprocess.call and whitespace is not
permitted. E.g. use exe_args=['--nThreads', '1']
"""
from stsci.tools import parseinput # Optional package dependency
if exec_path:
if not os.path.exists(exec_path):
raise OSError('Executable not found: ' + exec_path)
call_list = [exec_path]
else:
call_list = ['acscteforwardmodel.e']
# Parse input to get list of filenames to process.
# acscte.e only takes 'file1,file2,...'
infiles, dummy_out = parseinput.parseinput(input)
call_list.append(','.join(infiles))
if time_stamps:
call_list.append('-t')
if verbose:
call_list.append('-v')
if quiet:
call_list.append('-q')
if single_core:
call_list.append('-1')
if exe_args:
call_list.extend(exe_args)
subprocess.check_call(call_list)
开发者ID:jhunkeler,项目名称:acstools,代码行数:73,代码来源:acscteforwardmodel.py
示例20: acscte
def acscte(input, exec_path='', time_stamps=False, verbose=False, quiet=False,
single_core=False):
"""
Run the acscte.e executable as from the shell.
Expect input to be ``*_blv_tmp.fits``.
Output is automatically named ``*_blc_tmp.fits``.
Parameters
----------
input : str or list of str
Input filenames in one of these formats:
* a single filename ('j1234567q_blv_tmp.fits')
* a Python list of filenames
* a partial filename with wildcards ('\*blv_tmp.fits')
* filename of an ASN table ('j12345670_asn.fits')
* an at-file (``@input``)
exec_path : str, optional
The complete path to ACSCTE executable.
If not given, run ACSCTE given by 'acscte.e'.
time_stamps : bool, optional
Set to True to turn on the printing of time stamps.
verbose : bool, optional
Set to True for verbose output.
quiet : bool, optional
Set to True for quiet output.
single_core : bool, optional
CTE correction in ACSCTE will by default try to use all available
CPUs on your computer. Set this to True to force the use of just
one CPU.
"""
if exec_path:
if not os.path.exists(exec_path):
raise OSError('Executable not found: ' + exec_path)
call_list = [exec_path]
else:
call_list = ['acscte.e']
# Parse input to get list of filenames to process.
# acscte.e only takes 'file1,file2,...'
infiles, dummy_out = parseinput.parseinput(input)
call_list.append(','.join(infiles))
if time_stamps:
call_list.append('-t')
if verbose:
call_list.append('-v')
if quiet:
call_list.append('-q')
if single_core:
call_list.append('-1')
subprocess.call(call_list)
开发者ID:SaraOgaz,项目名称:acstools,代码行数:63,代码来源:acscte.py
注:本文中的stsci.tools.parseinput.parseinput函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论