CAMB Examples

This page applied to CAMB versions prior to November 2001.

The default CAMB distribution is designed to be as compatible as possible with CMBFAST - it uses the same driver routine for reading in parameters and the same parameterization of the initial power spectrum. Here we give some sample interface routines for calling CAMB from your own code, sample programs using the routines, and a modules for parameterizing the initial power spectrum in a better way.

Subroutine to get Cls

Download CAMB_cls.f90, and test program CAMB_cls_test.f90.

This is a simple routine to get a set of Cls from your own programs. The code can easily be modified to generate Cls with various initial spectral indices. To build change the DRIVER entry in the Makefile to

DRIVER = CAMB_cls.f90 CAMB_cls_test.f90
and then run "make camb". You need to run jlgen to generate "spherbes.dat" before running the test program.

This subroutine uses the same parameterization as CMBFAST, but in general fixing the tensor/scalar quadrupole ratio is not useful.

A better initial power spectrum

Download power_tilt.f90

This file provides an InitialPower module that sets the initial power spectra based on scalar and tensor spectral indices, and the relative amplitude of the two spectra. The names of the inputs, an() [the scalar spectral index], ant() [the tensor spectral index], and rat() [ the ratio] are the same as in the default module, however here rat() is the ratio of the tensor to the scalar initial power spectrum at zero tilt, not the ratio of the CMB quadrupoles. You can use it using the same subroutine and test program as above, just change the POWERSPECTRUM setting in the Makefile to "power_tilt" and make as before.

The CMB power spectra computed using this module will not be COBEnormalized. The absolute normalization is arbitary, but the relative normalization of tensor and scalar spectra generated with this module will be correct (based on the value of rat()).

Slow-roll parameterization

Download power_slowroll.f90

Sample interface code CAMB_slowroll.f90 and test program CAMB_slowroll_test.f90.

power_slowroll.f90 is contains an InitialPower module that returns initial power spectra parameterized by the slow roll parameters epsilon and delta (see astro-ph/9911225).

To build the test program change the Makefile's DRIVER entry to
DRIVER = CAMB_slowroll.f90 CAMB_slowroll_test.f90
and set "POWERSPECTRUM = power_slowroll". The test program prints out the scalar, tensor and total temperature CMB power spectrum for a particular choice of slow roll parameters. It demonstrates how to generate the scalar and tensor Cls separately in the correct ratio in an efficient way, and to COBEnormalize the result. You need to run jlgen to generate "spherbes.dat" before running the test program. This slow-roll parameterization only really makes sense for flat models.

CAMB home page.