Esempio n. 1
0
derivRoot = "defAccExt_unlensed_dCls_"


fileList = glob.glob("output/"+derivRoot+"*.csv")
farr = np.loadtxt("output/"+derivRoot[:-5]+"fCls.csv",delimiter=',')

arrs = {}
for fileN in fileList:
    lab = fileN[len("output/"+derivRoot):-4]
    arrs[lab] = np.loadtxt(fileN,delimiter=',')


specList = ['TT','EE','BB','TE','KK','KT']
for spec in specList:
    if spec=='BB': continue
    pls = Plotter(scaleY='log',scaleX='log')

    

    ind = specList.index(spec)
    
    for lab in arrs:
        arr = arrs[lab]
        y = arr[:,ind]**2./farr[:,ind]**2.
        if lab=='tau': ls = '--'
        else: ls = "-"
        pls.add(range(arr.shape[0]),y,label=lab,ls=ls)


    pls.legendOn(loc='upper right',labsize=8)
    pls._ax.set_xlim(20.,4000.)
Esempio n. 2
0
def getTaperedMap(lkk,clkk,templateMapLoc = "../DerivGen/data/order5_lensedCMB_T_beam_cutout_3.fits",bufferFactor=2,taperWidth = 120,jackknife=36):
    # jackknife = (number of jackknife regions)
    
    assert is_square(jackknife)
    

    templateMap = liteMap.liteMapFromFits(templateMapLoc)
    templateMap.data[:,:] = 0.
    templateMap.fillWithGaussianRandomField(lkk,clkk,bufferFactor = bufferFactor)
    retMap = templateMap.copy()

    xa,xb = (templateMap.x0,templateMap.x1)
    ya,yb = (templateMap.y0,templateMap.y1)
    x0 = min(xa,xb)
    x1 = max(xa,xb)
    y0 = min(ya,yb)
    y1 = max(ya,yb)

    xl = x1-x0
    yl = y1-y0

    Neach = int(np.sqrt(jackknife))
    xeach = xl/Neach
    yeach = yl/Neach

    bufferx = 0.001
    buffery = 0.001

    smaps = []
    stapers = []
    for i in range(Neach):
        
        tx0 = x0+i*xeach
        tx1 = x0+(i+1)*xeach

        if i==0: tx0 += bufferx
        if i==Neach-1: tx1 -= bufferx
            
        for j in range(Neach):
            ty0 = y0+j*yeach
            ty1 = y0+(j+1)*yeach

            if j==0: ty0 += buffery
            if j==Neach-1: ty1 -= buffery
            
            
            print((tx0,tx1,ty0,ty1))
            smap = templateMap.selectSubMap(tx0,tx1,ty0,ty1, safe = False)
            #print smap.info()
            
            subtaper = lpol.initializeCosineWindow(smap,int(taperWidth/Neach),0)
            smap.data[:] = smap.data[:]*subtaper.data[:]
            pl = Plotter()
            pl.plot2d(smap.data)
            pl.done("kappa"+str(i)+str(j)+".png")

            smaps.append(smap)
            stapers.append(subtaper)
            
    #sys.exit()



    taper = lpol.initializeCosineWindow(retMap,taperWidth,0)
    retMap.data[:] = retMap.data[:]*taper.data[:]


    pl = Plotter()
    pl.plot2d(templateMap.data)
    pl.done("kappa.png")

    return retMap,taper,smaps,stapers
Esempio n. 3
0
myInt.addStepNz('cmbStep1', 1050., 1090.)
myInt.addStepNz('cmbStep2', myInt.zstar - 2., myInt.zstar - 1.)

print("getting cls..")

ellrange = list(range(2, ellmax, 1))
myInt.generateCls(ellrange)
truthCl = myInt.getCl("cmb", "cmb")
estCl1 = myInt.getCl("cmbDelta", "cmbDelta")
estCl2 = myInt.getCl("cmbStep1", "cmbStep1")
estCl3 = myInt.getCl("cmbStep2", "cmbStep2")
elapsedTime = time.time() - startTime

print(("Estimation took ", elapsedTime, " seconds."))

pl = Plotter(scaleY='log', scaleX='log')

cells = LF.theory.gCl("kk", ells)
pl.add(ellrange, truthCl, label="true", ls='-')
pl.add(ellrange, estCl1, label="delta", ls='-')
pl.add(ellrange, estCl2, label="step1", ls='-')
pl.add(ellrange, estCl3, label="step2", ls='-')
pl.add(ells, cells, label="CAMBkk", color='red', ls='--')
pl.legendOn(loc='upper right', labsize=10)
pl.done("output/estcls.png")

pl = Plotter()
for clNow, lab in zip([truthCl, estCl1, estCl2, estCl3],
                      ["truth", "delta", "step 40", "step 1"]):
    intmm = interp1d(ellrange, clNow, bounds_error=False, fill_value=0.)(ells)
    pl.add(ells, intmm / LF.theory.gCl("kk", ells), label=lab)
Esempio n. 4
0
dummy = makeBinfile(tempBinfile,2.,4000.,100.,redundant=True)

clkkFile = "../actpLens/data/fidkk.dat"
clkk = np.loadtxt(clkkFile)
lkk = np.arange(2,len(clkk)+2)

N = 20

estcls = []
for i in range(N):

    kappaMap,taperMap = getTaperedMap(lkk,clkk)
    print((kappaMap.data.shape))
    print((kappaMap.info()))
    sys.exit()
    lower, upper, center, bin_means = getBinnedPower(kappaMap,tempBinfile,taperMap)
    estcls.append(bin_means)
    print(i)

clmeans, covMean, cov, errMean,err,corrcoef = getStats(estcls,N)

        


pl = Plotter()
pl.add(lkk,lkk*clkk)
#pl.add(center,center*bin_means,ls="none",marker="x",color='red',markersize=8,mew=3)
pl.addErr(center,center*clmeans,yerr=center*errMean,ls="none",marker="o",color='red',markersize=8,mew=3)
pl._ax.set_xlim(0.,3500.)
pl.done("clpower.png")