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)
220 stars 291 forks source link

A weird kink in CLASS matter power spectrum #488

Closed yicizhong98 closed 9 months ago

yicizhong98 commented 2 years ago

Hi! I'm currently using CLASS to generate matter power spectrum, but it appears a weird kink at low \ell (please see the figure attached below download-1 ), which is not within our expectation...I'm kind of wondering if you have any idea of where it comes from, and how to resolve it?

Thanks in advance, Yici

P.S., Here is my python code to generate this matter power spectrum:

OmegaB = 0.0486 OmegaM = 0.2603 h=0.6774 ombh2 = OmegaB*h*2 omch2 = OmegaMh**2 sigma8 = 0.8159 n_s = 0.9667

z1 = 0.11111111111111116 z2 = 0.09890109890109877 z_s = (z1 + z2)/2 lmax = 12288

LambdaCDM = Class() LambdaCDM.set({'omega_b':ombh2,'omega_cdm':omch2,'h':h,'sigma8':sigma8,'n_s':n_s})

LambdaCDM.set({'output':'mPk,nCl', 'lensing':'no', 'P_k_max_1/Mpc':100.0, 'z_pk':0.0, 'reio_parametrization':'reio_camb', 'selection':'tophat', 'selection_mean':z_s, 'selection_width': (z1-z2)/2, 'l_max_lss':lmax, 'non linear':'halofit' }) LambdaCDM.compute() cls2=LambdaCDM.density_cl(lmax) ell_th=cls2['ell'][2:] cldd_th=cls2['dd'][0][2:] plt.loglog(ell_th,cldd_th,label='Classy theory') plt.xlabel('$\ell$') plt.ylabel('cldd') plt.legend()

schoeneberg commented 1 year ago

Dear @yicizhong98 , this is expected. This is simply the limber approximation that is applied at too low L. Set also LambdaCDM.set({'l_switch_limber_for_nc_local_over_z':1000, 'l_switch_limber_for_nc_los_over_z':1000}) and it works (at least for me)

kcroker commented 9 months ago

If this fixed your issue @yicizhong98 , could you please Close it?

yicizhong98 commented 9 months ago

Thanks!! That fixed everything. Sorry that I forgot to close it.