def iofits(config): ''' Reads in the uvfits file I and exports it to the miriad-uv file O, using the carma-miriad task wsrtfits. ''' for p in config.items('uvfits'): I = p[1] O = config.get('mfiles', p[0]) flags = config.get('flag', 'flags') #TODO: Fix the wsrtfits and attsys modules #wsrtfits = mirexecb.TaskWSRTFits() #wsrtfits.in_ = I #wsrtfits.out = O #wsrtfits.op = 'uvin' #wsrtfits.velocity = 'optbary' #wsrtfits.snarf() cmd = 'wsrtfits in=' + I + ' out=' + O + ' op=uvin velocity=optbary' os.system(cmd) #attsys = mirexecb.TaskAttsys() #attsys.vis = O #attsys.optons='apply' #attsys.out = '_tmp_vis' #attsys.snarf() cmd = 'attsys vis=' + O + ' out=_tmp_vis' os.system(cmd) cmd = 'rm -r ' + O os.system(cmd) cmd = 'mv _tmp_vis ' + O os.system(cmd) for f in flags.split(','): uvflag = mirexec.TaskUVFlag() uvflag.vis = O uvflag.select = f uvflag.flagval = 'flag' uvflag.snarf()
def iofits(I, O): ''' Reads in the uvfits file I and exports it to the miriad-uv file O, using the carma-miriad task wsrtfits. ''' cmd = 'wsrtfits in=' + I + ' out=' + O + ' op=uvin velocity=optbary' print "Import " + I + " -> " + O os.system(cmd) print "Tsys Calibration on " + O cmd = 'attsys vis=' + O + ' out=_tmp_vis' os.system(cmd) cmd = 'rm -r ' + O os.system(cmd) cmd = 'mv _tmp_vis ' + O os.system(cmd) flags = ['auto', 'shadow(25)', 'an(6)'] for f in flags: uvflag = mirexec.TaskUVFlag() uvflag.vis = O uvflag.select = f #'auto,or,shadow(27),or,ant(6)'; uvflag.flagval = 'flag' tout = uvflag.snarf() acos.taskout(uvflag, tout, 'uvflag.txt') print "Done."
def uvflag(vis, select, edge): uvflag = mirexec.TaskUVFlag() uvflag.vis = vis uvflag.select = select uvflag.edge = edge uvflag.flagval = 'flag' tout = uvflag.snarf() return tout
def flag(): uvflag = mirexec.TaskUVFlag() uvflag.vis = S.vis uvflag.flagval = 'flag' for f in S.flags.split(','): uvflag.select = f tout = uvflag.snarf() acos.taskout(uvflag, tout, 'uvflag.txt')