) # 400 by 400 image, i.e. 200 boxes, with 4 pixels per box,freq space kmax=100, dk=0.5 X, Y, Z = img.get_top(center=(200, 200)) shape0 = X.shape X, Y, Z = X.flatten(), Y.flatten(), Z.flatten() ntop = n.array([X, Y, Z]) aa = a.cal.get_aa('psa6622_v001', n.array([.15])) src = a.fit.RadioFixedBody(0, aa.lat, janskies=0., mfreq=.15, name='test') # src=a.fit.RadioSpecial("Sun") nants = 128 dt = 0.001 dt_fine = 43. / 3600 / 24 times_coarse = n.arange(2456240.3, 2456240.4, dt) times_fine = n.arange(2456240.3, 2456240.4, dt_fine) dist = 1. # size of cells to store in dictionary. corr_tol = 5000. # cutoff of minimum correlation bmp = export_beam.beam_real(aa[0], ntop, shape0, 'x') freq, fbmamp = export_beam.beam_fourier(bmp, d, 400) print 'Time to initialize:', sys_time.clock(), 'seconds' d = select_pair.pair_coarse(aa, src, times_coarse, dist, 2.) #coarsely determine crossings print 'Time after coarse selection:', sys_time.clock(), 'seconds' # pairs_sorted = select_pair.pair_sort(d,freq,fbmamp) # sort crossings # clos_app = select_pair.get_closest(pairs_sorted) # determine closest approach points nproc = 4 nkey = len(d) chunk, remainder = nkey / nproc, nkey % nproc clos_app = select_pair.alter_clos(d, freq, fbmamp) # determine closest approach points print 'Found closest approach points after:', sys_time.clock(), 'seconds'
def weight_ext(dec, aa): l,m = n.sin(0-aa.long), n.sin(dec-aa.lat); nn = n.sqrt(1-l*l-m*m) ntop = n.array([l,m,nn]) wt = export_beam.beam_real(aa[0], ntop, pol='x', sq=False) #print n.array(wt).shape() return wt[0]
import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import export_beam # plots the beam and the Fourier transform of the beam squared sz = 200 d = 1./sz img = a.img.Img(200,res=0.5) X,Y,Z = img.get_top(center=(200,200)) shape0 = X.shape X,Y,Z = X.flatten(),Y.flatten(),Z.flatten() aa = a.cal.get_aa('psa6622_v001',n.array([.15, .18])) aa.set_jultime(2456240.2) peak = [] sample_ant = 1 ntop = n.array([X,Y,Z]) #note all beams are the same bmp_list = export_beam.beam_real(aa[sample_ant], ntop, shape0, 'x',sq=True) bmp = bmp_list[0] freq, fbmamp = export_beam.beam_fourier(bmp, d, 400) rax = [-1,1,-1,1] freq_pl = 5 mid = len(freq)/2 flim = (mid-freq_pl,mid+freq_pl) freqax = [freq[flim[0]],freq[flim[1]], freq[flim[0]],freq[flim[1]]] f_range = n.array(n.arange(flim[0],flim[1])) m_range = n.arange(0, flim[1]-flim[0]) #peak.append(fbmamp[mid,mid]) fig = p.figure()
img = a.img.Img(200,res=0.5) # 400 by 400 image, i.e. 200 boxes, with 4 pixels per box,freq space kmax=100, dk=0.5 X,Y,Z = img.get_top(center=(200,200)) shape0 = X.shape X,Y,Z = X.flatten(),Y.flatten(),Z.flatten() ntop = n.array([X,Y,Z]) aa = a.cal.get_aa('psa6622_v001',n.array([.15])) src = a.fit.RadioFixedBody(0, aa.lat, janskies=0., mfreq=.15, name='test') # src=a.fit.RadioSpecial("Sun") nants = 128 dt = 0.001 dt_fine = 43./3600/24 times_coarse = n.arange(2456240.3,2456240.4, dt) times_fine = n.arange(2456240.3,2456240.4, dt_fine) dist = 1. # size of cells to store in dictionary. corr_tol = 5000. # cutoff of minimum correlation bmp = export_beam.beam_real(aa[0], ntop, shape0, 'x') freq, fbmamp = export_beam.beam_fourier(bmp, d, 400) print 'Time to initialize:', sys_time.clock(), 'seconds' d = select_pair.pair_coarse(aa, src,times_coarse,dist,2.) #coarsely determine crossings print 'Time after coarse selection:', sys_time.clock(), 'seconds' # pairs_sorted = select_pair.pair_sort(d,freq,fbmamp) # sort crossings # clos_app = select_pair.get_closest(pairs_sorted) # determine closest approach points nproc = 4 nkey = len(d) chunk,remainder = nkey/nproc, nkey%nproc clos_app = select_pair.alter_clos(d,freq,fbmamp) # determine closest approach points print 'Found closest approach points after:', sys_time.clock(), 'seconds' pairs_final = select_pair.pair_fin(clos_app,dt,aa,src,freq,fbmamp,corr_tol) # output final sorted pairs print 'Total time:', sys_time.clock(), 'seconds'
import export_beam # plots the beam and the Fourier transform of the beam squared sz = 200 d = 1. / sz img = a.img.Img(200, res=0.5) X, Y, Z = img.get_top(center=(200, 200)) shape0 = X.shape X, Y, Z = X.flatten(), Y.flatten(), Z.flatten() aa = a.cal.get_aa('psa6622_v001', n.array([.15, .18])) aa.set_jultime(2456240.2) peak = [] sample_ant = 1 ntop = n.array([X, Y, Z]) #note all beams are the same print X print Z bmp_list = export_beam.beam_real(aa[sample_ant], ntop, shape0, 'x', sq=True) bmp = bmp_list[0] freq, fbmamp = export_beam.beam_fourier(bmp, d, 400) rax = [-1, 1, -1, 1] freq_pl = 5 mid = len(freq) / 2 flim = (mid - freq_pl, mid + freq_pl) freqax = [freq[flim[0]], freq[flim[1]], freq[flim[0]], freq[flim[1]]] f_range = n.array(n.arange(flim[0], flim[1])) m_range = n.arange(0, flim[1] - flim[0]) #peak.append(fbmamp[mid,mid]) fig = p.figure() ax1 = fig.add_subplot(121) im1 = ax1.imshow(bmp, interpolation='nearest', extent=rax)