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))
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))
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
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
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
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)
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)
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))
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))