Free Access
Volume 528, April 2011
Article Number A33
Number of page(s) 6
Section Numerical methods and codes
Published online 23 February 2011

© ESO, 2011

1. Introduction

Cosmology is a rapidly advancing field thanks to recent progress in instrumentation, numerical simulations, and theoretical methods. The past few decades have provided a previously innaccessible wealth of data with the advent of large surveys of the cosmic microwave background, galaxy clustering, cosmic shear, clusters, and supernovae (see Spergel et al. 2007; Dunkley et al. 2009, for more recent results and references therein). One of the challenges of cosmology is to link the derived observable quantities from these cosmological surveys with the parameters of an underlying cosmological model. Another necessary task is to predict the performance of future surveys and future observational probes in order to maximise the potential of future experiments. Existing publicly available computational tools (Seljak & Zaldarriaga 1996; Lewis et al. 2000; Lewis & Bridle 2002) are widely used within the cosmological community, yet there is at present no unified tool that considers the low-redshift universe and its associated probes.

In this paper, we present iCosmo, a software package that performs interactive cosmological calculations. The code can also be used as an engine to perform predictions for any cosmological model, and it also forms a convenient platform for developing further cosmological modules. With its extensive documentation, it may also serve as a useful resource for teaching and for newcomers in the field of cosmology.

The code calculates distance measures, the linear and non-linear matter power spectrum, the growth factor, volume elements and other quantities for any CDM cosmological model. It also computes derived observable quantities for several cosmological probes such as cosmic shear, baryonic acoustic oscillations (BAO), and type Ia supernovae. The associated errors for these observables can be described for arbitrary survey parameters, or alternatively, for a number of preset values corresponding to planned surveys and experiments. The code also provides forecasts for future cosmological surveys, by allowing the user to compute, manipulate, and combine Fisher matrices. The code is written in the IDL language, so it benefits from the simple syntax, large scientific libraries and convenient interactive plotting environment of this language. In particular, all the above calculations can be completed in only a few lines of code.

The code is freely available at with full documentation and help files. It is part of the Initiative for Cosmology web site, and it includes an interactive web interface (see description in Kitching et al. 2009).

In this paper, we describe the main features of iCosmo  and provide several examples illustrating its use. In Sect. 2, we describe the main conventions and architecture of the code. In Sect. 3 we describe how the code can quickly calculate the evolution of the main cosmological quantities, such as distance measures and growth factor, as a function of redshift. In Sect. 4, we describe how iCosmo  calculates the derived observable quantities for cosmic shear, BAO and type Ia supernovae. Section 5 shows how the code can compute and manipulate Fisher matrices. Our conclusions and possible future developments are presented in Sect. 6.

Table 1

Main iCosmo routines and a brief description of their use.

2. General presentation

The iCosmo  code is a package of routines written in the IDL language. It is divided into several directories corresponding to the different levels of the calculations:

  • general, plotting: General utility and plotting routines;

  • cosmo, expt: Routines to define fiducial cosmological and survey parameters and compute basic cosmological quantities;

  • lensing, bao, sne: Routines to compute cosmic shear, BAO and type Ia supernovae observables;

  • fisher: Routines to create, plot and manipulate Fisher matrices for cosmological forecasts.

The routines in each of the directories make use of the variable structures in IDL. Their functionality is indicated by the first few letters of their name with the following conventions:

  • set: set up basic structures with calculation variables;

  • mk: make or compute a new structure using the information in an input structure;

  • get: get a substructure or derived quantity from an existing structure;

  • plt: plot;

  • rd, wt: read and write data from and into a file.

A description of the main iCosmo  routines and associated directories can be found in Table 1. Detailed explanations for any of the routines can be obtained by typing icosmo_help, “routine name” at the IDL command line. A readme file is available in the distribution and gives installation instructions and a quick start tutorial.

Table 2 shows an example of a typical call sequence for iCosmo, with the different levels of the code separated by horizontal lines. The following sections describe the use of each level of the code with examples of call sequences and output figures.

