Beispiel #1
0
def genclosurephase(fin,**kwargs):
    print(fin)
    hh = c.hf(genclosurephase, fin)
    mm = repo.get(hh)
    print(mm)
    if mm:
        c.trc( "[Cached]", "makemsfile", fin)
    else:
        c.trc( "[Eval] ", "makemsfile", fin, " -> ", hh)
        UV = pyuvdata.UVData()
        UV.read_miriad(fin)
        UV.phase_to_time(Time(UV.time_array[0], format='jd', scale='utc'))
        tempf = repo.mktemp()
        os.remove(tempf)
        UV.write_uvfits(tempf, spoof_nonessential=True)
        if not os.path.exists(tempf):
            raise RuntimeError("No output produced by mkuvfits!")
        foms = c.importuvfits(tempf)
        os.remove(tempf)
        flms = c.flagdata(foms,autocorr=True)
        mm = repo.put(flms, hh)
    
    fout=os.path.split(fin)[-1]+".npz"    
    r=hc.closurePh(mm,trlist=inTriads,alist=inAntenna)
    np.savez(fout,**r)
    if not os.path.exists(fout):
        raise RuntimeError("No output produced by hc.closurePh !")
       



    return(fout)
Beispiel #2
0
def mkclosurephase(fin, **kwargs):
    """Implement the closure phase calculation from heracasa with recipe"""
    hh=c.hf(mkclosurephase,inspect.getcallargs(hc.closurePh,fin,kwargs))
    mm=repo.get(hh)
    if mm:
        c.trc("[Cached]","hc.closurePh",fin,kwargs)
        return mm
    else:
        c.trc("[Eval]","hc.closurePh",fin,kwargs)
        tempf=repo.mktemp()
        os.remove(tempf)
        r=hc.closurePh(fin,**kwargs)
        np.savez(tempf,**r)
    if not os.path.exists(tempf+".npz"):
        raise RuntimeError("No output produced by hc.closurePh !")
    return repo.put(tempf+".npz",hh)
Beispiel #3
0
def mkuvfits(fin):
	hh=c.hf(mkuvfits, fin)
	mm=repo.get(hh)
	if mm:
		c.trc( "[Cached]", "mkuvfits", fin)
		return mm
	else:
		c.trc( "[Eval] ", "mkuvfits", fin, " -> ", hh)
		UV = pyuvdata.UVData()
		UV.read_miriad(fin,'miriad')
		UV.phase_to_time(UV.time_array[0])
		tempf=repo.mktemp()
		os.remove(tempf)
		UV.write_uvfits(tempf,'uvfits')
	if not os.path.exists(tempf):
		raise RuntimeError("No output produced by mkuvfits !")
	return repo.put(tempf, hh)
Beispiel #4
0
def extract_autocorrelations(fin, **kwargs):


    hh=c.hf(extract_autocorrelations, fin)
    mm=repo.get(hh)
    if mm:
        c.trc( "[Cached]", "mkuvfits", fin)
        return mm
    else:
        c.trc( "[Eval] ", "mkuvfits", fin, " -> ", hh)
        ms=casac.casac.ms()
        ms.open(fin)
        tempf=repo.mktemp()
        os.remove(tempf)
        data=ms.getdata(['antenna1','antenna2'.'data'],ifraxis=True)
        autocorrs_ind = numpy.arghwhere(data['antenna1'] == data['antenna2'])
        visrecords = data['data']
        autocorrs = visrecords[:,:,tuple(autocorrs_ind),:]
        np.savez(tempf,**autocorrs)
    if not os.path.exists(tempf+".npz"):
        raise RuntimeError("No output produced by autocorrelations :(")
    return repo.put(tempf+".npz",hh)
Beispiel #5
0
def makemsfile(fin,**kwargs):
    
    print(fin)
    hh = c.hf(makemsfile, fin)
    mm = repo.get(hh)
    print(mm)
    if mm:
        c.trc( "[Cached]", "makemsfile", fin)
    else:
        c.trc( "[Eval] ", "makemsfile", fin, " -> ", hh)
        UV = pyuvdata.UVData()
        UV.read_miriad(fin)
        UV.phase_to_time(Time(UV.time_array[0], format='jd', scale='utc'))
        tempf = repo.mktemp()
        os.remove(tempf)
        UV.write_uvfits(tempf, spoof_nonessential=True)
        if not os.path.exists(tempf):
            raise RuntimeError("No output produced by mkuvfits!")
        foms = c.importuvfits(tempf)
        os.remove(tempf)
        #flms = c.flagdata(foms,autocorr=True)
        mm = repo.put(foms, hh)
    return(mm)