inds = np.argsort(mags) mags, bls, conj = np.take(mags,inds), np.take(bls,inds), np.take(conj,inds) kprs = np.zeros((len(mags)),) half = len(kpl)/2. wfall = np.zeros((len(mags),half),dtype=complex) hors = np.zeros((len(mags)),) phors = np.zeros((len(mags)),) for ii, mg in enumerate(mags): spec = Tspec[mg] if conj[ii] ==1: spec = spec[::-1] inds = np.argsort(kpl) spec = np.take(spec,inds) kpr = cc.z2kpr(cc.fq2z(fq))*mg pkpr = cc.z2kpr(cc.fq2z(fq))*(mg+50*fq) kprs[ii] = kpr # horizon limit hor = cc.Hlimit(cc.fq2z(fq))*kpr#mg/fq phor = cc.Hlimit(cc.fq2z(fq))*pkpr#((mg/fq)+50) hors[ii] = hor phors[ii] = phor spec = (spec[0:half] + spec[half:][::-1])/2. wfall[ii,:] = spec print wfall kpl.sort() wfall = wfall.T np.savez(open('%s-%s.npz'%(opts.save,opts.pol),'wb'),wedge=wfall,kpr=kprs,kpl=kpl,mag=mags,hor=hors,phors=phors)
o.add_option('--beam', dest='beam',type='str',default=None, help='npzfile of stokes beam, keys as different polarizations') o.add_option('--convert', dest='convert', action='store_true', help='If convert is set to True, the values in JY/BEAM will be converted to mK.') opts, args = o.parse_args(sys.argv[1:]) uv = a.miriad.UV(args[0]) sfreq = uv['sfreq'] nchan = uv['nchan'] sdf = uv['sdf'] stop = sfreq + nchan*sdf aa = a.cal.get_aa(opts.cal, sdf, sfreq, nchan) freqs = np.linspace(sfreq,stop,nchan) fq0 = opts.cenf B = opts.bw z = cc.fq2z(fq0) omega_bw8 = [2.00, 1.95, 1.96, 1.95]# hardcorded normalizations #omega_bw8 = [3.98,3.96,3.97,3.95] def genWindow(size): "Blackman-Harris window function" window = np.zeros((size),) alpha = 0.16 _w = lambda n: (1-alpha)/2. - 0.5*np.cos((2*np.pi*n)/(size-1)) + alpha/2.*np.cos((4*np.pi*n)/(size-1)) window[:] = _w(np.arange(size)) return window def Tspec_fq(jy_spec,convert=opts.convert): " Selecting the specified bandwith and Fourier transforming along frequency axis" ch0 = np.argmin(np.abs(freqs-fq0)) + 1 # choosing the mid channel dCH = int(B/sdf) + 1 # evaluating how many channels would formed the requires bandwidth