The CMB data

In this section we will learn about the CMB data from WMAP (http://map.gsfc.nasa.gov/) and Planck (http://www.esa.int/Our_Activities/Space_Science/Planck). The goals of the exercise are:

  • Example how to plot the constraints from WMAP are below
  • Different cosmological models are in different folders. Here are examples:

    base - base flat Lambda-CDM model (use plikHM_TTTEEE_lowTEB)

    base_w - base flat Lambda-CDM model with varying Dark Energy equation of state w (use plikHM_TTTEEE_lowTEB)

    base_w_wa - base flat Lambda-CDM model with varying Dark Energy equation of state w, which can evolve with scale factor (use plikHM_TTTEEE_lowTEB_BAO)

    base_omegak - Lambda-CDM model with varying curvature (use plikHM_TTTEEE_lowTEB)

  • Combination of different datasets used are in subfolders, for example:

    plikHM_TTTEEE_lowTEB - using Planck Temperature - Temperature (TT) and Temperature - E-mode-polarisation (TE) and E-mode-polarisation - E-mode-polarisation (EE) power spectra, low l-range of Cls

    plikHM_TTTEEE_lowTEB_BAO - as above, but use also use BAO data (Baryon Accoustic Oscillations will be covered later in the course)

    WMAP - use WMAP data

Example - how to load the data

In [2]:
import numpy as np
import pylab as pl
import pandas as pd
%pylab inline
from corner import corner
Populating the interactive namespace from numpy and matplotlib

Load the WMAP data

In [33]:
# MCMC chain samples
samples = np.loadtxt('COM_CosmoParams_fullGrid_R2.00/base/WMAP/base_WMAP_1.txt')

# load the column names for the samples
column_names_raw = np.loadtxt('data/COM_CosmoParams_fullGrid_R2.00/base/WMAP/base_WMAP.paramnames', dtype=np.str, usecols=[0])
column_names = [x.replace("b'",'').replace("'",'') for x in column_names_raw]

# make a data frame with column names and samples
samples1 = pd.DataFrame(samples[:,2:], columns=column_names) # first two columns are not important
In [4]:
# define which parameters to use
use_params = ['omegam*', 'omegabh2']
In [35]:
 
In [38]:
pl.figure()
sigma1 = 1. - exp(-(1./1.)**2/2.)
sigma2 = 1. - exp(-(2./1.)**2/2.)
_=corner(samples1[use_params], range=[(0.1, 0.5), (0.02, 0.025)], bins=20, levels=(sigma1, sigma2), color='r')
<matplotlib.figure.Figure at 0x1187214d0>
In [32]:
help(corner)
Help on function corner in module corner.corner:

corner(xs, bins=20, range=None, weights=None, color='k', smooth=None, smooth1d=None, labels=None, label_kwargs=None, show_titles=False, title_fmt='.2f', title_kwargs=None, truths=None, truth_color='#4682b4', scale_hist=False, quantiles=None, verbose=False, fig=None, max_n_ticks=5, top_ticks=False, use_math_text=False, hist_kwargs=None, **hist2d_kwargs)
    Make a *sick* corner plot showing the projections of a data set in a
    multi-dimensional space. kwargs are passed to hist2d() or used for
    `matplotlib` styling.
    
    Parameters
    ----------
    xs : array_like[nsamples, ndim]
        The samples. This should be a 1- or 2-dimensional array. For a 1-D
        array this results in a simple histogram. For a 2-D array, the zeroth
        axis is the list of samples and the next axis are the dimensions of
        the space.
    
    bins : int or array_like[ndim,]
        The number of bins to use in histograms, either as a fixed value for
        all dimensions, or as a list of integers for each dimension.
    
    weights : array_like[nsamples,]
        The weight of each sample. If `None` (default), samples are given
        equal weight.
    
    color : str
        A ``matplotlib`` style color for all histograms.
    
    smooth, smooth1d : float
       The standard deviation for Gaussian kernel passed to
       `scipy.ndimage.gaussian_filter` to smooth the 2-D and 1-D histograms
       respectively. If `None` (default), no smoothing is applied.
    
    labels : iterable (ndim,)
        A list of names for the dimensions. If a ``xs`` is a
        ``pandas.DataFrame``, labels will default to column names.
    
    label_kwargs : dict
        Any extra keyword arguments to send to the `set_xlabel` and
        `set_ylabel` methods.
    
    show_titles : bool
        Displays a title above each 1-D histogram showing the 0.5 quantile
        with the upper and lower errors supplied by the quantiles argument.
    
    title_fmt : string
        The format string for the quantiles given in titles. If you explicitly
        set ``show_titles=True`` and ``title_fmt=None``, the labels will be
        shown as the titles. (default: ``.2f``)
    
    title_kwargs : dict
        Any extra keyword arguments to send to the `set_title` command.
    
    range : iterable (ndim,)
        A list where each element is either a length 2 tuple containing
        lower and upper bounds or a float in range (0., 1.)
        giving the fraction of samples to include in bounds, e.g.,
        [(0.,10.), (1.,5), 0.999, etc.].
        If a fraction, the bounds are chosen to be equal-tailed.
    
    truths : iterable (ndim,)
        A list of reference values to indicate on the plots.  Individual
        values can be omitted by using ``None``.
    
    truth_color : str
        A ``matplotlib`` style color for the ``truths`` makers.
    
    scale_hist : bool
        Should the 1-D histograms be scaled in such a way that the zero line
        is visible?
    
    quantiles : iterable
        A list of fractional quantiles to show on the 1-D histograms as
        vertical dashed lines.
    
    verbose : bool
        If true, print the values of the computed quantiles.
    
    plot_contours : bool
        Draw contours for dense regions of the plot.
    
    use_math_text : bool
        If true, then axis tick labels for very large or small exponents will
        be displayed as powers of 10 rather than using `e`.
    
    max_n_ticks: int
        Maximum number of ticks to try to use
    
    top_ticks : bool
        If true, label the top ticks of each axis
    
    fig : matplotlib.Figure
        Overplot onto the provided figure object.
    
    hist_kwargs : dict
        Any extra keyword arguments to send to the 1-D histogram plots.
    
    **hist2d_kwargs
        Any remaining keyword arguments are sent to `corner.hist2d` to generate
        the 2-D histogram plots.

In [39]:
column_names
Out[39]:
['omegabh2',
 'omegach2',
 'theta',
 'tau',
 'logA',
 'ns',
 'asz',
 'H0*',
 'omegal*',
 'omegam*',
 'omegamh2*',
 'omeganuh2*',
 'omegamh3*',
 'sigma8*',
 's8omegamp5*',
 's8omegamp25*',
 's8h5*',
 'rmsdeflect*',
 'zrei*',
 'A*',
 'clamp*',
 'DL40*',
 'DL220*',
 'DL810*',
 'DL1420*',
 'DL2000*',
 'ns02*',
 'yheused*',
 'YpBBN*',
 'DHBBN*',
 'age*',
 'zstar*',
 'rstar*',
 'thetastar*',
 'DAstar*',
 'zdrag*',
 'rdrag*',
 'kd*',
 'thetad*',
 'zeq*',
 'keq*',
 'thetaeq*',
 'thetarseq*',
 'rsDv057*',
 'Hubble057*',
 'DA057*',
 'FAP057*',
 'fsigma8z057*',
 'sigma8z057*',
 'chi2_WMAP*',
 'chi2_prior*']
In [ ]: