Professor, Department of Astronomy and Astrophysics
University of Chicago

Group Contact CV SnapShots
CMB Introduction '96   Intermediate '01   Polarization Intro '01   Cosmic Symphony '04   Polarization Primer '97   Review '02   Power Animations   Lensing   Power Prehistory   Legacy Material '96   PhD Thesis '95 Baryon Acoustic Oscillations Cosmic Shear Clusters
Transfer Function WMAP Likelihood Reionization PPF for CAMB Halo Mass Conversion Cluster Abundance
Cosmology I [legacy 321] Cosmology II [321] Current Topics [282] Galaxies and Universe [242] Radiative Processes [305] Research Preparation [307] GR Perturbation Theory [408] CMB [448] Cosmic Acceleration [449]

CAMB and CosmoMC modifications for reionization principal components

Michael Mortonson

This is an add-on to CAMB and CosmoMC to enable the use of general reionization histories parametrized by a set of principal component (PC) basis functions.

Two versions of the modified code are available. The first includes only the files that we have modified:

Download modified files only

These files can be incorporated into existing copies of the most recent (as of June 2009) versions of CAMB (Feb. 2009) and CosmoMC (June 2008) either by adding _rpc to the end of the filenames in the Makefile or by overwriting the original files. The code should then compile as usual.

The other version includes the full CAMB and CosmoMC codes with the reionization PC modifications:

Download full code

These are gzipped tarfiles (extract with tar -xzvf camb_rpc[_full].tar.gz). Changes to the original code within each file are bracketed by comments labeled RPC.

The following instructions describe how to use this add-on to CAMB and CosmoMC. For more information on using the original versions of these codes, see the CosmoMC readme.


For use with the default configuration from Ref. [3], simply edit the entries for the principal component amplitudes m_amp* found in params_rpc.ini in the RPC section following the standard reionization parameters.

For other configurations, the 3 main inputs for setting the reionization history xe(z) are:

  1. a fiducial xe(z) model, read in from xe_fid where column 1 is z and column 2 is xe,
  2. the principal component functions, read in from xe_pc with the first row containing the same redshift bins as in the fiducial model file, and following rows containing the PCs starting with the lowest variance,
  3. amplitudes of the n_pc lowest-variance PCs to specify the reionization model, m_amp* where *=1,2,...,n_pc. Any number of PCs may be used up to the number supplied in the xe_pc file. Unused PCs are set to zero amplitude.

The default configuration uses xez.dat for the fiducial xe(z) and xepcs.dat for the PCs. This fiducial model has constant xe=0.15 over the range 6 < z < 30, and there are 95 redshift bins of width dz=0.25. The PCs are normalized using the conventions of Ref. [1]. Note that the code has not been tested for ionization variations at z < 6 since there is strong evidence from quasar spectra that hydrogen is fully ionized after redshift 6.

In addition to the usual output from CAMB, the reionization history is written to a file if one is specified using xe_out. The format is the same as for the fiducial xe(z) file.

The redshift bins for the fiducial model and the PCs are expected to be identical, and should only span the range over which the reionization history is to be varied. Outside of this range, the ionization fraction is set to nearly zero at high z (i.e. whatever the residual post-recombination ionization fraction is), and is set to one at low z (or slightly more than one for the standard helium reionization settings).

The order of the redshift bins in the fiducial model and PC files can be either increasing or decreasing, but the principal component rows should be in order of increasing variance (i.e., starting with the best-measured component).

Other reionization basis functions may be used instead of principal components, as long as the file listing these functions is in the correct format as described above.


The instructions for CosmoMC are similar to those for CAMB. Files for the fiducial ionization history and PCs are the same. The example params_rpc.ini and distparams_rpc.ini files provided are set up to vary 5 out of a total of 7 ionization PCs in an MCMC likelihood analysis of CMB data. The total number of PCs allowed can be changed from 7 by changing num_rpc in settings_rpc.f90 and adding or subtracting lines for the PC amplitudes in params_rpc.ini and distparams_rpc.ini. The PC amplitudes come after all of the original CosmoMC parameters, so they start with parameter 14. Note that if you change num_rpc, you will also need to change the parameter numbers of the derived parameters in distparams_rpc.ini (starting at parameter 14+num_rpc).

Since the sum of PCs can in general exceed the physical bounds on the reionization history corresponding approximately to 0 < xe < 1, it may be desirable to include priors on the PC amplitudes limiting this behavior. Top hat priors for this purpose are derived in Ref. [1], Eq. (10). These priors may be applied in CosmoMC by setting the minimum and maximum allowed parameter values for the PC amplitudes in params_rpc.ini. (If using getdist for analysis of the chains, the limits variables in distparams.ini for the PC amplitudes should be set to the same values.) Note that although these priors restrict the range of xe, they do not strictly require it to be between zero and one for reasons discussed in Ref. [1].

Parameter 4 is no longer used for the reionization optical depth in this modified version of CosmoMC. Instead, the optical depth is derived from the PC amplitudes and written to the parameter chain output after sigma_8 (with the default setting of 7 reionization PCs, tau appears as parameter 25).

Version History

September 2011 June 2009


[1] ''Model-independent constraints on reionization from large-scale cosmic microwave background polarization,'' Mortonson & Hu (2008) ApJ, 672, 737, arXiv:0705.1132

[2] ''Impact of reionization on CMB polarization tests of slow-roll inflation,'' Mortonson & Hu (2008) PRD, 77, 043506, arXiv:0710.4162

[3] ''Reionization constraints from five-year WMAP data,'' Mortonson & Hu (2008) ApJ Lett., 686, 53, arXiv:0804.2631

[4] ''CMB polarization features from inflation versus reionization,'' Mortonson, Dvorkin, Peiris, & Hu (2009) PRD 79, 103519, arXiv:0903.4920