Exemplo n.º 1
0
def redshift():
    """
    Evolution with redshift of matter power spectrum
    """
    zs = M.arange(0.,5.,2.)

    for z in zs:
        print z
        c = pt.Camb(hubble = 70., ombh2 = 0.05*(0.7)**2, omch2 = 0.25*(0.7)**2,transfer_redshift = [z])
        c.run()
        ps = pt.PowerSpectrum(c.cp)
        c.kextend(-10,60) #To ensure accurate sigma(r) -- if it doesn't, a warning will ensue
        pt.normalizePk(c,0.8*ps.d1(z)/ps.d1(0.)) #sigma_8 at redshift z
        
        #Sheth-Tormen
        h = halo.HaloModel(c,st_big_a = 0., st_little_a=0.707, stq = 0.3, k = 10**M.arange(-2,2.01,0.2),massdivsperdex=5)

        h.pmm = halo.getHaloPknl(c,h)
        M.loglog(h.k, h.pmm, label='z='+str(z))
        M.loglog(h.k, h.pk,'k:',label='linear')

        cp_halofit = c.cp
        cp_halofit['do_nonlinear'] = 1 # Halofit (Smith et al) fit
        chalofit = pt.Camb(cambParam=cp_halofit)
        chalofit.run()
        wheretoplot = N.where(chalofit.k > 1e-2)[0]
        M.loglog(chalofit.k[wheretoplot[::10]],chalofit.pk[wheretoplot[::10]],'--',label='halofit')

    M.legend()
    M.show()
Exemplo n.º 2
0
def hod():
    """
    Displays various galaxy power spectra w/ different HOD's.
    See param.py for explanations of hod params.

    camb needs to be in ../CAMB by default, but that can be changed in pt.py
    """

    c = pt.Camb(hubble = 70., ombh2 = 0.05*(0.7)**2, omch2 = 0.25*(0.7)**2) #may want to go out to transfer_kmax=100 for high accuracy
    c.run()
    pt.normalizePk(c,0.8) #sigma_8
    c.kextend(-10,60) #needed so that sigma(r) integral converges for a wide range of r

    #Sheth-Tormen
    h = halo.HaloModel(c,st_big_a = 0., st_little_a=0.707, stq = 0.3, k = 10**M.arange(-2,2.,0.1),massdivsperdex=5)

    h.pmm = halo.getHaloPknl(c,h)
    
    h.p.whichp='gg' # by default, h.p.whichp = 'mm', returning the matter power spectrum

    # by default, h.p.k_mmin_msun = 1e11, h.p,k_betas = 1
    mmins = 10.**M.arange(10.,12.01,0.2)
    for i in range(len(mmins)):
        h.p.k_mmin_msun = mmins[i]
        h.refreshHOD(c)
        h.pgg = halo.getHaloPknl(c,h)
        M.loglog(h.k,h.pgg,'y')

    M.loglog(h.k,h.pk,'k')
    M.loglog(h.k,h.pmm,'b')
    M.show()

    betas = M.arange(0.5,1.5,0.1)
    h.p.k_mmin_msun = 1e11
    for i in range(len(betas)):
        h.p.k_betas = betas[i]
        h.refreshHOD(c)
        h.pgg = halo.getHaloPknl(c,h)
        M.loglog(h.k,h.pgg,'y')

    M.loglog(h.k,h.pk,'k')
    M.loglog(h.k,h.pmm,'b')
    M.show()