## CDM power spectrum from pyCAMB

Use of Healpix, camb, CLASS, cosmomc, compilers, etc.
Chris Pedersen
Posts: 5
Joined: March 01 2018
Affiliation: University College London

### CDM power spectrum from pyCAMB

I was running a quick consistency check between power spectra generated in pyCAMB and the command line executable and I'm a bit confused about some of the output. I've created an interpolation object:

Code: Select all

PK=camb.get_matter_power_interpolator&#40;pars,zmin=98,zmax=100,nz_step=100,nonlinear=False,var1="delta_tot"&#41;
where 'pars' has the same cosmology as the params.ini used in the executable. The ratio of the two is plot here, which gives exactly what you'd expect:

I then tried to do the same with the CDM power spectrum, by setting changing

Code: Select all

transfer_power_var=2
in the params.ini file, and setting

Code: Select all

PK=camb.get_matter_power_interpolator&#40;pars,zmin=98,zmax=100,nz_step=100,nonlinear=False,var1="delta_CDM"&#41;
in the python program. When I compare these two power spectra however, I get:

so the power spectra are no longer the same. Am I right in expecting them to be the same, or am I attempting to get the CDM power spectrum the wrong way? Do var1 and var2 not select which fluids we want power spectra for?

Antony Lewis
Posts: 1647
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

### Re: CDM power spectrum from pyCAMB

Your second python example should raise an error because delta_CDM is not recognised (should be all lower case).

You need to set var2 as well as var1 for an autospectrum of delta_cdm: var1='delta_cdm,var2 ='delta_cdm'.

You can also use

camb.model.transfer_power_var.value=2

to change the default variable globally.

Chris Pedersen
Posts: 5
Joined: March 01 2018
Affiliation: University College London

### CDM power spectrum from pyCAMB

Thanks, that's fixed it! (and yes you're right, delta_CDM did return an error, I had only var1="delta_cdm" to generate the second plot).