Example #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")
Example #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)
Example #3
0
cc = ClusterCosmology(fparams, constDict, clTTFixFile=clttfile)

from matplotlib.patches import Rectangle

#expList = ['CMB-Probe-v3-1']
#expList = ['S4-1.0-CDT','S4-1.5-CDT']#,'S4-2.0-0.4','S4-2.5-0.4','S4-3.0-0.4']
#expList = ['S4-1.0-0.4','S4-1.5-0.4','S4-2.0-0.4','S4-2.5-0.4','S4-3.0-0.4']
#expList = ['S4-2.0-0.4']#,'S4-1.5-0.4','S4-1.5-0.3','S4-1.5-0.2','S4-1.5-0.1','S4-1.5-0.05']
#expList = ['S4-1.0-0.4','S4-1.5-0.4','S4-2.0-0.4','S4-2.5-0.4','S4-3.0-0.4']
#expList = ['SO-v3-goal-40','SO-v3-base-40']#,'SO-v3-goal-20','SO-v3-base-20','SO-v3-goal-10','SO-v3-base-10']
expList = ['CMB-Probe-v4-CBE', 'CMB-Probe-v4-REQ']
expList = ['SO-v3-goal-40', 'SO-v3-goal-40']

pad = 0.05

pl = Plotter(xlabel="$z$", ylabel="$N(z)$", ftsize=12, yscale='log')
#pl = Plotter(labelX="$z$",labelY="$N(z)$",ftsize=12)

colList = ['C0', 'C1', 'C2', 'C3', 'C4', 'C5']
for expName, col, ver in zip(expList, colList, version):

    mgrid, zgrid, siggrid = pickle.load(
        open(
            bigDataDir + "szgrid_" + expName + "_" + gridName + "_v" + ver +
            ".pkl", 'rb'))

    #for expName,col in zip(expList,colList):

    #    mgrid,zgrid,siggrid = pickle.load(open(bigDataDir+"szgrid_"+expName+"_"+gridName+ "_v" + version+".pkl",'rb'))

    if (cal == 'owl2'):
Example #4
0
        comm.Recv(rcvTotInputPower, source=job, tag=800)
        totAllInputPower = totAllInputPower + rcvTotInputPower

        for i,polComb in enumerate(polCombList):
            print(("Waiting for ", job ," ", polComb," cross"))
            comm.Recv(rcvInputPowerMat, source=job, tag=i)
            listAllCrossPower[polComb] = np.vstack((listAllCrossPower[polComb],rcvInputPowerMat))
            print(("Waiting for ", job ," ", polComb," auto"))
            comm.Recv(rcvInputPowerMat, source=job, tag=i+80)
            listAllReconPower[polComb] = np.vstack((listAllReconPower[polComb],rcvInputPowerMat))
        

    statsCross = {}
    statsRecon = {}

    pl = Plotter(scaleY='log')
    pl.add(ellkk,Clkk,color='black',lw=2)
    

    for polComb,col in zip(polCombList,colorList):
        statsCross[polComb] = get_stats(listAllCrossPower[polComb])
        pl.addErr(centers,statsCross[polComb]['mean'],yerr=statsCross[polComb]['errmean'],ls="none",marker="o",markersize=8,label="recon x input "+polComb,color=col,mew=2,elinewidth=2)

        statsRecon[polComb] = get_stats(listAllReconPower[polComb])
        fp = interp1d(centers,statsRecon[polComb]['mean'],fill_value='extrapolate')
        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="--")
Example #5
0
M = old_div((M_edges[1:]+M_edges[:-1]),2.)
mgrid = np.log10(M)

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")
Example #6
0
from orphics.io import dict_from_section, list_from_config
constDict = dict_from_section(Config,'constants')
clttfile = Config.get('general','clttfile')
gridName = "grid-default"
ms = list_from_config(Config,gridName,'mexprange')
Mexp_edges = np.arange(ms[0],ms[1]+ms[2],ms[2])
zs = list_from_config(Config,gridName,'zrange')
z_edges = np.arange(zs[0],zs[1]+zs[2],zs[2])


zrange = old_div((z_edges[1:]+z_edges[:-1]),2.)
#np.arange(0.05,3.05,0.1)

cambRoot = os.environ['HOME']+"/software/CAMB_wa/"

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

#stepList = ['0.1','0.05','0.2','1.0','0.001']
#colList = ['C0','C1','C2','C3','C4']

stepList = ['2.0','1.5','1.0','0.2']
colList = ['C0','C1','C2','C3']

# stepList = ['0.1','0.05','0.2','0.001']
# colList = ['C0','C1','C2','C4']

for step,col in zip(stepList,colList):
    dRoot = cambRoot+"forDerivsStep"+step
    for z in zrange:

        khup,Pup = np.loadtxt(dRoot+"Up_matterpower_"+str(z)+".dat",unpack=True)
