# Wiki

Clone wiki# cosmosis / demos / Demo7

# Demo 7: A 2D likelihood grid from BOSS DR9 CMASS Redshift-Space Distortion measurements of f * sigma_8

## Running

In this example we will generate a grid of likelihoods - we use the same grid sampler as in Demo 3, but this time with a 2D grid instead of 1D.

Run the demo:

cosmosis demos/demo7.ini

This demo should take 1-2 minutes to run.

You should see some output like this:

Parameter Priors ---------------- cosmological_parameters--omega_m ~ U(0.1, 0.4) cosmological_parameters--sigma_8 ~ U(0.5, 1.2) Will calculate f(z) and d(z) in 61 bins (0.000000:0.600000:0.010000) **************************** * Running sampler 1/1: grid DEBUG:root:CosmoSIS verbosity set to 40 * Saving output -> output/demo7.txt **************************** Total number of grid samples: 400 Growth parameters: z = 0.57 fsigma_8 = 0.21567597284429355 z0 = 0 Growth parameters: z = 0.57 fsigma_8 = 0.23156788663282044 z0 = 0 ....

The output file output/demo7.txt should contain 400 samples, representing the likelihoods on a 20 x 20 grid.

As always, we can post-process this file using the postprocess command:

postprocess demos/demo7.ini -o plots/ -p demo7

or make plots in R with:

./cosmosis/plotting/grid_plots.r -o plots -p demo7 -f output/demo7.txt

You will get a quick warning about Omega_m having large likelihoods at the edge of the field, and some summary statistics and three plots will be generated:

Marginalized mean, std-dev: cosmological_parameters--omega_m = 0.241955 ± 0.0915885 cosmological_parameters--sigma_8 = 0.802542 ± 0.141301 Marginalized median, std-dev: cosmological_parameters--omega_m = 0.229923 ± 0.0915885 cosmological_parameters--sigma_8 = 0.774403 ± 0.141301 Best likelihood: cosmological_parameters--omega_m = 0.178947 cosmological_parameters--sigma_8 = 0.831579 prior = 1.56065 post = 3.35978

The 2D likelihood plot, plots/demo7_cosmological_parameters--omega_m_cosmological_parameters--sigma_8.png. The color scale is for the likelihood, and the grey and black regions show 68% and 95% contours.

And the two 1D likelihoods, plots/demo7_cosmological_parameters--sigma_8.png and plots/demo7_cosmological_parameters--omega_m.png. You can see that sigma_8 is well-constrained but the omega_m is much weaker. The dotted lines bound 68% and 95% contours.

## Understanding

This example shows how the grid sampler works in more than one dimension. In the ini file we set 20 samples per dimension:

[grid] # We do a 20 x 20 grid for a total of 400 points nsample_dimension=20

as in demo 3, but in the values file we set two varying parameters:

[cosmological_parameters] omega_m = 0.1 0.27 0.4 sigma_8 = 0.5 0.8 1.2

In this case we sample over sigma_8 directly rather than deriving it from CAMB as in earlier examples. If we were combining with CMB, for exampling, we could get sigma_8 from there instead. Cosmosis doesn't care where we got sigma_8 from (sampled over or derived) as long as we have it.

We use some new modules in this example:

modules = consistency growthfunction boss likelihoods = boss

The growth function module does the calculation of f(z) and d(z) directly, rather than using P(k) outputs. The likelihood uses a measurement of f(z) * sigma_8(z) at z=0.57 from BOSS DR9 presented in Chuang et al 2013.

The postprocessor knows how to marginalize to make the 1D plots and interpolate smoothly to make the 2D plot. You can also use the flag --no-smooth if you want a more grid-like plot.

Updated