pellminX,pellmaxX,beamY=beamY,noiseTY=noiseTY, \ noisePY=noisePY,tellminY=tellminY,tellmaxY=tellmaxY, \ pellminY=pellminY,pellmaxY=pellmaxY) ls, Nls = myNls.getNl(polComb=polComb, halo=halo) fileName = saveRoot + getFileNameString([ 'gradCut', 'polComb', 'beamY', 'noiseY', 'grad', 'tellminY', 'pellminY', 'tellmaxY', 'pellmaxY', 'kmin', 'deg', 'px' ], [ gradCut, polComb, beamY, noiseY, lab, tellminY, pellminY, tellmaxY, pellmaxY, kmin, deg, px ]) + ".txt" np.savetxt(fileName, np.vstack((ls, Nls)).transpose()) if (polComb == 'EB' or polComb == 'TB') and (delensTolerance is not None): ls, Nls = myNls.iterativeDelens( polComb, delensTolerance, halo) fileName = saveRoot + getFileNameString([ 'gradCut', 'polComb', 'beamY', 'noiseY', 'grad', 'tellminY', 'pellminY', 'tellmaxY', 'pellmaxY', 'kmin', 'deg', 'px', 'delens' ], [ gradCut, polComb, beamY, noiseY, lab, tellminY, pellminY, tellmaxY, pellmaxY, kmin, deg, px, delensTolerance ]) + ".txt" np.savetxt(fileName, np.vstack((ls, Nls)).transpose())
labname = os.path.basename(noiseFile)[:-4] noiseFileY = noiseFile nTX,nPX,nTY,nPY = myNls.updateNoise(beamX,noiseTX,noisePX,tellminX,tellmaxX, \ pellminX,pellmaxX,beamY=beamY,noiseTY=noiseTY, \ noisePY=noisePY,tellminY=tellminY,tellmaxY=tellmaxY, \ pellminY=pellminY,pellmaxY=pellmaxY,lkneesX=(lkneeTX,lkneePX), \ alphasX=(alphaTX,alphaPX), \ lkneesY=(lkneeTY,lkneePY),alphasY=(alphaTY,alphaPY), noiseFilePX = noiseFile,noiseFilePY=noiseFileY) if polComb=='EB' and delens: ls, Nls,efficiency = myNls.iterativeDelens(polComb,delensTolerance,halo,verbose=False) #print "percentage efficiency ", efficiency , " %" else: ls,Nls = myNls.getNl(polComb=polComb,halo=halo) # if True: #noiseFile is not None: # #ls,Nls = np.loadtxt(noiseFile,unpack=True) # #pl.add(ls,Nls,label=labname,ls=lines,alpha=alpha,lw=lw) # binner = bin2D(myNls.N.modLMap,frangeC) # lcents,Nlbinned = binner.bin(nPX) # pl.add(lcents,Nlbinned,label=labname,ls="--") pl.add(ls,Nls,label=labname,ls=lines,alpha=alpha)
if swap: tempB = beamY beamY = beamX beamX = tempB nTX,nPX,nTY,nPY = myNls.updateNoise(beamX,noiseTX,noisePX,tellminX,tellmaxX, \ pellminX,pellmaxX,beamY=beamY,noiseTY=noiseTY, \ noisePY=noisePY,tellminY=tellminY,tellmaxY=tellmaxY, \ pellminY=pellminY,pellmaxY=pellmaxY,lkneesX=(lkneeTX,lkneePX), \ alphasX=(alphaTX,alphaPX), \ lkneesY=(lkneeTY,lkneePY),alphasY=(alphaTY,alphaPY)) if polComb == 'EB' and delens: ls, Nls, efficiency = myNls.iterativeDelens( polComb, delensTolerance, halo) print "percentage efficiency ", efficiency, " %" else: ls, Nls = myNls.getNl(polComb=polComb, halo=halo) pl.add(ls, Nls, label=str(beamX)) #pl.add(myNls.N.cents,myNls.N.wxy,label=str(beamX)) LF = LensForecast() LF.loadKK(frange, Clkk, ls, Nls) sn, errs = LF.sn(snrange, fsky, "kk") sns.append(sn) pl.add(frange, Clkk, color="black") #pl.legendOn(loc='lower left',labsize = 8)
lmap = lm.makeEmptyCEATemplate(raSizeDeg=arc / 60., decSizeDeg=arc / 60., pixScaleXarcmin=px, pixScaleYarcmin=px) bin_edges = np.arange(kellmin, kellmax, num_ells) myNls = NlGenerator(lmap, theory, bin_edges, gradCut=gradCut) myNls.updateNoise(beam, noiseT, noiseP, tellmin, tellmax, pellmin, pellmax) #### pl = Plotter(scaleY='log') #,scaleX='log') pl.add(ellkk, 4. * Clkk / 2. / np.pi) # CHECK THAT NORM MATCHES HU/OK for polComb, col in zip(polCombList, colorList): if polComb == 'EB': lsold, Nlsold, eff = myNls.iterativeDelens(polComb, 1.0, True) else: lsold, Nlsold = myNls.getNl(polComb=polComb, halo=halo) try: huFile = 'data/hu_' + polComb.lower() + '.csv' huell, hunl = np.loadtxt(huFile, unpack=True, delimiter=',') except: huFile = 'data/hu_' + polComb[::-1].lower() + '.csv' huell, hunl = np.loadtxt(huFile, unpack=True, delimiter=',') pl.add(Ls, 4. * crosses[polComb + polComb] / 2. / np.pi, color=col, label=polComb) #pl.add(Ls,4.*Nls[polComb]/2./np.pi,color=col,alpha=0.2)