Page 1 of 1

Output p(k) from CosmMC

Posted: August 31 2014
by alireza hojjati
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,

Output p(k) from CosmMC

Posted: September 14 2014
by Jason Dossett
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(k,z) for this likelihood if you want p(k) linear or nonlinear set this to .true.

this%needs_nonlinear_pk  
!Set this to true if you need a nonlinear p(k,z), default value is false

this%needs_exact_z      
!Set this to true if you want a exact z values calculated by CAMB for p(k,z), default value is false

this%num_z              
!number of z values that where p(k,z) needs to be calculated for this particular likelihood
 
this%kmax               
!this sets the maximum k-value you want to have p(k,z) 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(this%exact_z(this%num_z))
allocate(this%exact_z_index(this%num_z))
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