lesgourg / class_public

Public repository of the Cosmic Linear Anisotropy Solving System (master for the most recent version of the standard code; GW_CLASS to include Cosmic Gravitational Wave Background anisotropies; classnet branch for acceleration with neutral networks; ExoCLASS branch for exotic energy injection; class_matter branch for FFTlog)
223 stars 291 forks source link

How to plot \sigma(M,z)? #221

Open HamedBN opened 6 years ago

HamedBN commented 6 years ago

Dear all; I am new in CLASS. I am going to plot \sigma(M) for specific matter power spectrum, where \sigma is the the variance of matter perturbations. How can I do this? Thank you in advance.

Stefan-Heimersheim commented 6 years ago

Hey,

I'm not sure if I understand your question correctly. As far as I know, the matter power spectrum P_m(k) is defined as the variance P_m(k)=<|\delta_m(k)|^2> where delta_m are the matter perturbations. So \sigma is the matter power spectrum?

If you want to plot the matter power spectrum, you need the option output = mPk in you parameters (the .ini file). You can find more information in the explanatory.ini (approx. line 300):

1.a) list of output spectra requested: [...] - 'mPk' for total matter power spectrum P(k) infered from gravitational potential,

Cheers, Stefan

HamedBN commented 6 years ago

Dear Stefan, No, \sigma is the variance of matter perturbations. Is there any way to plot this quantity without using python wrapper? Best, Hamed.

Stefan-Heimersheim commented 6 years ago

Oh, I see. With \sigma you mean the k-Integral over the matter power spectrum 4πk² P(k) as defined e.g. here (on page 4). I don't think class has a output option for that quantity, at least I don't remember seeing one and did not find one in the explanatory.ini.

Best, Stefan

ThomasTram commented 6 years ago

Hi Yes, this is not a default output. But it is not very difficult to get it. The function that computes sigma8 is able to compute any sigma. The quick and dirty way to get such an array is to modify main.c. After the call spectra_init(), just make a loop over M, compute the radius R in Mpc and call

spectra_sigma(&ba,&pm,&sp,R,0.,&tmp)

and print the values M and tmp to screen or a file.

Cheers, Thomas