C L A S S

the Cosmic Linear Anisotropy Solving System




The purpose of CLASS is to simulate the evolution of linear perturbations in the universe and to compute CMB and large scale structure observables. CLASS also embeds several ways to compute non-linear corrections to linear perturbation theory. CLASS is written mainly in plain C, but with an original object-oriented style mimicking the notion of class. Since v3.2.3, some modules are actually compiled as C++, to handle the parallelisation of loops in the C++ way. The whole code is wrapped in the python module classy.

We hope that you will enjoy the use of CLASS,

Julien Lesgourgues, Nils Schöneberg, Thomas Tram

Download

The use of CLASS is free provided that when you use it in a publication, you cite at least the paper CLASS II: Approximation schemes (reference below). You are welcome to cite any other CLASS paper if relevant!

There are three ways to get to use CLASS. If you only want to use it through its python wrapper classy and not modify it, just install it as a python module with pip install classy. If you want to see the code and/or modify it just for yourself, download a tar.gz archive of the latest released (master branch) version, v3.3.4, by clicking class_public-3.3.4.tar.gz. But if you are familiar with git repositories, and you wish to develop a new branch of the code, or see all public branches and/or old versions, you will prefer to clone it from the class_public git repository.


Documentation

After downloading the code, unpack the archive (tar -zxvf class_public-vx.y.z.tar.gz), go to the class directory (cd class_public-vx.y.z/) and compile. Several details on the CLASS compilation are given on the installation wiki page. In a nutshell:

  • If you are only interested in running CLASS through its python wrapper classy, install it with pip install . (since v3.3.0; before you had to execute make clean; make -j all). To check that things work, you may run any of our demo python scripts located in scripts/ (e.g. python scripts/warmup.py), or any of the equivalent jupyter notebooks located in notebooks/.

  • If instead you are interested in compiling the C code and running in a terminal, execute make clean; make -j class. To check that the code runs, type: ./class explanatory.ini The explanatory.ini file is a reference input file, containing and explaning the use of all possible input parameters. We recommend to read it, to keep it unchanged (for future reference), and to create for your own purposes some shorter input files, containing only the input lines which are useful for you. Input files must have a *.ini extension. 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 (e.g. ./class test.ini cl_permille.pre).

    For more details, view our online html documentation generated by doxygen (credits D.C. Hooper). Other CLASS papers dedicated to various aspects of the code are listed below. You can also look at slides from CLASS-dedicated courses.

    To use CLASS from python, or ipython notebooks, or from the Monte Python parameter extraction code, you need to compile not only the code, but also its python wrapper. This can be done by typing just make instead of make class. More details on the wrapper and its compilation are found on the wiki page.

    Since version 2.3, the package includes an improved plotting script called CPU.py (Class Plotting Utility), written by Benjamin Audren and Jesus Torrado. It can plot the Cl's, the P(k) or any other CLASS puput, for one or several models, as well as their ratio or percentage difference. The syntax and list of available options is obtained by typing pyhton CPU.py --help. There is a similar script for MATLAB, written by Thomas Tram. To use it, once in MATLAB, type help plot_CLASS_output.m

    If you want to develop the code, we suggest that you download it from the github webpage rather than from class-code.net. Then you will enjoy all the feature of git repositories. You can even develop your own branch and get it merged to the public distribution, following the public contributing instructions.


    Papers

  • v2.3 (09.05.2014)
    v2.2 (28.03.2014)
    v2.1 (07.03.2014)
    v2.0 (01.10.2013)
    v1.7 (21.03.2013)
    v1.6 (15.01.2013)
    v1.5 (25.10.2012)
    v1.4 (13.02.2012)
    v1.3 (08.11.2011)
    v1.2 (13.06.2011)
    v1.1 (16.05.2011)
    v1.0 (16.04.2011)

    Support

    Please report bugs, ask questions and send comments/suggestions through the GitHub website class_public. Go to that page, click issue and then New issue. Then write your text and press Submit new issue. Your text will automatically be sent by e-mail to the class developpers, and they will answer you as soon as possible.
    If your question is related to the MontePython code, you should do the same but on the montepython_public page.
    Webmaster Julien Lesgourgues; thanks to Diego Blas for aesthetic advices.
    Last update on the 27.08.2025

    AltStyle によって変換されたページ (->オリジナル) /