Table 2

Example of a typical call sequence for iCosmo, with different levels of the code separated by horizontal lines.

3. Basic cosmological quantities

The first level in iCosmo  defines the cosmological model and computes basic cosmological quantities; see, e.g., Peacock (1999) for their definitions and Refregier et al. (2004) for conventions. The first step is to define the fiducial parameter structure using the set_fiducial function (see Inst. 1 in Table 2). The resulting fid structure contains the following three substructures:

  • cosmo: input cosmological parameters;

  • expt: experiment parameters, such as survey area, number of galaxies or SNe as a function of redshift, or preset surveys;

  • calc: calculation parameters, such as redshift and k-range, fitting functions, etc.

These parameters have default values that can be easily modified using the syntax of instruction 1 in Table 2.

The next step is to compute all the basic cosmological quantities using the mk_cosmo function (see Inst. 2 in Table 2). The resulting cosmo structure is organised into several substructures:

  • const: all original fiducial quantities, as well as constantquantities derived from the fiducial parameters (e.g., the Hubbleradius);

  • evol: evolving scalar quantities such as distance measures, the growth factor, tabulated as a function of redshift;

  • pk: Linear and non-linear matter power spectrum P(k,z) tabulated as a function of wavenumber k and redshift z.

The evolving scalar quantities can then be plotted easily using the plt_cosmo routine (see Inst. 3 in Table 2). As an example, the following call sequence:

 ⟩  fid=set_fiducial(cosmo={w0:-0.9},calc={fit_tk:1})

 ⟩  cosmo=mk_cosmo(fid)

 ⟩  plt_cosmo,cosmo,“z”,“da”

produces Fig. 1 which shows the angular diameter distance DA(z) as a function of redshift z, defined in a flat universe by (1)where χ(z) represents the comoving radial distance, H(z) the Hubble parameter, and c the speed of light. In all figures below, the fiducial cosmology is set to [h = 0.7,Ωb = 0.045,Ωm = 0.3,ΩΛ = 0.7,w0 =  − 0.95,wa = 0.0,n = 1.0 = 0.09,σ8 = 0.8], unless otherwise stipulated. For example, the call sequence above changes w0 to  − 0.9, which is used in the rest of this paper.

thumbnail Fig. 1

Example of an iCosmo  output showing the angular-diameter distance DA(z) as a function of redshift. See text for command sequence.

As an example of the plotting functionality, the plotting routine plt_pk can be used to plot the matter power spectrum P(k,z) as a function of wavenumber k at a redshift z, where P(k) is defined as (2)and δ(k) represents matter fluctuations in Fourier space. For example, Fig. 2 shows the linear and non-linear power spectrum at z = 0 and 1 and is produced by the additional sequence:

 ⟩  plt_pk,cosmo,z=0,xran=[0.001,10.]

 ⟩  plt_pk,cosmo,z=0,/over,/linear,linestyle=2

 ⟩  plt_pk,cosmo,z=1,/over,color=2

 ⟩  plt_pk,cosmo,z=1,/over,/linear,linestyle=2, color=2

The keyword over can be used to overlay several results on a single figure.

thumbnail Fig. 2

Matter power spectrum at z = 0 and 1, for top and bottom lines, respectively. Linear and non-linear power spectra are shown as dashed and solid lines. These plots were derived using the plt_pk routine.

4. Derived cosmological observable quantities

The next level of iCosmo  consists in the calculations of the derived observables related to different cosmological probes. At present, cosmic shear, baryon acoustic oscillations, and type Ia supernovae are supported. The underlying physics of each of these probes is described below.

4.1. Cosmic shear

As light travels towards us from distant galaxies, its path is perturbed by intervening matter along the line of sight. This causes distortions in the background images and is known as gravitational lensing. To first order this can be described by a distortion matrix: (3) where δθi(θ) is the deflection vector that results from the lensing. The distortion matrix captures two effects of gravitational lensing: the observed image can be dilated or contracted, which is described by the convergence κ, and the image can also be stretched and compressed along (and at 45° from) the x-axis, which is described by the shear component γ1 (γ2).

