Exemple #1
0
def testAgainstKSmith(pmax, beamFWHMArcmin, dCls, lclbb, rExp, rInFid, fCls,
                      fsky):
    from orphics.io import Plotter
    pl = Plotter(scaleX='log', scaleY='log')
    pnoiserange = np.logspace(np.log10(0.5), np.log10(50.), num=100)
    for pmin in [2, 5, 10, 40]:
        sigs = []
        for deltaP in pnoiserange:
            ellBBRange = range(pmin, pmax)

            sigs.append(
                rSigma(fsky, ellBBRange, beamFWHMArcmin, deltaP, dCls[:, 2],
                       lclbb, rExp * fCls[:, 2] / rInFid))

        kn, kr = np.loadtxt("data/k" + str(pmin) + ".csv",
                            delimiter=',',
                            unpack=True)
        pl.add(kn, kr, ls='--')
        pl.add(pnoiserange,
               sigs,
               label="$\\ell_{\mathrm{min}}=" + str(pmin) + "$")

    pl.legendOn()
    pl._ax.set_xlim(0.5, 50.)
    pl._ax.set_ylim(1.e-5, 1.e-1)
    pl.done("kenplot.png")
Exemple #2
0
 def PlotcmbWeights(self,outfile):
     
     #plot weights
     pl = Plotter()
     for ii in range(len(self.freq)):
         pl.add(self.evalells,self.W_ll_cmb[:,ii],label=str(self.freq[ii])+' GHz')
     pl.legend(loc='lower left',labsize=10)
     pl.done(outfile)
Exemple #3
0
                      2 * xerr - pad / 2.,
                      N,
                      facecolor=col))  #,alpha=0.5))
        #currentAxis.add_patch(Rectangle((zcent - xerr+pad+pad/3., 0), 2*xerr-pad/2., N2, facecolor=col))
    pl.add([0, 0], [0, 0], ls='-', linewidth=4, label=expName, color=col)
    massSense = lndM  #*100./np.sqrt(Nmz)
    massSense = interpolate_grid(
        massSense, masses, zrange, 10**mexp_new, z_new,
        regular=True)  #,kind="cubic",bounds_error=False,fill_value=np.inf)
    print((massSense.shape), testcount)
    fsense = massSense / np.sqrt(rn)

pl.legend(labsize=9, loc='upper right')
pl._ax.set_ylim(1, 5.e4)  # fsky
pl._ax.set_xlim(0., 3.)
pl.done(outDir + "clNofz.pdf")

fsense[fsense > 10.] = np.nan
from orphics.io import Plotter
import os
mmin = mgrid.min()
mmax = mgrid.max()
zmin = zgrid.min()
zmax = zgrid.max()
pgrid = np.rot90((fsense))
pl = Plotter(xlabel="$\\mathrm{log}_{10}(M)$", ylabel="$z$", ftsize=14)
pl.plot2d(pgrid,
          extent=[mmin, mmax, zmin, zmax],
          labsize=14,
          aspect="auto",
          lim=[0., 10.])
Exemple #4
0
        pl.add(ellkk,(fp(ellkk))-Clkk,color=col,lw=2)

        Nlkk2d = qest.N.Nlkk[polComb]
        ncents, npow = stats.bin_in_annuli(Nlkk2d, p2d.modLMap, bin_edges)
        pl.add(ncents,npow,color=col,lw=2,ls="--")

        


    avgInputPower  = totAllInputPower/N
    pl.add(centers,avgInputPower,color='cyan',lw=3) # ,label = "input x input"


    pl.legendOn(labsize=10,loc='lower left')
    pl._ax.set_xlim(kellmin,kellmax)
    pl.done("tests/output/power.png")


    # cross compare to power of input (percent)
    pl = Plotter()

    for polComb,col in zip(polCombList,colorList):
        cross = statsCross[polComb]['mean']
        
        
        pl.add(centers,(cross-avgInputPower)*100./avgInputPower,label=polComb,color=col,lw=2)


    pl.legendOn(labsize=10,loc='upper right')
    pl._ax.set_xlim(kellmin,kellmax)
    pl._ax.axhline(y=0.,ls="--",color='black',alpha=0.5)
Exemple #5
0
zgrid = old_div((z_edges[1:]+z_edges[:-1]),2.)


zz = np.arange(0.1,2.01,0.05)
MMexp = np.arange(13.5,15.71,0.1)
MM = 10**MMexp

