def growth_rate(a): gamma = 0.545 z = 1. / a - 1. # rho_c = 3 * H^2 / (8 * pi G) # om_m(a) = (rho_m/rho_c) = 8 * pi * G *rho_m(0) * a^-3 / (3 H^2) # = om_m(a = 1) * a^-3 * (H_0/H)^2 om_ma = params['om_m'] * (cosmo.H(0) / cosmo.H(z))**2. * a**-3. return om_ma.value**gamma
def Ckk(Pk_interps, Llls, pickle=False, zmax=params['zscatter']): ''' Given a matter power spectrum interpolator and an array of L values, return Ckk(L) in the extended Limber approximation. ''' z = np.linspace(0.001, zmax, 2000) chis = comoving_distance(z) ## Stores the matter power spectrum for each of (L, z) and therefore k ## in the extended Limber approximation. result = np.zeros((len(z), len(Llls))) for i, redshift in enumerate(z): ks = (Llls + 0.5) / chis[i] result[i, :] = Pmm(Pk_interps, ks, redshift) prefactor = (const.c.to('km/s').value / cosmo.H(z).value) * (lensing_kernel(z) / chis)**2. integrand = prefactor[:, None] * result integrand /= params['h_100']**3. ## account for [h^-1 Mpc]^3 of Pmm. result = simps(integrand, dx=z[1] - z[0], axis=0) if pickle: from pickle import dump ## New beam/noise configurations require pickle files to be removed. dump(result, open("pickle/kk.p", "wb")) ## Ckk at each L, after integrating the lensing kernel over redshift. return result
def Cgg(Pk_interps, Llls, zmin, zmax, survey_pz, bz, survey_pz2=None, bz2=None, zeff=True): dz = 0.01 zs = np.arange(zmin, zmax + dz, dz) ## Catch normalisation of p(z). Added 03/01/19. ps = survey_pz(zs) norm = np.sum(ps) * dz ps /= norm chis = comoving_distance(zs) if bz2 is None: bz2 = bz if survey_pz2 is None: survey_pz2 = survey_pz ps2 = np.copy(ps) else: ps2 = survey_pz2(zs) norm = np.sum(ps2) * dz ps2 /= norm if zeff: ''' Compute Cgg in the z_eff and first-order Limber approximations for a slice of galaxies at zz of width dz; eqn. (5) of https://arxiv.org/pdf/1511.04457.pdf ''' zz = dz * np.sum(ps * zs) / (np.sum(ps) * dz) ## Normalisation should already be unity. ks = (Llls + 0.5) / comoving_distance(zz) ## For the Phh evaluation in the integral, we take a zeff approx. ## i.e. \int dz .... Phh(zeff). result = Pmm(Pk_interps, ks, zz) * bz(zz) * bz2(zz) result = np.broadcast_to(result, (len(zs), len(Llls))) ## Broadcast to each redshift. else: result = np.zeros((len(zs), len(Llls))) for i, z in enumerate(zs): ks = (Llls + 0.5) / chis[i] ## Evaluate Phh for each z and k(ell, z). result[i,:] = Pmm(Pk_interps, ks, z) * bz(z) * bz2(z) ## Accounts for both spatial to angular mapping as function of z; i.e. k = (l. + 0.5) / chi(z) and redshift evolution of P_mm(k). prefactor = (cosmo.H(zs).value / const.c.to('km/s').value) * sliced_pz(zs, zmin, zmax, survey_pz)\ * sliced_pz(zs, zmin, zmax, survey_pz2)\ / chis**2. integrand = prefactor[:, None] * result integrand /= params['h_100'] return simps(integrand, dx = dz, axis=0) ## integral over z.
def WCIB(z, nu=353., zc=2., sigmaz=2.): ''' Input: nu in GHz; [545, 857, 217, 353] GHz. ''' result = fv(nu * (1. + z), beta=2., T=34., nup=4955, alpha=0.0) result *= np.exp(-0.5 * (z - zc)**2. / sigmaz**2.) result *= comoving_distance(z)**2. result /= (cosmo.H(z).value * (1. + z)**2.) result /= result.max() return result
def Cab(Llls, spec_z, surveya='LSST', surveyb='QSO', alpha=1.0, sigma=2., zeff=True, nowiggle=False): ''' Angular correlation function: i.e. C_sp(L, z). ''' z = np.arange(0.01, 5.0, 0.01) chis = comoving_distance(z) ba = bzs(spec_z, surveya) bb = bzs(spec_z, surveyb) if zeff == True: ''' Compute Cgg in the z_eff and first-order Limber approximations for a slice of galaxies at spec_z of width dz. eqn. (5) of https://arxiv.org/pdf/1511.04457.pdf ''' ks = (Llls + 0.5) / comoving_distance( spec_z ) ## For the Phh evaluation in the integral, we take a zeff approx. ## i.e. \int dz .... Phh(zeff). result = np.broadcast_to( Pab(ks, ba, bb, alpha, sigma, nowiggle), (len(z), len(Llls))) ## Broadcast to each redshift. else: result = np.zeros((len(spec_z), len(Llls))) for i, j in enumerate(z): ks = (Llls + 0.5) / chis[i] ## Evaluate Phh for each z and k(ell, z). ## Given L mixes at range of k -- washes out BAO. ## accounts for spatial to angular mapping as function of z, i.e. k = (l + 0.5)/chi(z) but neglects redshift evolution of Pps(k). result[i, :] = Pab(ks, ba, bb, alpha, sigma, nowiggle) prefactor = (cosmo.H(z).value/const.c.to('km/s').value)*(sliced_pz(z, spec_z, survey_dzs[surveya], surveya, True)/chis) \ *(sliced_pz(z, spec_z, survey_dzs[surveyb], surveyb, True)/chis) integrand = prefactor[:, None] * result integrand /= params[ 'h_100'] ## account for [h^-1 Mpc]^3 of P(k) and h^-1 Mpc of chi_g. return simps(integrand, dx=z[1] - z[0], axis=0) ## integral over z.
def projected_crosspower(ks, surveya, surveyb, nowiggle=False, alpha=1.0): dz = 0.01 zs = np.arange(dz, 6.0, dz) gzs, gks = np.meshgrid(zs, ks) prefactor = (cosmo.H(zs).value / const.c.to('km/s').value) prefactor *= sliced_pz(zs, 0.75, 1.00, surveya, normed=True) prefactor *= sliced_pz(zs, 0.75, 0.15, surveyb, normed=True) * dz integrand = Pab(gks, ba=1.7, bb=2.0, alpha=alpha, sigma=0.0, nowiggle=nowiggle) integrand *= prefactor return np.sum(integrand, axis=1)