# Wiki

Clone wiki# cosmosis / demos / Demo6

# Demo 6: Getting a CFHTLens likelihood

## Running

In this example we will generate a likelihood of a cosmology using the CFHTLens tomographic data from Heymans et al.

We will use the test sampler again, so just a single cosmology.

cosmosis demos/demo6.ini

You should see some output like this:

Root directory is /Users/jaz/src/cosmosis

Parameter Priors ---------------- cosmological_parameters--omega_m ~ delta(0.3) cosmological_parameters--h0 ~ delta(0.72) cosmological_parameters--omega_b ~ delta(0.04) ... ... Total pipeline time: 3.15 seconds Pipeline ran okay. Likelihood cfhtlens = -108.71145093373259 Likelihood total = -108.71145093373259 Prior = 0 Likelihood = -108.71145093373259 Posterior = -108.71145093373259

The last number is the CFHTLens log-posterior of the parameters in demos/values6.ini.

Now let's make some plots. For some variety, let's make them PDF plots instead of PNG:

postprocess demos/demo6.ini -o plots -p demo6 -f pdf

You will get some nice new plots in plots/demo6*.pdf. Since we are now computing shear-shear functions we will have two new plots compared to demo 1: demo6_shear_power.pdf and demo6_shear_correlation.pdf. Here's the shear power plot:

![shear_power.png](https://bitbucket.org/repo/KdA86K/images/2218571580-shear_power.png)

## Understanding

The weak lensing case is an example where there is a longer sequence of different modules. The demos/demo6.ini file contains this line:

modules = consistency camb halofit load_nz shear_shear 2pt cfhtlens

We have already looked at the consistency, camb and halofit modules in demo one.
The *load_nz* module just loads a simple text file containing n(z) in its setup, and then each time it is executed provides the same n(z).

The *shear_shear* module computes the Limber integral to go from P(k,z) and n(z) to C_ell for the different bins and the correlations between them.

The *2pt* module integrates the C_ell with bessel functions J0 and J4 to get correlation function xi+ and x-.

The *CFHTLens* module interpolates into the xi+ and xi- values to get their values at the CFHTLens observed values, and then gets a likelihood.

Updated