hscgrid = np.loadtxt("data/HSC_DeltalnM_z0_z2_17_04_04.txt")


sngrid = old_div(1.,hscgrid)    
pgrid = np.rot90(sngrid)
pl = Plotter(xlabel="$\\mathrm{log}_{10}(M)$",ylabel="$z$",ftsize=14)
pl.plot2d(pgrid,extent=[MMexp.min(),MMexp.max(),zz.min(),zz.max()],levels=[3.0,5.0],labsize=14,aspect="auto")
pl.done(outDir+"origHSCgrid.png")


print(hscgrid.shape)


#outmerr = interpolateGrid(hscgrid,MM,zz,M,zgrid,regular=False,kind="cubic",bounds_error=False,fill_value=np.inf)
outmerr = interpolateGrid(hscgrid,MM,zz,M,zgrid,regular=False,kind="cubic",bounds_error=False)


sngrid = old_div(1.,outmerr)
pgrid = np.rot90(sngrid)
pl = Plotter(xlabel="$\\mathrm{log}_{10}(M)$",ylabel="$z$",ftsize=14)
pl.plot2d(pgrid,extent=[mgrid.min(),mgrid.max(),zgrid.min(),zgrid.max()],levels=[3.0,5.0],labsize=14,aspect="auto")
pl.done(outDir+"interpHSCgrid.png")
Exemple #6
0
        khup,Pup = np.loadtxt(dRoot+"Up_matterpower_"+str(z)+".dat",unpack=True)
        khdn,Pdn = np.loadtxt(dRoot+"Dn_matterpower_"+str(z)+".dat",unpack=True)
        assert np.all(np.isclose(khup,khdn))
        stepF = float(step)
        dP = old_div((Pup-Pdn),stepF)

        #if z<2.5: continue
        if z>0.2: continue

        #alph = 1.-z/3.0
        alph = 1.
        pl.add(khup,-dP,color=col,alpha=alph)
    pl.add(khup,-dP*0.,color=col,alpha=1.,ls="-",label=step)

pl.legendOn()
pl.done(os.environ['WWW']+"dps.png")




fparams = {}   # the 
for (key, val) in Config.items('params'):
    if ',' in val:
        param, step = val.split(',')
        fparams[key] = float(param)
    else:
        fparams[key] = float(val)
passParams = fparams
from szar.counts import ClusterCosmology,Halo_MF
cc = ClusterCosmology(passParams,constDict,clTTFixFile=clttfile)
HMF = Halo_MF(cc,Mexp_edges,z_edges)
Exemple #7
0
        zmax = outzgrid[-1]



        jointgridsqinv += (old_div(1.,outerrgrid**2.))


    jointgrid = np.sqrt(old_div(1.,jointgridsqinv))
    snjoint = old_div(1.,jointgrid)

    for ind in mindicesList:
        pl.add(outzgrid,snjoint[ind,:].ravel(),ls="-.")
        print(mexpgrid[ind])

    pl.legendOn(loc='upper right',labsize=10)
    pl.done(outDir+"slice"+cmbtype+".pdf")


    #pl.legendOn(loc='upper right',labsize=8)
    #pl.done(outDir+"slice.pdf")


    #from orphics.io import Plotter
    pgrid = np.rot90(old_div(1.,jointgrid))
    pl = Plotter(labelX="$\\mathrm{log}_{10}(M)$",labelY="$z$",ftsize=14)
    pl.plot2d(pgrid,extent=[mmin,mmax,zmin,zmax],levels=[1.0,3.0,5.0],labsize=14)
    pl.done(outDir+"joint"+cmbtype+".png")


    #savefile = "/astro/astronfs01/workarea/msyriac/data/SZruns/v0.6/lensgrid_S4-1.0-0.4_grid-default_CMB_all_joint_v0.5.pkl"
    #savefile = "/astro/astronfs01/workarea/msyriac/data/SZruns/v0.6/lensgridRayUp_S4-1.0-0.4_grid-default_CMB_all_joint_v0.5.pkl"
