示例#1
0
文件: sf.py 项目: 1014511134/src
def rmrf(mydir, rec=False, verb=False, exe=None):

    arg = 'dir=' + mydir + ' rec=' + ivlad.switch(rec, 'y', 'n')

    return __run('sfrmrf', args, 
        None, None, 
        verb, __x(exe,glob_exe))
示例#2
0
文件: sf.py 项目: 1014511134/src
def ximage(inp, par=None, verb=False, exe=None):

    arg_dict = locals()
    args = 'inp='+inp + ivlad.switch(par==None, '', ' par="' + par + '"')

    return __run('sfximage', args, 
        None, None, 
        verb, __x(exe,glob_exe))
示例#3
0
def __parse(arg_dict):
    'Turn the list of args into a string (default vals must be None!)'

    args = ''
    for arg_nm in arg_dict.keys():
        if arg_nm not in ('inp', 'out', 'verb', 'exe'):
            arg_v = arg_dict[arg_nm]
            args += ivlad.switch(arg_v == None, '', ' %s=%s' % (arg_nm, arg_v))

    return args
示例#4
0
文件: sf.py 项目: 1014511134/src
def __parse(arg_dict):
    'Turn the list of args into a string (default vals must be None!)'  

    args = ''
    for arg_nm in arg_dict.keys():
	if arg_nm not in ('inp', 'out', 'verb', 'exe'):
	    arg_v = arg_dict[arg_nm]
	    args += ivlad.switch(arg_v==None, '', ' %s=%s' % (arg_nm,arg_v))

    return args
示例#5
0
文件: Mximage.py 项目: 1014511134/src
def main(par):

    inp = par.string('inp') # Input file
    ipar = par.string('par','') # ximage params that can't be found in RSF headr
    verb = par.bool('verb',False)

    prog = 'ximage' 
    tpar = '"n1=n1 n2=n2 f1=o1 f2=o2 d1=d1 d2=d2 label1=label1 label2=label2"'
    ipar += ' verbose=' + ivlad.switch(verb, '1', '0')
 
    sf.wuab(inp, prog, tpar, '"'+ipar+'"', verb)
    
    return ivlad.unix_success
示例#6
0
文件: sf.py 项目: 1014511134/src
def get(inp=None, par=None, parform=False, out=None, verb=False, exe=None):

    args = ['parform=' + ivlad.switch(parform, 'y', 'n')] + ivlad.mklist(par)
    if exe == None and out==None: # invalid combination, fix the call
        exe = 'g'
    def postproc(out_str):
        out = out_str.split()
        if len(out) == 1:
            return out[0]
        else:
            return out
    return __run('sfget', ' '.join(args), 
        inp, out, 
        verb, __x(exe,glob_exe), postproc)
示例#7
0
def get(inp=None, par=None, parform=False, out=None, verb=False, exe=None):

    args = ['parform=' + ivlad.switch(parform, 'y', 'n')] + ivlad.mklist(par)
    if exe == None and out == None:  # invalid combination, fix the call
        exe = 'g'

    def postproc(out_str):
        out = out_str.split()
        if len(out) == 1:
            return out[0]
        else:
            return out

    return __run('sfget', ' '.join(args), inp, out, verb, __x(exe, glob_exe),
                 postproc)
示例#8
0
def ximage(inp, par=None, verb=False, exe=None):

    arg_dict = locals()
    args = 'inp=' + inp + ivlad.switch(par == None, '', ' par="' + par + '"')

    return __run('sfximage', args, None, None, verb, __x(exe, glob_exe))
示例#9
0
def rmrf(mydir, rec=False, verb=False, exe=None):

    arg = 'dir=' + mydir + ' rec=' + ivlad.switch(rec, 'y', 'n')

    return __run('sfrmrf', args, None, None, verb, __x(exe, glob_exe))