def h_simpo(fn, args, kwargs): """Simple output task All output goes into a single file/dir that is specified """ opars = { "split": "outputvis", "gaincal": "caltable", "gencal": "caltable", "bandpass": "******", "fringefit": "caltable", "importuvfits": "vis", "importfitsidi": "vis", "fixvis": "outputvis", "plotms": "plotfile" } opar = opars[fn.__name__] aa = inspect.getcallargs(fn, *args, **kwargs) if aa.has_key(opar) and aa[opar] != "": print "Warning: can not supply the output; will be ignored" f = repo.mktemp() os.remove(f) aa[opar] = f fn(**aa) return f
def clean(*args, **kwargs): """Clean task Clean modifies its input (becuase the model column is updated), produces output. Will pick up the clean model if it exists already """ iopar = "vis" opar = "imagename" fn = casa.clean aa = inspect.getcallargs(fn, *args, **kwargs) f = repo.mktemp() os.remove(f) os.mkdir(f) vis = os.path.join(f, "vis") shutil.copytree(aa[iopar], vis) aa[iopar] = vis if aa.has_key("phasecenter") and type( aa["phasecenter"]) == list and len(aa["phasecenter"]) > 1: aa[opar] = [ os.path.join(f, "img%i" % ii) for ii in range(len(aa["phasecenter"])) ] else: aa[opar] = os.path.join(f, "img") fn(**aa) return f
def h_simpo(fn, args, kwargs): """Simple output task All output goes into a single file/dir that is specified """ opars = { "split": "outputvis", "gaincal": "caltable", "gencal": "caltable", "bandpass": "******", "fringefit": "caltable", "importuvfits": "vis", "importfitsidi": "vis", "fixvis": "outputvis", "plotms": "plotfile", "fluxscale": "fluxtable", "concat": "concatvis" } opar = opars[fn.__name__] aa = inspect.getcallargs(fn, *args, **kwargs) if aa.has_key(opar) and aa[opar] != "": print "Warning: can not supply the output; will be ignored" if (fn.__name__ == 'plotms') and (aa['expformat'] == ''): aa['expformat'] = 'png' f = repo.mktemp() # Remove the temporary *file*, but reuse the *filename*. Do this # because CASA won't overwrite and/or needs a directory instead of # file os.remove(f) aa[opar] = f fn(**aa) return f
def h_inplc(fn, args, kwargs): """A task that in-place modifies an input """ opars = {"flagdata": "vis", "ft": "vis", "applycal": "vis"} iopar = opars[fn.__name__] aa = inspect.getcallargs(fn, *args, **kwargs) f = repo.mktemp() os.remove(f) shutil.copytree(aa[iopar], f) aa[iopar] = f fn(**aa) return f