Exemple #8
0
        xerrs.append(xerr)
        s8now = np.mean(s81zs[np.logical_and(zrange >= zleft,
                                             zrange < zright)])
        print(lab, zleft, zright, yerr, s8now, yerr * 100. / s8now, "%")
        #s8now = np.mean(s81zs[np.logical_and(zrange>=zleft,zrange<zright)])/s81
        #yerrsq = (1./sum([1/x**2. for x in errselect]))
        #yerr = (s8now/s80mean)*np.sqrt(yerrsq/s8now**2. + yerrsq0/s80mean**2.)
        errcents.append(yerr)
        ms8.append(s8now)
        currentAxis.add_patch(
            Rectangle((zcent - xerr + pad, 1. - old_div(yerr, s8now)),
                      2 * xerr - old_div(pad, 2.),
                      2. * yerr / s8now,
                      facecolor=col))
    print("=====================")
    pl._ax.fill_between(zrange, 1., 1., label=lab, alpha=0.75, color=col)

#pl.add(zrange,s82zs/s81zs,label="$w=-0.97$",color='red',alpha=0.5)
pl.add(zrange, old_div(s81zs, s81zs), color='black', alpha=0.5,
       ls="--")  #,label="$w=-1$")

# pl.add(zrange,s82zs/s81zs/s82*s81,label="$w=-0.97$",color='red',alpha=0.5)
# pl.add(zrange,s81zs*0.+1.,label="$w=-1$",color='black',alpha=0.5,ls="--")

pl.legendOn(labsize=9)
#pl._ax.set_ylim(0.9,1.1) # res
#pl._ax.set_ylim(0.95,1.05) # fsky
#pl._ax.text(0.8,.82,"Madhavacheril et. al. in prep")
pl.done(outDir + "S4_" + cal + "_fsky.png")
#pl.done(outDir+"s8SO.png")
Exemple #9
0
                               pad_width=((0, numLeft), (0, numLeft)),
                               mode="constant",
                               constant_values=0.)

        FisherTot = Fisher + fisherPlanck
        FisherTot += fisherBAO

        Finv = np.linalg.inv(FisherTot)

        errs = np.sqrt(np.diagonal(Finv))
        errDict = {}
        for i, param in enumerate(paramList):
            errDict[param] = errs[i]

        if fishName == 'mnu':
            constraint = errDict[fishName] * 1000
        elif fishName == 'w0':
            constraint = errDict[fishName] * 100
        sigs.append(constraint)
        if (np.abs(preVal - constraint) * 100. / constraint) < pertol:
            print((constraint - preVal) * 100. / constraint)
            if k > mink: break
        preVal = constraint
        print(prior, val, constraint)
        k += 1

    priorLabel = paramLatexList[paramList.index(prior)]
    pl.add(xs, sigs, label="$" + priorLabel + "$")
pl.legendOn(loc='upper right', labsize=8)
pl.done(os.environ['WWW'] + "plots/priors_" + fishName + ".pdf")
Exemple #10
0
    # pl.done("clbb.png")

    
    fflbb = interp1d(range(len(fCls[:,2])),rExp*fCls[:,2]/rInFid,bounds_error=False,fill_value=np.inf)
    fdCls = interp1d(range(len(dCls[:,2])),dCls[:,2],bounds_error=False,fill_value=np.inf)

    from orphics.io import Plotter
    ells = np.arange(0,len(fidCls[:,0]),1)
    clee = fidCls[:,1]
    clbb = fidCls[:,2]
    nlbbsmall = fnBBSmall(ells)
    pl = Plotter(yscale='log')
    pl.add(ells,clee*ells*(ells+1.)/2./np.pi)
    pl.add(ells,clbb*ells*(ells+1.)/2./np.pi)
    pl.add(ells,nlbbsmall*ells*(ells+1.)/2./np.pi)
    pl.done("cls.png")
    

    fclbbTot = lambda x: fclbb(x)*(1.+fgPer/100.)
    r0 = rSigma(fsky,ellBBRange,fnBBSmall,fdCls,fclbbTot,fflbb)
    cprint("sigma(r) without delensing: "+ str(r0*1e4)+"e-4",color="green",bold=True)
    rs.append(r0)
    fdlbb = cosmology.noise_pad_infinity(interp1d(ellbb,dlbb*TCMB**2.,fill_value=np.inf,bounds_error=False),spellmin,spellmax)

    fclbbTot = lambda x: fdlbb(x)+fclbb(x)*fgPer/100.

    r = rSigma(fsky,ellBBRange,fnBBSmall,fdCls,fclbbTot,fflbb)
    cprint("sigma(r) with delensing: "+ str(r*1e4)+"e-4",color="green",bold=True)
    rdelens.append(r)