CAMB: Redshift distributions of CMB and galaxy lensing kernels

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Post Reply
Aruna Harikant
Posts: 3
Joined: March 11 2023
Affiliation: University of Sussex

CAMB: Redshift distributions of CMB and galaxy lensing kernels

Post by Aruna Harikant » October 05 2023

[img]
CMB&Galaxy.png
CMB&Galaxy.png (146.06 KiB) Viewed 5244 times

Code: Select all

import numpy as np
import matplotlib.pyplot as plt
import camb
from camb import model, initialpower

# Set up the cosmological parameters
pars = camb.CAMBparams()
pars.set_cosmology(H0=67.5, ombh2=0.022, omch2=0.122)
pars.InitPower.set_params(ns=0.965)
pars.set_for_lmax(2500, lens_potential_accuracy=1)

# Obtain results from CAMB
results = camb.get_results(pars)

# Redshift range
z = np.logspace(-2, 3, 300)

# Galaxy lensing kernel
z0 = 1.0
sigma_z = 1.0
dNdz = np.exp(-(z - z0)**2 / (2 * sigma_z**2))
chi = results.comoving_radial_distance(z)
chi_star = results.comoving_radial_distance(1100)
W_gal = chi * (1 - chi / chi_star) * dNdz

# CMB lensing kernel
W_cmb = 1.5 * pars.omegam * (1 + z) * chi * (chi_star - chi) / chi_star**2

plt.figure(figsize=(10, 5))
plt.plot(z, W_gal/W_gal.max(), label='Galaxy lensing', color='orange')
plt.plot(z, W_cmb/W_cmb.max(), label='CMB lensing', color='blue')
plt.axvline(z[np.argmax(W_gal)], color='black', linestyle='--', linewidth=0.7)
plt.xscale('log')
plt.xlim(z.min(), z.max())
plt.ylim(0, 1.1)
plt.xlabel('Redshift z')
plt.ylabel('Weight $W(z)/W_{max}$')
plt.legend()
plt.grid(True, which='both', linestyle='--', linewidth=0.5)
plt.tight_layout()
plt.show() 
[math]
I want to plot the galaxy lensing and CMB lensing kernel. I suspect that something might be wrong with this plot. I'm sharing my code for this plot. Could you please at this plot and let me know if you see anything wrong with my code?

I appreciate your time and consideration in addressing my query beforehand.

Regards,
-Aruna

Post Reply