Example #7
0
from orphics.io import Plotter
    
for cmbfile,cmbtype,save_func in zip([fidcmb_file,upcmb_file,dncmb_file],['fid','up','dn'], \
                                    [sfisher.mass_grid_name_cmb,sfisher.mass_grid_name_cmb_up,sfisher.mass_grid_name_cmb_dn]):


    grids = {}
    mmins = []
    mmaxes = []
    zmins = []
    zmaxes = []
    dms = []
    dzs = []

    pl = Plotter(labelX="$z$",labelY="S/N per cluster",ftsize=14)

    gridList = [cmbfile,owl_file]

    for gridFile,ls,lab,outPlot in zip(gridList,['-','--'],['CMB lensing','optical lensing'],['cmb','owl']):


        medges,zedges,errgrid = pickle.load(open(gridFile,'rb'))


        print(errgrid.shape)
        M_edges = 10**medges
        M = old_div((M_edges[1:]+M_edges[:-1]),2.)
        mexpgrid = np.log10(M)
        zgrid = old_div((zedges[1:]+zedges[:-1]),2.)
Example #8
0
s82zs = As2 * s82

outDir = "/gpfs01/astro/www/msyriac/web/work/"

zbins = np.append(np.arange(0., 2.5, 0.5), 3.0)
#zbins = np.append(np.arange(2.,3.0,0.2),3.0)
#zbins = np.array([0.5,3.0])#np.arange(1.5,3.0,0.1)
#zbins = zrange

#zbins = np.append(np.arange(2.,2.5,0.5),3.0)

#zbins = np.arange(0.,3.5,0.5)
#zbins = np.arange(0.,3.1,0.1)

pl = Plotter(labelX="$z$",
             labelY="$\sigma_8(z)/\sigma_8(z)_{w=-1}$",
             ftsize=12)
#pl = Plotter(labelX="$z$",labelY="$\sigma_8(z)$",ftsize=12)
#pl = Plotter(labelX="$z$",labelY="$D(z)/D(z)_{w=-1}$",ftsize=12)

colList = ['C0', 'C1', 'C2', 'C3', 'C4', 'C5']
#['coral','forestgreen','gold','indigo','purple']

from matplotlib.patches import Rectangle
currentAxis = plt.gca()
#for i,(f,lab,col) in enumerate(zip([cmbfisher3,cmbfisher15,cmbfisher0],['3.0\'','2.0\'','1.0\''],colList)):
#for i,(f,lab,col) in enumerate(zip([cmbfisher3,cmbfisher15,cmbfisher1,cmbfisher0],['3.0\'','2.0\'','1.5\'','1.0\''],colList)):
for i, (f, lab, col) in enumerate(
        zip([cmbfisher1, cmbfisher0], ['1.5\'', '1.0\''], colList)):
    #for i,(f,lab,col) in enumerate(zip([cmbfisher3,cmbfisher2,cmbfisher15,cmbfisher1,cmbfisher0],['3.0\'','2.5\'','2.0\'','1.5\'','1.0\''],colList)):
    #for i,(f,lab,col) in enumerate(zip([cmbfisher3,cmbfisher2,cmbfisher15,cmbfisher1,cmbfisher0,cmbfisher01],['0.05','0.1','0.2','0.3','0.4','0.7'],colList)):
Example #9
0
priorList['ns'] = 0.006
priorList['As'] = 5.e-12

priorList['alpha_ym'] = 0.179
priorList['b_wl'] = 0.1
priorList['b_ym'] = 0.08
priorList['beta_ym'] = 0.1
priorList['gamma_ym'] = 0.1
priorList['Ysig'] = 0.0127
priorList['gammaYsig'] = 0.1
priorList['betaYsig'] = 1.0

import os
if fishName == 'mnu':
    pl = Plotter(labelY="$\sigma(" +
                 paramLatexList[paramList.index(fishName)] + ")$",
                 labelX="Iteration",
                 ftsize=12)
elif fishName == 'w0':
    pl = Plotter(labelY="$\\frac{\sigma(" +
                 paramLatexList[paramList.index(fishName)] + ")}{" +
                 paramLatexList[paramList.index(fishName)] + "}\%$",
                 labelX="Iteration",
                 ftsize=12)

priorNameList = []
priorValueList = []
iterations = 0

numlogs = 30
pertol = 0.1
mink = 5
Example #10
0
    # pl = Plotter(scaleY='log',xscale='log')
    # pl.add(ellBBRange,clbbnow*ellBBRange**2.)
    # pl.add(ellbb,dlbb*ellbb**2.)
    # # pl._ax.set_ylim(-max(Clkk),max(Clkk))
    # 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)