Cosmic shear – the statistical measure of shear (γ1, γ2), uses the two point function of the shear field as a cosmological observable, given by (4)where the weighting function is given by (5)where and DA is the angular-diameter distance. In Eq. (4), the auto-correlation is given for i = j and the cross-correlation for i ≠ j, where i and j correspond to galaxy populations at different redshifts. The galaxy distribution function is given by ni(χ), i.e. the probability of finding a galaxy at a distance χ, and is normalised to dχni(χ) = 1.

In iCosmo, cosmic shear is implemented using shear power spectrum tomography as described in references Hu (1999), Hu & Jain (2004), Refregier et al. (2004) and Amara & Réfrégier (2007). The uncertainties ΔCij() are calculated under the assumption that the two-point function is Gaussian.

4.2. Baryon acoustic oscillations

In the early Universe, just before decoupling, baryons and photons were coupled through Thomson scattering and Coulomb interactions. The photon-baryon fluid was subject to two competing effects: collapse due to gravitational instability and repulsion due to outward pressure. These two effects created oscillations in the fluctuation field, visible today in the Cosmic Microwave Background (CMB, Peebles & Yu 1970; Sunyaev & Zeldovich 1970), as well as in the galaxy distribution. In Fourier space, this effect corresponds to a series of acoustic peaks, dubbed Baryon Acoustic Oscillations (BAOs). They can be visualised by considering the ratio of a matter power spectrum with baryons, to one without: Pb(k) / Pnob(k), and in this case are also called “wiggles”.

By measuring the BAOs in the matter power spectrum, it is possible to extract a characteristic BAO scale present in both the radial (y) and tangential (y′) directions (see Sect. 2.2 of Blake et al. 2006): (6)where r(z) corresponds to the comoving radial distance, H(z) to the Hubble parameter, s to the comoving sound horizon at recombination and c to the speed of light. The reviews by Peacock et al. (2006) and Albrecht et al. (2006) concluded that the measurement of the BAO scale was a fundamental tool for future precision cosmology.

To use the information contained in the BAO scale, it is necessary to have an estimate of the accuracy with which a given survey can measure the scale. In the current version of iCosmo, we use the analytic expression derived in Blake et al. (2006) for the accuracy of the measurement on the BAO scale (though there are several approaches for using information from BAOs, as shown in Rassat et al. 2008). This analytic expression was derived from simulations and depends on the central redshift z of the survey, the total volume V of the survey, and the average number density of galaxies. For the moment, photometric redshift errors are not included in the iCosmo  BAO module, though it is given in the accuracy expression of Blake et al. (2006). The expression for the accuracy measurement is given by Eqs. (6)–(9) in Blake et al. (2006).

4.3. Type Ia supernovae

Type Ia supernovae are assumed in cosmology to behave as standard candles; i.e., the rate with which the brightness of a supernova declines is assumed proportional to its intrinsic luminosity. Thus by measuring the light curves of distant supernovae, it is possible to measure their distance, and by obtaining spectra one can compare their distance-redshift relation, which is highly dependent on cosmological parameters.

The derived observable for type Ia supernovae is therefore the apparent magnitude m(z) at a given redshift z, related to the luminosity distance by (7)%where the H0-independent luminosity distance DL(z) is given by (8)The normalisation parameter ℳ is given by (9)where M is the absolute magnitude.

The uncertainty on the magnitude is given by Kim et al. (2004): (10) where σν accounts for the scatter in peculiar velocities, σm the observed variance, and Nz is the number of supernovae redshift bins.

4.4. Derived cosmological observables with iCosmo

A typical call sequence is given in Instructions 5–8 in Table 2. The sequence first defines the survey using mk_survey and then computes the derived observable using mk_cl_tomo, mk_bao, mk_sne, for lensing tomography, BAO and SNe, respectively. The statistical errors in these observables for the fiducial survey can be derived using the correspondng mk_cov routines listed in Table 1.

