CAMB: use of window function in calculation

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Post Reply
Lanyang Yi
Posts: 2
Joined: November 28 2022
Affiliation: UCAS,NAOC

CAMB: use of window function in calculation

Post by Lanyang Yi »

Hello,

I'm trying to write a program to calculate galaxy angular power spectra and compare my result with that calculated by camb. In camb I use Gaussian window function with redshift=0.272, sigma=0.1 in calculation. Here is my camb code

Code: Select all

lmax = 2500
pars = camb.CAMBparams()
pars.set_cosmology(H0=67.5, ombh2=0.022, omch2=0.122)
pars.InitPower.set_params(As=2e-9, ns=0.965)
pars.set_for_lmax(lmax, lens_potential_accuracy=1)
pars.Want_CMB = False 
pars.NonLinear = model.NonLinear_both

pars.SourceTerms.limber_windows = False
#pars.SourceTerms.counts_redshift = False
pars.SourceWindows = [GaussianSourceWindow(redshift=0.272, source_type='counts', bias=1.5, sigma=0.1, dlog10Ndm=-0.2)]

results = camb.get_results(pars)
cls = results.get_source_cls_dict()
In my program to calculate counts angular power spectra, I directly use the Gaussian distribution function as

Code: Select all

qgal = 1.5 * np.exp(-(zs - 0.272) ** 2 / 2 / 0.1 ** 2) / np.sqrt(2 * np.pi) / 0.1
where 1.5 is the bias, and calculate counts angular power spectra using limber approximation [math], where qgal is kernel [math] in the formula and matter power spectra [math] is calculated by camb with the same setting above.

But when comparing two results, I find they are not of the same order of magnitude. It seems that camb only uses the shape of Gaussian distribution, and it multiplies distribution function by a factor unknown for me. Until now I don't successfully find the related code in camb. So how does camb use the window function when calculating angular power spectra? Or in which file can I find it?

Thanks,
Lanyang
Antony Lewis
Posts: 1980
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

Re: CAMB: use of window function in calculation

Post by Antony Lewis »

The Gaussian function is TGaussianSourceWindow_count_obs_window_z in SourceWindows.f90. Note it's a Gaussian in z not in chi. Power spectra are returned for fractional perturbations.
Lanyang Yi
Posts: 2
Joined: November 28 2022
Affiliation: UCAS,NAOC

Re: CAMB: use of window function in calculation

Post by Lanyang Yi »

Hi Antony,

Thanks for your reply. Of course I use Gaussian in z in camb. In my program, I calculate chi at each z I use and do a interpolation to make window function in chi, then I use the formula mentioned above.TGaussianSourceWindow_count_obs_window_z only tells me the form of Gaussian distribution, but I don't know how camb use it in get_source_cls_dict().
When I compare the plot of Gaussian distribution and n(z) of lensing galaxy in DES Y1, I find the their peaks are not of the same order, they become consistent after I do the normalization to n(z). n(z) is considered as [math] with bias in [math] after being interpolated in chi in CosmoMC and in my program. When I directly use n(z) in DES to calculate angular power spactra and compare its result with that from camb with the shape of Gaussian window function I use similar to n(z), I find their results similar too.
Maybe I didn't express clearly in my question, now I know that window function has the similar function to n(z) in power spectra calculation, but for Gaussian window function it actually doesn't have the same order as n(z). So what's the relation between n(z) and window function used in camb?
Antony Lewis
Posts: 1980
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

Re: CAMB: use of window function in calculation

Post by Antony Lewis »

It is the same thing. Make sure you have the dchi/dz Jacobian if you are using W(\chi) instead.
Post Reply