Пример #1
0
        d = 10*n.log10(n.abs(d))
        mx,drng = 10*mx, 10*drng
    elif mode == 'real': d = d.real
    lons,lats,x,y = m.makegrid(SIZE,SIZE, returnxy=True)
    cs = m.contour(x,y, d, levels, linewidth=8, linestyles=linestyles, colors=colors)
    p.clabel(cs, inline=1, fontsize=10, fmt='%4.2f')#, manual=manual)
    #m.drawmapboundary()
    #m.drawmeridians(n.arange(0,360,30))
    #m.drawparallels(n.arange(0,90,10))
    return cs

xyz = h.px2crd(n.arange(h.npix()), ncrd=3)
top = n.dot(aa._eq2zen, xyz)
bl = aa.get_baseline(0,16,'r') * FQ
print 'Baseline:', bl
fng = frf_conv.mk_fng(bl, *xyz)
#plot_hmap(fng, mode='real'); p.show()

frf,bins,wgt,(cen,wid) = frf_conv.get_optimal_kernel_at_ref(aa, 0, (0,16))
bwfrs = frf_conv.get_beam_w_fr(aa, (0,16), ref_chan=0)
tbins,firs,frbins,frfs = frf_conv.get_fringe_rate_kernels(bwfrs,42.9,403)
wgt = scipy.interpolate.interp1d(frbins, frfs[0], kind='linear', bounds_error=False, fill_value=0)
fng_wgt = wgt(fng)

_bmx = aa[0].bm_response(top,pol='x')[0]
_bmy = aa[0].bm_response(top,pol='y')[0]
bm = 0.5 * (_bmx**2 + _bmy**2)
bm = n.where(top[-1] > 0, bm, 0)
fng_bm = fng_wgt * bm

def nos(dat, t):
    pwr_bm = beam_area(bm)
    pwr2_bm = beam_area(dat**2)
    print pwr2_bm, pwr_bm, t
    return pwr_bm**2 / pwr2_bm / t

#print beam_area(bm), beam_area(bm**2), nos(bm, 1.), nos(bm,1.) / n.sqrt(NBINS)

#xyz = (xyz[1],xyz[0],xyz[2])
#bl = n.array([100, 0, 0])
bl = aa.get_baseline(0,16,'r') * FQ
#bl = aa.get_baseline(0,28,'r') * FQ
#bl = aa.get_baseline(0,3,'r') * 10 * FQ
print 'Baseline:', bl
fng = mk_fng(bl, *xyz)
#print fng.max(), fng.min()

hist, bin_edges = n.histogram(fng, bins=bin_edges, weights=bm**2)
#hist, bin_edges = n.histogram(fng, range=(-.01,.01), bins=NBINS, weights=bm**2) # or bm**2?
f = 0
for cnt,b1 in enumerate(bin_edges[:-1]):
    b2 = bin_edges[cnt+1]
    if cnt % 2 == 0: f = n.where(n.logical_and(fng >= b1, fng < b2), 1., f)

#p.subplot(231)
#p.imshow(proj_hmap(bm,'e'), origin='lower')

#p.subplot(232)
#p.imshow(proj_hmap(fng,'e'), vmax=0, vmin=-.007, origin='lower')
m.imshow(1e3*proj_hmap(fng,'e'), origin='lower')