As an example, the following produces Fig. 3, a plot of cosmic shear power spectra for DUNE (Refregier et al. 2008) with its associated 1σ error bars:

 ⟩  fid=set_fiducial(“DUNE”, expt_in={sv1_n_zbin:2})

 ⟩  cosmo=mk_cosmo(fid)

 ⟩  sv=mk_survey(fid,“sv1”)

 ⟩  cl=mk_cl_tomo(fid,cosmo,sv)

 ⟩  cl_cov=mk_cl_cov_tomo(fid,cl,sv)

 ⟩  plt_cl,cl,[1,1],cl_cov,/errors,yran=[1e-7,1e-3]

 ⟩  plt_cl,cl,[0,1],cl_cov,/errors,/over, linestyle=1

 ⟩  plt_cl,cl,[0,0],cl_cov,/errors,/over, linestyle=2

The different power spectra correspond to two different tomographic redshift bins with median redshifts 0.68 and 1.36, as well as their cross-power spectra. Similar call sequences can produce predictions and errors for the BAO distance measures and for SNe Hubble diagrams.

thumbnail Fig. 3

The cosmic shear power spectrum and associated 1σ error bars for the DUNE/Euclid cosmic shear survey for the 1st (upper line) and 2nd (middle line) tomographic bins (with median redshifts of 0.68 and 1.36 respectively) as well as the cross-correlation between the bins (lower line).

5. Fisher matrices

The final level of iCosmo  is related to the computation and manipulation of Fisher matrices to assess the constraints on cosmological parameters that can be achieved with future surveys.

5.1. The Fisher information matrix

It is possible to forecast the precision with which a given experiment can constrain cosmological parameters using the Fisher Information Matrix (FIM, see Tegmark et al. 1997, for a detailed derivation). A method based on the FIM requires the following ingredients as input:

  • A set of cosmological parameters θ = (θ1,θ2,...,θi) for which one requires predicted constraints;

  • A choice of underlying fiducial cosmology;

  • A set of measurements x = (x1,x2,...,xn), for e.g., this could be the shear power spectrum C() over a range  = 1...n;

  • A cosmological model for how the observable depends on cosmological parameters, i.e. a model for calculating C() = C(ℓ,θ);

  • An estimate of the uncertainty on the observable, i.e. in our example an estimate of ΔC(). This may depend on the experiment (instrument noise, shot noise, etc.) as well as on the data estimator (cosmic variance).

With the above inputs, it is possible to calculate the FIM, whose components are denoted as Fij: (11)where L =  − lnL, and L = L(x,θ) is the likelihood function or the probability distribution of the data x, which depends on some cosmological parameter set θ.

In practise, for a given observable C(ℓ,θ), assumed to have Gaussian errors, the Fisher matrix can be calculated using (12)For example, the coefficients of the Fisher matrix for the supernovae calculation is obtained by calculating (see Tegmark et al. 1998; Huterer & Turner 2001) (13)where the sum is over redshift bin.

When a vector of parameters are allowed to vary, marginalised parameter constraints can be obtained by (14)This equation provides a lower limit on the constraints one can expect to attain for a given survey and fiducial cosmology. When all other cosmological parameters are fixed, the constraint on a parameter can be estimated by (15)

5.2. Calculating Fisher matrices with iCosmo

For this purpose, Fisher matrices can first be computed using the mk_fisher routines for each probe (see Table 1). The computation is done by taking excursions from the fiducial cosmological model for each of the parameters of interest. Fisher matrices can be combined using the combine_fisher routine to derive joint cosmological constraints with several surveys and probes. The routine margin_fisher can be used to marginalise over unwanted parameters. The resulting contraints can be plotted using the plt_fisher routines.

