コード例 #1
0
ファイル: pspec_cov_v003.py プロジェクト: jpober/capo
def frf_data(data): #FRF FULL LENGTH DATA
    aa2 = a.cal.get_aa(opts.cal, freqs) #All freqs for data instead of subset
    bins = fringe.gen_frbins(inttime)
    frp, bins = fringe.aa_to_fr_profile(aa2, ij, len(freqs)/2, bins=bins)
    timebins, firs = fringe.frp_to_firs(frp, bins, aa2.get_freqs(), fq0=aa2.get_freqs()[len(freqs)/2])
    _,blconj,_ = zsa.grid2ij(aa2.ant_layout)
    if blconj[a.miriad.ij2bl(ij[0],ij[1])]: fir = {(ij[0],ij[1],POL):n.conj(firs)}
    else: fir = {(ij[0],ij[1],POL):firs}
    dij = n.transpose(data)
    wij = n.ones(dij.shape,dtype=bool) #XXX flags are all true (times,freqs)
    #dij and wij are (times,freqs)
    _d,_w,_,_ = fringe.apply_frf(aa2,dij,wij,ij[0],ij[1],pol=POL,bins=bins,firs=fir)
    _d = n.transpose(_d)
    return _d
コード例 #2
0
aa = aipy.cal.get_aa('psa6240_v003', afreqs)
sep2ij, blconj, bl2sep = capo.zsa.grid2ij(aa.ant_layout)
ijs = sep2ij[SEP].split(',')
all_bls= [ aipy.miriad.ij2bl(*map( int,x.split('_'))) for x in ijs]

if True: #this one is the exact one
    sep = bl2sep[all_bls[0]]
    ij_array =  sep2ij[sep].split(',')
    while True:
        ij = map( int, ij_array.pop().split('_') )
        bl = aipy.miriad.ij2bl(*ij )
        if not blconj[bl]: break
    if False: bl = 11072; ij =  aipy.miriad.bl2ij(bl);
    print 'Using Baseline for FRP:',bl
    bins = fringe.gen_frbins(inttime)
    frp, bins = fringe.aa_to_fr_profile(aa, ij, len(afreqs)/2, bins=bins)

    timebins, firs = fringe.frp_to_firs(frp, bins, aa.get_freqs(), fq0=aa.get_freqs()[len(afreqs)/2])#, fr_width_scale=1.3, maxfr=1.3e-3)

    if blconj[aipy.miriad.ij2bl(ij[0],ij[1])]: fir = {(ij[0],ij[1],POL):np.conj(firs)} #conjugate fir if needed
    else: fir = {(ij[0],ij[1],POL):firs}

qs_e,qs_v,qs_r,qs_ev = [], [], [], []
ps_e,ps_v,ps_r,ps_ev = [], [], [], []
c_nums = []
bar =ProgressBar(maxval=len(v_scale)*NRUN,widgets=['Performing MC:',Bar(),Percentage(),' ',ETA()]).start()
for cnt,sc in enumerate(v_scale):
    tmp_qs_e,tmp_qs_v,tmp_qs_r,tmp_qs_ev = [], [], [], []
    tmp_ps_e,tmp_ps_v,tmp_ps_r,tmp_ps_ev = [], [], [], []
    tmp_c=[]
コード例 #3
0
ファイル: frf_diagnose.py プロジェクト: SaulAryehKohn/capo
#print "Looking for baselines matching ", opts.ant
#ants = [ b[0] for b in a.scripting.parse_ants(opts.ant, nants) ]
#seps = [ bl2sep[b] for b in ants ]
#seps = n.unique(seps)
PLOT=opts.plot
seps = opts.seps.split(';')
bl_scales = [ float(x) for x in opts.bl_scale.split(',')]
fr_width_scales = [ float(x) for x in opts.fr_width_scale.split(',')]
n_bls=len(bl_scales)
n_width=len(fr_width_scales)
cmap= get_colors(int(1.5*n_bls*n_width))
if opts.chan: mychan = opts.chan
else: mychan = n.floor(nchan/2)

##use calculated inttime to generate correct frf bins
frbins = fringe.gen_frbins(opts.inttime)
#frbins =n.fft.fftshift( n.fft.fftfreq(609,d=opts.inttime))

print 'These are the separations that we are going to use ', seps
print "calculating fringe profile at channel ",mychan
#Get the fir filters for the separation used.
fig_firs,ax_firs=p.subplots(1)
fig_frp,ax_frp=p.subplots(1)
frp={}
for cnt,scale in enumerate(bl_scales):
    firs = {}
    frps = {}
    frp[scale] = {}
    for cn1,frw_scale in enumerate(fr_width_scales):
        frp[scale][frw_scale] ={}
        for sep in seps:
コード例 #4
0
ファイル: frf_filter.py プロジェクト: SaulAryehKohn/capo
print "Using normalization for old FRF: ", opts.alietal

print "Looking for baselines matching ", opts.ant
ants = [ b[0] for b in a.scripting.parse_ants(opts.ant, nants) ]
seps = [ bl2sep[b] for b in ants ]
seps = n.unique(seps)
print 'These are the spearations that we are going to use ', seps
print 'This is the channel we are using to build the frf: ',mychan
print 'Current inttime use for gen_frbins: ',inttime
#Get the fir filters for the separation used.

baselines = ''.join(sep2ij[sep] for sep in seps)
times, data, flags = zsa.get_dict_of_uv_data(args, baselines, pol, verbose=True)

##use calculated inttime to generate correct frf bins
frbins = fringe.gen_frbins(inttime,fringe_res=1./(inttime*len(times)))
#frbins = n.arange( -.5/inttime+5e-5/2, .5/inttime,5e-5)
#DEFAULT_FRBINS = n.arange(-.01+5e-5/2,.01,5e-5) # Hz

firs = {}
for sep in seps:
    c = 0
    while c != -1:
        ij = map(int, sep2ij[sep].split(',')[c].split('_'))
        bl = a.miriad.ij2bl(*ij)
        if blconj[bl]: c+=1
        else: break
    print mychan,ij,opts.bl_scale
    frp, bins = fringe.aa_to_fr_profile(aa, ij, mychan, bins=frbins,pol=opts.pol,bl_scale=opts.bl_scale)
    timebins, firs[sep] = fringe.frp_to_firs(frp, bins, aa.get_afreqs(), fq0=aa.get_afreqs()[mychan],
         bl_scale=opts.bl_scale, fr_width_scale = opts.fr_width_scale, alietal = opts.alietal,maxfr=opts.maxfr)
コード例 #5
0
ファイル: pspec_cov_v003.py プロジェクト: karakundert/capo
    for k in days:
        lsts[k] = lsts[k][:j]
        for bl in data[k]:
            data[k][bl],flgs[k][bl] = n.array(data[k][bl][:j]),n.array(flgs[k][bl][:j])
else:
    for k in days:
        for bl in data[k]:
            data[k][bl], flgs[k][bl] = n.array(data[k][bl][:]), n.array(flgs[k][bl][:])
lsts = lsts.values()[0] #same set of LST values for both even/odd data
"""
daykey = data.keys()[0]
blkey = data[daykey].keys()[0]
ij = a.miriad.bl2ij(blkey)

#Prep FRF Stuff
bins = fringe.gen_frbins(inttime)
frp, bins = fringe.aa_to_fr_profile(aa, ij, len(afreqs) / 2, bins=bins)
timebins, firs = fringe.frp_to_firs(frp,
                                    bins,
                                    aa.get_freqs(),
                                    fq0=aa.get_freqs()[len(afreqs) / 2])
_, blconj, _ = zsa.grid2ij(aa.ant_layout)
if blconj[a.miriad.ij2bl(ij[0], ij[1])]:
    fir = {(ij[0], ij[1], POL): n.conj(firs)}
else:
    fir = {(ij[0], ij[1], POL): firs}
"""
#FRF data #XXX
for k in days:
    for bl in data[k]:
        d = frf_data(n.transpose(data[k][bl]))