Page 1 of 1

CDM power spectrum from pyCAMB

Posted: March 01 2018
by Chris Pedersen
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(pars,zmin=98,zmax=100,nz_step=100,nonlinear=False,var1="delta_tot")
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:

Image

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(pars,zmin=98,zmax=100,nz_step=100,nonlinear=False,var1="delta_CDM")
in the python program. When I compare these two power spectra however, I get:

Image

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?

Re: CDM power spectrum from pyCAMB

Posted: March 01 2018
by Antony Lewis
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.

CDM power spectrum from pyCAMB

Posted: March 01 2018
by Chris Pedersen
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).