A typical call sequence to compute and plot Fisher matrices can be found in instructions 9–11 in Table 2. As an example, the following sequence computes the Fisher matrices for a DUNE cosmic shear survey, a full sky BAO spectroscopic survey (20 000 deg2), and their combination:

 ⟩  fid_lens=set_fiducial(“DUNE”)

 ⟩ fid_bao=set_fiducial(“bao_halfsky”)


 ⟩  sv_lens=mk_survey(fid_lens,“sv1”)

 ⟩  sv_bao=mk_survey(fid_bao,“sv2”)


 ⟩  f_lens=mk_fisher_lens(fid_lens,sv_lens)

 ⟩  f_bao=mk_fisher_bao(fid_bao,sv_bao)  

⟩  f_comb=comb_fisher(f_lens,f_bao)

The following call sequence produces Fig. 4 showing the 68% CL constraints on the dark energy parameters ΩDE and w0 expected for each surveys separately (blue and red ellipse) and jointly (solid green ellipse).

 ⟩  margin_fisher,f_lens,f_lens2,[0,1,0,0,0,0,0,1]

 ⟩  margin_fisher,f_bao,f_bao2,[0,1,0,0,0,1]

 ⟩  margin_fisher,f_comb,f_comb2,[0,1,0,0,0,0,0,1]

 ⟩  plt_fisher_2p,f_bao2,/nofill,color=2

 ⟩  plt_fisher_2p,f_lens2,/nofill, $ linestyle=2,/over

 ⟩  plt_fisher_2p,f_comb2,/over,color=3

The margin_fisher routine was used to retain only the parameters to be plotted, and marginalise over all the other parameters.

thumbnail Fig. 4

Marginalised 68% CL constraints on the dark energy parameters ΩDE and w0, expected for the DUNE cosmic shear (blue), a full sky BAO survey (red) and their combination (solid green). This figure was derived using the Fisher matrix routines of iCosmo.

6. Conclusions

The iCosmo  package provides a convenient and flexible interactive tool for cosmological calculations, and it can also be used as a computation engine in batch mode. With all the built-in IDL libraries, it is also a convenient platform for developing other cosmological routines and for teaching. The code, along with an

interactive web tool Kitching et al. (2009) and various cosmological resources are freely available at at

In the future, we plan to add more features to the code, such as the halo model, higher order clustering statistics, and interfaces with CMB Boltzmann codes. Contributions from the community are encouraged.


