## Output p(k) from CosmMC

Use of Healpix, camb, CLASS, cosmomc, compilers, etc.
alireza hojjati
Posts: 10
Joined: May 25 2008
Affiliation: Institute for the early universe

### Output p(k) from CosmMC

I need to output (nonlinear) matter power spectrum for a set of "k" and "z" values each time parameters are sampled in CosmoMC. There are different places I could do that but I need to set the "k" and "z" values correctly.

I would like to know what the best way is !

Thanks,

Jason Dossett
Posts: 97
Joined: March 19 2010
Affiliation: The University of Texas at Dallas
Contact:

### Output p(k) from CosmMC

Hi Alireza,

If you want the p(k) at calculated by CAMB at exact values of z (for instance if you are using SDSS your might want p(k) at exactly 0.57) then you can follow the example in wigglez.f90.

In general though, for setting up your likelihood options some relevant options with "this" being a TCosmoCalcLikelihood derived type or extension of that derived type:

Code: Select all

this%needs_powerspectra
!Says you need want a p&#40;k,z&#41; for this likelihood if you want p&#40;k&#41; linear or nonlinear set this to .true.

this%needs_nonlinear_pk
!Set this to true if you need a nonlinear p&#40;k,z&#41;, default value is false

this%needs_exact_z
!Set this to true if you want a exact z values calculated by CAMB for p&#40;k,z&#41;, default value is false

this%num_z
!number of z values that where p&#40;k,z&#41; needs to be calculated for this particular likelihood

this%kmax
!this sets the maximum k-value you want to have p&#40;k,z&#41; calculated to by CAMB for this likeihood.



Those values should be set for every likelihood that requires a p(k,z). Depending on the value of this%needs_exact_z there are different, additional settings that must be set.

If this%needs_exact_z = .true. then you need to allocate the following arrays as below

Code: Select all

allocate&#40;this%exact_z&#40;this%num_z&#41;&#41;
allocate&#40;this%exact_z_index&#40;this%num_z&#41;&#41;

You then set the values of the this%exact_z array. The index array, which you will want to use when calling your likelihood, will be automatically filled by CosmoMC. See wigglez.f90 or mpk.f90 for an example of this

Alternatively, if you dont need p(k,z) at exact values of z calculated by CAMB but just need a range of z-values that you want CosmoMC to interpolate between set this%needs_exact_z = .false. (this is default) and set the variable

Code: Select all

this%max_z = your desired zmax

After that everything else is handled by the routines within CosmoMC. Getting p(k,z) values is pretty easy and again the best example of that is in wigglez.f90

Hope that helps.

-Jason