Skip to content



Repository files navigation

Readme file for CLASS - the Cosmic Linear Anisotropy Solving System

By Julien Lesgourgues, with several major inputs from other people,
especially Thomas Tram, as well as Benjamin Audren, Simon Prunet, etc.

For download and information, see



(the information below can also be found on the webpage, just below
the download button)

After downloading the code, unpack the archive (tar -zxvf
class_v*.tar.gz), go to the class directory (cd class/) and compile
(make class). If the first compilation attempt fails, you may need to
open the Makefile and adapt the name of the compiler (default: gcc),
of the optization flag (default: -O4) and of the OpenMP flag (default:
-fopenmp; this flag is facultative, you are free to compile without
OpenMP if you don't want parallel execution; note that you need the
version 4.2 or higher of gcc to be able to compile with -fopenmp; some
users of Mac OS 10.7 even reported that they needed gcc-4.5 or
gcc-mp-4.3 in order to compile the CLASS libraries, but this is anyway
an advancesd step that you probably don't need).

Adapt your input parameters in the file explanatory.ini and run with:

./class explanatory.ini

Or, even better, make a copy of explanatory.ini into another file, for
instance test.ini, and remove everything in test.ini that you judge
useless for your own purpose: in that way you can keep explanatory.ini
as a reference file, and play with a more concise and friendly input
file. You can then run with

./class test.ini.

If you want to play with the precision/speed of the code, you can use
one of the provided precision files (e.g. cl_permille.pre) or modify
one of them, and run with two input files, for instance:

./class test.ini cl_permille.pre

A simplified documentation can be found in the paper ``CLASS I:
Overview'', arXiv:1104.2932 [astro-ph.IM]. On top of that, if you wish
to modify the code, you will find lots of comments directly into the
files (and the amount of such comments will increase with the version
number). A more complete documentation may become available some day
if enough users ask for it...



Since version 1.2, the package includes a convenient plotting script
called CPU (Class Plotting Utility), written by Benjamin Audren. It
can plot the Cl's or P(k) for one or two models, as well as their
ratio or percentage difference. A convenient feature is that
percentage differences can be shown even when two spectra are not
sampled in the same points, as it is often the case when comparing
matter power spectra P(k) for various models - in that case the script
uses some interpolation scheme. The type of spectrum (C_l or P(k)) is
detected automatically (provided that the file name endings are set by
CLASS in the standard way), and axes are labelled accordingly.

CPU is written in python, but you don't need to know anything
about python for using it, for you it will just be a simple command to
use on your terminal. However it will only work on systems with a
recent enough version of python including the 'scipy' package
(scientific python), and a recent enough version of gnuplot. You may
need to install some of them by yourself. These are standard free
facilities easy to download from the web. You don't need to compile
anything, if scipy and gnuplot are installed on your computer, the
CPU command will work immediately.

You can plot a spectrum produced by CLASS (or by another code) and
stored e.g. in the file output/xxx.dat with:

> python CPU output/xxx.dat

or two different spectra with:

> python CPU output/xxx.dat output/yyy.dat 

You can get a list of all available options by typing

> python CPU --help

These options allow you to choose between linear and log scale, to
plot ratios or relative differences between two files, to send the
output in a postscript file instead of the screen, etc.

If you put the path to class plot in the list of default paths, or if
you creat an alias, you may be able to type directly the command
'CPU' instead of 'python CPU'.


Cosmic Linear Anisotropy Solving System adaptation to include a dynamical scalar field






No packages published


  • C 94.9%
  • Python 3.2%
  • C++ 1.1%
  • Other 0.8%