The authors thank the many people who have contributed to iCosmo  over the years, particularly, Richard Massey, David Bacon, Joel Berge, Florian Pacaud, Romain Teyssier, Jean-Baptiste Juin, Dominique Ivon, Ivan Debono, Sarah Bridle, Andrew Hodgson, Benjamin Joachimi, Chaz Shapiro, Andy Taylor, Licia Verde, Martin Kunz, and Francisco Castander. T.D.K. is supported by STFC Rolling Grant Number RA0888.


  1. Albrecht, A., Bernstein, G., Cahn, R., et al. 2006 [arXiv:astro-ph/0609591] [Google Scholar]
  2. Amara, A., & Réfrégier, A. 2007, MNRAS, 381, 1018 [NASA ADS] [CrossRef] [Google Scholar]
  3. Blake, C., Parkinson, D., Bassett, B., et al. 2006, MNRAS, 365, 255 [NASA ADS] [CrossRef] [Google Scholar]
  4. Dunkley, J., Komatsu, E., Nolta, M. R., et al. 2009, ApJS, 180, 306 [NASA ADS] [CrossRef] [Google Scholar]
  5. Hu, W. 1999, ApJ, 522, L21 [NASA ADS] [CrossRef] [Google Scholar]
  6. Hu, W., & Jain, B. 2004, Phys. Rev. D, 70, 043009 [NASA ADS] [CrossRef] [Google Scholar]
  7. Huterer, D., & Turner, M. S. 2001, Phys. Rev. D, 64, 123527 [NASA ADS] [CrossRef] [Google Scholar]
  8. Kim, A. G., Linder, E. V., Miquel, R., & Mostek, N. 2004, MNRAS, 347, 909 [NASA ADS] [CrossRef] [Google Scholar]
  9. Kitching, T., Amara, A., Rassat, A., & Refregier, A. 2009 [arXiv:0901.3143] [Google Scholar]
  10. Lewis, A., & Bridle, S. 2002, Phys. Rev. D, 66, 103511 [NASA ADS] [CrossRef] [Google Scholar]
  11. Lewis, A., Challinor, A., & Lasenby, A. 2000, ApJ, 538, 473 [NASA ADS] [CrossRef] [Google Scholar]
  12. Peacock, J. A. 1999, Cosmological Physics, ed. J. A. Peacock (Cambridge, UK: Cambridge University Press), 704 [Google Scholar]
  13. Peacock, J. A., Schneider, P., Efstathiou, G., et al. 2006, ESA-ESO Working Group on Fundamental Cosmology, Tech. Rep. [Google Scholar]
  14. Peebles, P. J. E., & Yu, J. T. 1970, ApJ, 162, 815 [NASA ADS] [CrossRef] [Google Scholar]
  15. Rassat, A., Amara, A., Amendola, L., et al. 2008, MNRAS, submitted [arXiv:0810.0003] [Google Scholar]
  16. Refregier, A., Massey, R., Rhodes, J., et al. 2004, AJ, 127, 3102 [NASA ADS] [CrossRef] [Google Scholar]
  17. Refregier, A., Douspis, M., and the DUNE Collaboration 2008, in SPIE Conf. Ser., 7010 [Google Scholar]
  18. Seljak, U., & Zaldarriaga, M. 1996, ApJ, 469, 437 [NASA ADS] [CrossRef] [Google Scholar]
  19. Spergel, D. N., Bean, R., Doré, O., et al. 2007, ApJS, 170, 377 [NASA ADS] [CrossRef] [Google Scholar]
  20. Sunyaev, R. A., & Zeldovich, Y. B. 1970, Ap&SS, 7, 3 [NASA ADS] [Google Scholar]
  21. Tegmark, M., Taylor, A. N., & Heavens, A. F. 1997, ApJ, 480, 22 [NASA ADS] [CrossRef] [Google Scholar]
  22. Tegmark, M., Eisenstein, D. J., & Hu, W. 1998, in Fundamental Parameters in Cosmology, XIIIe Rencontres de Moriond, ed J. Tran Thanh Van, (France, Paris: Éditions Frontières) [arXiv:astro-ph/9804168] [Google Scholar]

All Tables

Table 1

Main iCosmo routines and a brief description of their use.

Table 2

Example of a typical call sequence for iCosmo, with different levels of the code separated by horizontal lines.

All Figures

thumbnail Fig. 1

Example of an iCosmo  output showing the angular-diameter distance DA(z) as a function of redshift. See text for command sequence.

In the text
thumbnail Fig. 2

Matter power spectrum at z = 0 and 1, for top and bottom lines, respectively. Linear and non-linear power spectra are shown as dashed and solid lines. These plots were derived using the plt_pk routine.

In the text
thumbnail Fig. 3

The cosmic shear power spectrum and associated 1σ error bars for the DUNE/Euclid cosmic shear survey for the 1st (upper line) and 2nd (middle line) tomographic bins (with median redshifts of 0.68 and 1.36 respectively) as well as the cross-correlation between the bins (lower line).

In the text
thumbnail Fig. 4

Marginalised 68% CL constraints on the dark energy parameters ΩDE and w0, expected for the DUNE cosmic shear (blue), a full sky BAO survey (red) and their combination (solid green). This figure was derived using the Fisher matrix routines of iCosmo.

In the text

Current usage metrics show cumulative count of Article Views (full-text article views including HTML views, PDF and ePub downloads, according to the available data) and Abstracts Views on Vision4Press platform.

Data correspond to usage on the plateform after 2015. The current usage metrics is available 48-96 hours after online publication and is updated daily on week days.

Initial download of the metrics may take a while.