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. Its name also comes from the fact that it is written in object-oriented style mimicking the notion of class. Classes are a wonderfull programming feature available e.g. in C++ and python, but these languages are known to be less vectorizable/parallelizable than plain C (or Fortran), and hence potentially slower. For CLASS we choose to use plain C for high performances, while organizing the code in a few modules that reproduce the architecture and philosophy of C++ classes, for optimal readability and modularity.


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.2.3, by clicking class_public-3.2.3.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.


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 (make clean; make class; maybe with option -j to speed it up). 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 -ffast-math) 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). Several details on the CLASS compilation are given on the installation wiki page (in particular, for compiling on Mac OS >= 10.9 despite potential incompatibilities between clang, OpenMP, and versions of python compiled on your computer with gcc).

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.


  • CLASS I: Overview, by J. Lesgourgues, arXiv:1104.2932 [astro-ph.IM]
  • CLASS II: Approximation schemes, by D. Blas, J. Lesgourgues, T. Tram, arXiv:1104.2933 [astro-ph.CO], JCAP 1107 (2011) 034
  • CLASS III: Comparision with CAMB for LambdaCDM, by J. Lesgourgues, arXiv:1104.2934 [astro-ph.CO]
  • CLASS IV: Efficient implementation of non-cold relics, by J. Lesgourgues, T. Tram, arXiv:1104.2935 [astro-ph.CO], JCAP 1109 (2011) 032
  • Efficient computation of the non-linear matter power spectrum of LambdaCDM, by B. Audren, J. Lesgourgues, arXiv:1106.2607 [astro-ph.CO], JCAP 1110 (2011) 037
  • Optimal polarisation equations in FLRW universes, by Thomas Tram, Julien Lesgourgues, JCAP 1310 (2013) 002
  • Fast and accurate CMB computations in non-flat FLRW universes, by Julien Lesgourgues, Thomas Tram, JCAP 09 (2014) 032
  • The CLASSgal code for Relativistic Cosmological Large Scale Structure, by E. Di Dio, F. Montanari, J. Lesgourgues and R. Durrer, JCAP 1311 (2013) 044
  • Optimal Boltzmann hierarchies with nonvanishing spatial curvature, by Cyril Pitrou, Thiago S. Pereira, Julien Lesgourgues, 2005.12119, Phys.Rev.D 102 (2020) 2, 023511.
  • The synergy between CMB spectral distortions and anisotropies, by Matteo Lucca, Nils Schoeneberg, Deanna C. Hooper, Julien Lesgourgues, Jens Chluba, 1910.04619, JCAP 02 (2020) 026.

Version history

The developement of CLASS benefits from various essential contributors credited below. In absence of specific credits, developements are written by the main CLASS authors, Julien Lesgourgues and Thomas Tram.

In case you are interested in downloading an old version, go to the class_public page. Close to the branch name (by default master) you can click on branches or tags. Click tags and you'll get access to zip or tar.gz archives of each previous minor release vx.y.z.

v3.2 (29.03.2022)
  • Implementation of multi-interacting dark matter (idm) as described in 2010.04074. The idm species may interact not only with dark radiation following the ETHOS formalism (a feature already introduced in v2.9), but also with photons and baryons, with the possibility to have 1, 2 or 3 interaction channels at the same time. For a description of new functionalities, search for idm in explanatory.ini (credits: N. Becker, D. C. Hooper, N. Schöneberg)
  • This release also features minor typo and bug fixes, as well as a systematic correction of the indentation of the C files (credits: D. C. Hooper)
  • 10.10.2023 (v3.2.1): in the python wrapper classy, new function scale_dependent_growth_factor(), and fixes in get_pk_all(); in input, new parameter names ln10^10A_s, 100*theta_s, 100*theta_star, S8; increased default precision of background module; fixed compatibility issue with cython 3; minor bug fixes (credits: J. Ange, B. Bolliet, S. Guenther, L. Honorez-Lopez, M. Lucca, F. McCarty, C. Pitrou, J. Torrado - and as usual JL, NS, TT)
  • 3.02.2024 (v3.2.2): the calculation of the CMB lensing potential power spectrum has been made considerably more accurate and efficient at large l (and has also been improved at low l in the non-Limber range). One can now obtain very accurate lensed CMB Cl's at very large l values (e.g. 6000 or more) without any slow-down of the code. The Limber approximation is still used below l_switch_limber, set by default to 10. The new calculation, called full_limber inside the code, is toggled by an input flag want_lcmb_full_limber set by default to yes. Users interested in the details of this feature can read the comments in input/precision.h regarding the new precision parameters perturbations_sampling_boost_above_age_fraction, q_logstep_limber, k_max_limber_over_l_max_scalars, and the modified precision parameter k_max_tau0_over_l_max. Thanks to B. Bolliet for his precious help on these features. Also, in classy, enhanced interpolation features in get_pk_all(): the log of P(k) can be interpolated with either a linear or cubic (default) algorithm.
  • 20.02.2024 (v3.2.3): improvement in compilation method. CLASS is now pip installable with pip install classy. For the C code compilation, OpenMP is no longer required. Even if the code is still written in plain C, the few modules using parallelisation will now get compiled with the C++ compiler found on your machine (for instance, GNU g++ or clang), which has some in-built parallelisation syntax. To allow for this, some macros have been adapted, and the few lines with OpenMP parallelisation syntax have been changed to match C++ parallelisation syntax.
v3.1 (30.09.2021)
  • Implementation of varying fundamental constants alpha (fine structure constant) and me (effective electron mass). This feature already existed in HyRec2020; we implemented it also in RecFastCLASS and in the CLASS wrapper of the two recombination codes (credits N. Schöneberg). The physics is described e.g. in Hart and Chluba 1705.03925. For a description of input parameters and functionalities, search varying_fundamental_constants in explanatory.ini.
  • Minor updates in Hyrec2020 (credits N. Lee) and several minor bug fixes.
  • 7.12.2021 (v3.1.1): instead of Omega_cdm or omega_cdm, user can pass in input Omega_m or omega_m: the code will adjust automatically the CDM abundance, taking into account all other non-relativistic abundances; also, added new functions perturbations_at_z() and perturbations_at_k_and_z(), and fixed several minor typos and bugs (credits: N. Schöneberg, Fereshteh Majidi)
  • 22.02.2022 (v3.1.2): in the python wrapper classy, several new functions: Om_b(z), Om_cdm(z), Om_ncdm(z), angular_distance_from_to(), scale_independent_f_sigma8(), effective_f_sigma8(), effective_f_sigma8_spline(), get_transfer_and_k_and_z(), get_Weyl_pk_and_k_and_z(); behavior of sigma() and get_pk_and_k_and_z() improved; fixed a bug concerning the maximum value k_max used for P(k) calculations and output.
  • 24.03.2022 (v3.1.3): made the shooting method much more efficient for sigma8; fixed a bug affecting Decaying Dark Matter results since v2.10.1, detected by Jozef Bucko; fixed a memory leak in get_transfer_and_k_and_z() (credits: N. Schöneberg)
v3.0 (12.03.2021)
  • Several major improvements detailed below in the description of v2.10. Most important: new module calculating CMB spectral distortions, and implementation of various models for energy injection relevant for both anisotropies and distortions (see 1910.04619); recombination calculated by default with HyRec2020 (see 2007.14114) or optionally with an improved RecFastCLASS; background and thermodynamics equations integrated with the same ODE solvers as perturbation equations, by default the implicit ndf15 solver; improved structure and style of input, background and thermodynamics modules (credits D.C. Hooper, N. Lee, D. Meinert, and particularly N. Schoeneberg, M. Lucca)
  • Two modules renamed in order to better reflect their physical role: nonlinear renamed as fourier (calculation of observables in Fourier space: P(k,z), delta_i(k,z), etc.), and spectra renamed as harmonic (calculation of observables in harmonic space: C_l's). Also, for each module, the name of the main structure and the prefix now matches exactly the module name. The renaming task is done automatically by a script CLASS_rename.py distributed with the code, that may transform any CLASS version forward and backward.
  • These are the biggest changes ever in a release, and we care about our users who wish to propagate these changes smoothly through their own modified version! Thus we provide many incremental revisions of the master branch, tagged as 2.10.0 to 2.10.8 (see below). Once your branch is up-to-date (merged) with 2.9.4, merge it step-by-step with 2.10.0, then 2.10.1, then 2.10.2, etc., up to 2.10.8. Each step will update only one of the new modules, plus its ancillary files for consistency. In this way, potential conflicts should remain tractable. Importantly, after each step, you should check whether your code still compilables (and possibly fix issues until it does). Once you have merged with 2.10.8 and your code compiles and runs, type python CLASS_rename.py --method rename, and you will be up-to-date with 3.0.0!
  • 19.03.2021 (v3.0.1): Updates to match online version of HyRec-2 (effective rate table was extended for the case Tm>Tr, update for varying constants).
  • 8.09.2021 (v3.0.2): Minor fixes: issues of indentation, memory leaks (in HyRec-2, shooting, ncdm), bugs when having only tensors, three names changed erroneously by the automatic renaming script (nonlinear_method, nonlinear_scale, nonlinear_min_k_max). Restored input parameters DM_annihilation_fraction and function distortions_read_detector_noisefile(). Increased default value of precision parameter nonlinear_min_k_max, and improved the scripts for the continuous integration workflow.
v2.10 (12.03.2021)
  • This version, whose tags are available on the class_public git repository, are only meant to introduce the changes from 2.9.4 to 3.0.0 in a smooth, step-by-step way. By merging your branch successively with each of the tagged versions 2.10.0 to 2.10.8, you will keep potential conflicts under control. The description of each tagged version is useful to understand the main differences between v2.9.4 and v3.0.0.
  • v2.10.0: Technical preparation for the next steps. Small update of several files and algorithms in the tools/ directory (including new functionalities for splining, interpolating, parsing). Also, the files relevant for BBN calculations, for the external_Pk option and for the RealSpaceInterface are moved to a new directory external/
  • v2.10.1: Input module entirely re-organised, with distinct functions parsing different categories of input parameters. New comprehensive input file explanatory.ini reflecting the new structure. Default cosmological parameter values set to a LambdaCDM model with massless neutrinos that is the closest possible to the Planck 2018 best-fit with m_nu=0.06eV (the new CLASS default model has the same peak scale).
  • v2.10.2: Restructured background module. The differential equations are integrated over log(a) instead of conformal time. They are handled exactly in the same way (with the same generic functions, the same syntax, the same ODE solvers) as the perturbation equations. By default they get integrated with the implicit solver ndf15. This allows to implement extended cosmologies with stiff background equations, like e.g. in 2008.08486.
  • v2.10.3: Fully rewritten and restructured thermodynamics module. Recombination is handled by default by HyRec-2 (by N. Lee and Y. Ali-Haimoud, 2007.14114), or optionally by RecfastCLASS (an improved version of RecFast 1.5 with slightly better approximations at early times and no discontinuities). These two codes are located in the external directory and called through dedicated wrappers. The new thermodynmics module can handle many more scenarios for heating / energy injection, implemented in an external module external/heating called by the thermodynamics module if necessary. For details on new input parameters, see explanatory.ini, and for more information on the underlying physics, see the release paper 1910.04619. Either HyRec or Recfast are used to provide differential equations for the ionisation rates only, and in all cases, the system of equations for ionisation and temperature is integrated by CLASS, exactly in the same way (with the same generic functions, the same syntax, the same ODE solvers) as the perturbation equations. By default equations get integrated with the implicit solver ndf15. This allows to implement extended cosmologies with stiffer thermodynamical equation, like e.g. in 2010.04074. Finally, default value of N_eff (= N_ur in absence of massive neutrinos and extra light relics) changed from 3.046 to 3.0440 (see 2008.01074 and 2012.02726). Changes propagated to all input files and to a new non-exhaustive input file default.ini that is more user-friendly than the exhaustive explanatory.ini.
  • v2.10.4: Very minor updates to the perturbation module (just to propagate the changes in the background and thermodynamics ones).
  • v2.10.5: Very minor updates to the primordial, nonlinear, transfer, spectra and lensing modules, to propagate the changes in the background and thermodynamics ones. Also, new option to fix a larger k_max in the primordial module than in the perturbation module (optional input parameter primordial_P_k_max_1/Mpc or primordial_P_k_max_h/Mpc).
  • v2.10.6: Entirely new distortion module distortions.c, called after the lensing module if necessary. It computes CMB spectral distortions induced both by exotic energy injection mechanisms (called just injection with CLASS) or by heating mechanisms inherent to the standard thermal history (called noninjection). Uses the Green function method of J. Chluba (see 1304.6120), like in CosmoTherm, and its PCA decomposition (see 1306.5751). The same tabulated Green function are located in external/distortions and distributed within the CLASS package with kind permission of J. Chluba. The heating mechanisms responsible for distortions are implemented in the external injection and noninjection modules located in external/heating. For details on all possible input parameters and output, see explanatory.ini and the README file in the folder external/distortions.
  • v2.10.7: Updated version of all our examples of python scripts (in scripts/) and jupyter notebooks (in notebooks/) for compatibility with the new version and with python 3.
  • v2.10.8: Updated doxygen documentation (in doc/), C++ wrapper (in cpp/) and test codes (in test/). Added the script CLASS_rename.py that renames a few modules / structures / prefixes and transform automatically 2.10.8 into 3.0.0 (see python CLASS_rename.py --help).
v2.9 (21.01.2020)
  • two additional species: dark matter interacting with dark radiation idm_dr, and its partner: interacting dark radiation idr. Follows the ETHOS framework described in 1512.05344. As a special case, can also take as input the parameters of the models of 1507.04351 (with non-abelian dark matter, dark gluons...). See explanatory.ini for the parametrisation of both cases and 1706.06870, 1907.01496 for more details. The new sector includes a tight-coupling approximation and a radiation streaming approximation that are useful for studying dark decoupling, dark acoustic oscillations, etc., without slowing down the code (credits M. Archidiacono, S. Bohr, D.C. Hooper)
  • new function nonlinear_pk_tilt_at_k_and_z() giving the effective logarithmic slope of the matter power spectrum at any given wavenumber and redhsift; useful in data likelihoods related to large scale structure (credits M. Archidiacono)
  • 3.03.2020 (v2.9.1): restored better way to interpolate P(k,z) along k like before v2.8; fixed memory leak in idm_dr sector (credits D.C. Hooper)
  • 25.03.2020 (v2.9.2): various bug fixes related to the N-body gauge and idm_dr features, to the p_cb output, and to the fld initial conditions in Newtonian gauge (credits E. Bellini, M. Buen-Abad, A. Hall, S. Heimersheim)
  • 10.04.2020 (v2.9.3): various bug fixes related to the N-body gauge, to the C++ wrapper, and to the possibility to run without any Cls requested (credits O. Hahn)
  • 20.07.2020 (v2.9.4): increased default precision of 1D shooting; fixed small details in Halofit; improved coding style of pk_eq method; removed old test codes; plus minor bug fixes (credits J.L. Bernal, F. Lepori, I. Tutusaus)
v2.8 (22.11.2019)
  • accurate implementation of HMcode (A. Mead et al. 1602.02154) on top of Halofit. Switch on with non linear = HMcode. The default settings are calibrated against DM-only COSMIC EMU simulations (Heitmann et al. 1304.7849). The baryonic feedback can be switched on and customized with the entry feedback model described in explanatory.ini (credits S. Brieden, M. Archidiacono)
  • new entry Nbody gauge transfer functions to optionally output the transfer functions of the density and velocity of each species, as well as selected metric perturbations in N-body gauge. Useful for a GR intepretation of N-body simulations, see e.g. 1505.04756, 1610.04236 and 1811.00904.
  • the code previously defined the time of recombination from the peak of the visibility function. There is another sensible definition: when the Thomson optical depth crosses one. The code now computes everything (redshift, angular distance, sound horizon...) at both times, with a suffix _rec for the first definition and _star for the second.
  • better performance when computing number count Cls, thanks to the re-ordering of some operations (credits S. Schoeneberg, M. Archidiacono). Note that we do not include yet the FFTlog method (1807.09540) in the master branch, but you can already find it and use it in the separate branch class_matter of the public class GitHub repository.
  • if background_verbose is set to 2 or more, the code writes a new section in the standard output, with more details on all the omega's and Omega's for the model being computed (credits N. Schoeneberg)
  • unlike recently claimed by some authors, we re-checked that the baryon sound speed is consistently included in the code. Some PDF notes on this topic will soon be added here.
  • something relevant for developers but not for end-users: there was a major internal restructuring of the nonlinear.c and spectra.c modules, to avoid redundency, be more consistent and improve efficiency. Some functions are deprecated (but not suppressed), and some warnings alert the user when they should switch to newer and better functions. These technical notes explain the changes, their motivations, and how to get around with them when you merge you own branch forked from <=2.7 with >=2.8.
  • better visibility of precision parameters: their definitions, default values and descriptions are now all grouped in a unique file include/precisions.h that contains nothing else (credits N. Schoeneberg)
  • fixed several minor bugs (credits M. Archidiacono, S. Brieden, N. Schoeneberg, J. Torrado)
  • 25.11.2019 (v2.8.1): further bug fixes: avoiding random rounding errors, restoring calculation of non-linear corrections for Cls only (thanks to Antony Lewis)
  • 3.12.2019 (v2.8.2): better handling of classy version number, avoid memory leaks for extreme parameter values (useful especially for nested sampling) (credits Jesus Torrado)
v2.7 (10.09.2018)
  • includes a new graphical interface showing the evolution of linear perturbations in real space, useful for pedagogical purposes. To run it on a browser, read instructions in RealSpaceInterface/README (credits: Max Beutelspacher, Georgios Samaras)
  • when running with ncdm (non cold dark matter) while asking for the matter power spectrum mPk, you will automatically get both the total non-relativistic matter spectrum Pm(k,z) and the baryons-plus-cdm-only (cb) spectrum Pcb(k,z). The latter is useful e.g. for computing the power spectrum of galaxies, which traces bc instead of total matter (see e.g. 1311.0866, 1807.04672). From the classy wrapper you get the cb quantities through several new functions like pk_cb(), get_pk_cb(), sigma8_cb(), etc. (Credits: M. Archidiacono, Samuel Brieden, Nils Schöneberg)
  • implementation of the P(k) equal method (see 0810.0190, 1601.07230) when using Halofit in combination with a fluid with arbitrary (w0_fld, wa_fld) parameters. Switch on with entry pk_eq=yes (the default is no). The method is applied up to a redshift pk_eq_z_max set by default to 5 (Credits: M. Archidiacono, S. Clesse)
  • includes eleven new illustrative notebooks in notebooks/, and their plain python script counterparts in scripts/ (content documented in the Cambridge or eventually Darmouth CLASS lectures slides)
  • few bug and memory leak fixes
  • 22.10.2018 (v2.7.1): removed useless .ini and .pre files; added input files matching Planck baseline model with best fit values (base_2015_plikHM_TT_lowTEB_lensing.ini, base_2018_plikHM_TTTEEE_lowl_lowE_lensing.ini); in python wrapper, reinitialisation with struct_cleanup() now done automatically; several minor bug fixes (credits D.C. Hooper, J. Torrado, N. Schöneberg)
  • 11.04.2019 (v2.7.2): added couple of functions in wrapper (credits J. Torrado, N. Schöneberg) for compatibility with LSS likelihoods in Cobaya v1.1
v2.6 (25.03.2017)
  • by default, the perturbations of the fluid sector _fld (usually employed to play the role of Dark Energy) now follow the PPF approximation instead of real fluid equations, which allows to cross the phantom divide (but user can still switch to true fluid equations, see use_ppf parameter in explanatory.ini). Our PPF equations afe implemented in both newtonian and synchronous gauge as explained in these notes. Also, it is now simpler to customise the function w_fld(a) because it appears in only one place in the function background_w_fld().
  • compilation and installation scripts made more robust, classy wrapper compatible with python 3 if you compile with the option PYTHON=python3 make all (credits M. Millea); you can use it in your python sessions, scripts, notebooks, etc.; note however that MontePython is still only compatible with python 2.7 for the moment, and wants a classy version compiled with python 2.x.
  • more accurate calculation of the scale independent CDM growth factor D(a) - and f(a) - taking into account radiation and dark energy.
  • option extra metric transfer functions to output the transfer functions of all metric perturbations (credits W. Valkenburg).
  • among the reionisation parametrisation options reio_parametrisation, added a new scheme reio_inter for linear interpolation between discrete values of xe(z). Other schemes (e.g. tanh() steps) are still there.
  • 2.07.2017 (v2.6.1): few bug fixes (e.g. for P_NL(k) with isocurvature modes); solved memory leak issues in the wrapper.
  • 23.10.2017 (v2.6.2): minor improvements; the most important is a boost of the Halofit precision: previously, purely numerical random errors in Halofit could spoil your future LSS experiment forecasts; also updated the BBN interpolation table (credits: Ophelia Pisanti), added sigma8 as a possible input parameter instead of A_s, and gave the user the possibility to control manually the quadrature scheme used to discretise the momentum space of NCDM (only relevant for NCDM experts willing to achieve high precision, e.g., with WDM at large k); also, improved compilation script, gave possibility to run with tensors only (e.g. modes=t, A_s=1, r=1 would mean: tensors only with A_t=1), and improved formula for the diffusion damping scale.
  • 24.10.2017 (v2.6.3): restored compatibility with python 3 (broken in 2.6.2 by small modification of setup.py)
v2.5 (29.03.2016)
  • automatic documentation generated by doxygen (credits D.C. Hooper). You can browse the html documentation online, or view the PDF located in your CLASS folder doc/manual/.
  • number density count (known as CLASSgal features) generalised to curved space, as described in paper in preparation. Also corrected evolution bias and improved Limber approximation scheme for number counts (credits: Francesco Montanari, Enea Di Dio)
  • a few new parameters, like the effective sound/viscosity speed of ultra-relativistic species ceff2_ur, cvis2_ur
  • for many-step reionisation, coded the scheme reio_many_tanh, a more sensible scheme than reio_bins_tanh (see section 3.c of explanatory.ini for details)
  • if you want to plot transfer functions at very high redshift (even before recombination), you can now increase z_pk or z_max_pk up to arbitrary high values, provided that the output contains only non-CMB (non-tCl,pCl,lCl) entries.
  • new options in inflationary module, like N_star or inflation_behavior = analytical (see explanatory.ini for details)
  • several minor bug fixes (credits Sandro Pinto, Francesco Montanari, Guido Pettinari, Aurelien Benoit-Levy and others)
  • 10.03.2017 (v2.5.1): compatible with python3 (credits M. Millea), fixes for a more robust wrapper installation, new reionisation scheme 'reio_inter' (see explanatory.ini for details)
v2.4 (29.09.2014)
  • extended inflation simulator embedded in the primordial module. Option 'inflation_V' (input = V(phi) function in observable range) still exists, but more efficient; two new options 'inflation_H' (input = H(phi) function in observable range) and 'inflation_V_end' (input = V(phi) trusted until the end of inflation, and parameters specifying the amount of inflation between the Hubble crossing for the pivot scale and the end of inflation). See explanatory.ini for details on new input parameters.
  • improved accuracy of Limber approximation in curved space, as explained in Appendix E of JCAP 09 (2014) 032
  • the python code for plotting output files, CPU.py, has been significantly improved (type python CPU.py --help to check options and input format) (credits: Benjamin Audren, Jesus Torrado).
  • the classy wrapper can now output many more quantities than just the CMB Cl's and P(k): density Cl's (this can be used for Euclid forecast with detailled modelling of the power spectrum, credits Benjamin Audren), evolution of background, thermodynamical, perturbation quantities, density and velocity transfer functions.
  • expanded automatic tests, with a detailled explanation in the header of python/test_class.py. It is now easy to combine models, add new scenarios to test, and systematically compare the implementation in synchronous and Newtonian gauge.
  • improvements in the Decay Dark Matter (ddm) sector: choice between more input formats, fixed error in Newtonian gauge.
  • increased precision settings for CMB and P(k) with massive neutrinos or WDM (ncdm) in the Newtonian gauge (thanks to Mathias Garny).
  • various small bug fixes (credits Guido Pettinari) and memory leak fixes.
  • 12.10.2014 (v2.4.1): default parameter values updated close to Planck 2013 best fit
  • 06.01.2015 (v2.4.2): minor improvements, mainly related to the plotting unit CPU.py, to the Makefile and to the use of the functionality k_output_values=... (perturbations are now stored in files for exactly those values, not values close to them)
  • 10.03.2015 (v2.4.3): minor mistakes corrected (lensing potential in curved space, details of nCl and DM annihilation calculation, density-lensing correlations between bins), as well as a long-standing rare bug in the integrator
  • 21.10.2015 (v2.4.4): few bugs corrected in thermodynamics and transfer module. One of them, introduced in 2.4.3, could cause the code to remained stalled (only on some architectures). Another one was problematic only when using HyRec with annihilating Dark Matter. Small revision of the expression and sampling of the jumps in the reio_bins_tanh scheme, to make it more robust against interpolation errors
  • 22.02.2016 (v2.4.5): Corrected a few bugs affecting Halofit precision, mainly with with massive nu or decaying DM (Thanks to Carmelita Carbone, Matteo Zennaro, Vivian Poulin)
v2.3 (09.05.2014)
  • implemented a new species: decaying cold dark matter (dcdm) and its relativistic decay product (dr); also, background module improved, now ready for adding easily other cases where one needs to integrate more background quantitites over time than just the scale factor a(tau).
  • implemented a new input parameter: '100*theta_s', the angle of the sound horizon at decoupling (thanks to S. Plaszczynski); also, input module improved, now ready for adding easily several input parameters which require a shooting method (like '100*theta_s' or the decaying dark matter density today 'Omega_dcdmdr', another example not written yet would be 'sigma_8')
  • increased precision settings, consequences mainly for P(k) at large k >> 0.1 h/Mpc (thanks to Chi-Ting Chiang, Mathias Garny, Aurel Schneider)
  • tensor calculation sped up, thanks to independent sampling of wavenumber space for scalars and tensors
  • the 'root' name preceeding all output file names is now set by default to the input file name plus the first available integer number (e.g. output/myname00_ the first time, output/myname01_ in the next run...); also, improved output file headers with automatic column numbering
  • classy wrapper improved (installation compatible with both Python2.6 and 2.7, handles tensor and isocurvature modes, improved automatic testing with nosetests python/test_class.py, changed the function get_current_derived_parameters() to accept as argument a list of names) (credits: Benjamin Audren)
  • new MATLAB plotting routine plot_CLASS_output.m, type help plot_CLASS_output.m in MATLAB for usage
  • the other plotting routine, CPU, is in the process of being rewritten. A new file, CPU.py is using matplotlib, and works exactly like the MATLAB routine - but is so far incomplete (credits: Benjamin Audren)
  • 26.05.2014 (v2.3.2): fixed minor bugs and extended functionalities of CPU.py
v2.2 (28.03.2014)
  • incorporated massless and massive neutrinos (in the language of the code, the ultra-relativistic ur and non-cold dark matter ncdm species) in the calculation of tensor modes (for temperature and polarisation)
  • for speed up, included two approximation schemes for tensors, described in the field tensor method of explanatory.ini. By default, when evolving tensor perturbations, the code will replace massive neutrinos by an appropriate amount of massless ones. This works very well, especially for masses below 0.6eV, and even above. The exact calculation involving the ncdm momentum space can always be restored.
v2.1 (07.03.2014)
  • the ClassGAL features developped in JCAP 1311 (2013) 044 (by E. Di Dio, F. Montanari, J. Lesgourgues and R. Durrer) have been imported into the main distribution of the code. The naive "density Cl's" are replaced by the "number count Cls", calculated if the 'output' entry includes 'nCl'. The user can choose to include all relativistic corrections by passing 'number count contributions = density, rsd, lensing, gr', or only the dominant terms. One can also tune the selection function, linear bias, magnification bias and evolution effects (see the description of the fields 'dNdz_selection', 'bias', 's_bias', 'dNdz_evolution' in explanatory.ini and in the appendix of JCAP 1311 (2013) 044).
  • the non-linear module has been completely re-written. In the main function, the non-linear module is now called before the transfer module, to allow for the calculation of lensing Cl's, density Cl's and lensed CMB Cl's including non-linear corrections. The module features HALOFIT recalibrated by Takahashi et al., extended to massive neutrinos following the same method as in arXiv:1109.4416 (input command 'non linear = halofit' (vredits Simeon Bird). The one-loop and time renormalisation algorithms of previous versions have been dropped temporarily, but new methods are now easier to incorporate, and will be implemented in the future.
  • new features for passing or plotting the primordial power spectrum (credits Jesus Torrado). They are active when the input is set to 'P_k_ini type = external_Pk' (instead of the other options 'analytic_Pk', 'inflation_V', 'two scales'). The user can pass the primordial spectrum as an input file, or even compute it on-the-fly with an external code (in whatever language). The input is then the command line for running that code. This is described briefly in explanatory.ini and extensively in the external_Pk/README.md file delivered with the code. Finally, for whatever way of computing the primordial spectrum, the user can output it in a file with the input command 'write primordial' described in explanatory.ini.
  • implementation of perturbed recombination (credits Luc Voruz), based on arXiv:0707.2727 and astro-ph/0503196. A detailed description of related equations is provided in these notes. Perturbed recombination can be switched on by passing 'perturbed recombination = yes', as explained in explanatory.ini.
  • facility for printing perturbations as a function of time (credits Thomas Tram). In order to physically understand what you are doing, or produce nice plots in a paper, it is useful to output the evolution of each perturbation (of matter components, of the metric, etc.) as a function of time. This feature is now directly accessible from the input file, by passing a list of wavenumbers in the field 'k_output_values' as described in explanatory.ini. Then the corresponding output files will be written.
  • compatible with version 2.0 of Monte Python (credits Benjamin Audren)
  • improved Python wrapper classy.pyx (credits Benjamin Audren), mainly a change of function names and error classes. (For developers: a test suite has been written, in python/test_class.py, which necessitates the python "nose" package. It calls CLASS sequentially on many combinations of models, and is useful to check that CLASS is still working after having made modifications.) For details see the new wiki on the python wrapper and on the python test function.
  • 22.03.2013 (v2.1.2): corrected a few bugs introduced in v2.1.0 (most important related to calculation of baryon drag redshift, credits Francesco Montesano), and updated Halofit with the revision of Takahashi et al. 2012 extended to massive neutrinos (credits Simeon Bird)
v2.0 (01.10.2013)
  • implementation of spatial curvature (credits Thomas Tram). Curvature is set using the 'Omega_k' input parameter (positive for negative curvature, following the usual convention).
  • the perturbation module relies on the optimal Boltzmann hierarchy described in arXiv:1305.3261 [astro-ph.CO].
  • the transfer module has exprienced major changes. For the computation of hyperspherical Bessel functions and transfer functions, some explanations on the methodology, the precision, the comparison with other codes are given in arXiv:1312.2697. In brief, with default precision settings, the scalar temperature Cls are precise at the 0.1% level, and the scalar polarisation Cls at the 0.2% level. The code remains very fast for small curvature, but the running time increases with the absolute value of Omega_k.
  • more accurate for tensor modes, and ready for working with vector modes (they are already implemented in the transfer module).
  • spherical Bessel functions cannot be stored/read from a file anymore, because the gain in time was too marginal. All Bessel functions are now computed on-the-fly by a set of new efficient functions, called directly from the transfer module. Hence, the bessels module and structure have been eliminated.
  • 09.10.2013 (v2.0.2): added the possibility to output the correlation Cls between density and galaxy lensing; computation of hyperspherical bessel functions made faster thanks to a vectorisation scheme; fixed a few bugs; restored the same sign convention for E-modes as CAMB and CMBFAST, while v2.0.1 had the opposite convention, taken from Hu & White.
  • 31.10.2013 (v2.0.3): several little bug fixes, accuracy of ClTphi and ClEphi restored, thanks to S. Plaszczynski and G. Pettinari
  • 09.12.2013 (v2.0.4): wavenumber sampling and few approximations improved, to match arXiv:1312.2697. New input field temperature contributions, allows to compute separately the SW, late and early ISW, Doppler and polarisation contributions.
v1.7 (21.03.2013)
  • version ready for use with Planck. Three precision parameters increased to match Planck sensitivity. With new default settings, Planck chi2 accurate up to approximately 0.5. This has been proved to be sufficient for parameter extraction from Planck data when using MCMC algorithms (checked through intensive testing within Planck collaboration, comparing different codes and various accuracy settings). Still possible to use higher precision settings when needed, e.g. for a very precise minimization of Planck chi2, or to derive frequentist bounds.
  • compatible with version 1.2 of Monte Python (credits Benjamin Audren). This version of the parameter extraction code is interfaced with the Planck and WMAP9 likelihoods, and features fast nuisance parameters (similar to the new CosmoMC implementation but simpler: does the Cholesky parameter rotation, but not the fast-parameter dragging scheme; this is sufficient for a considerable speed up) (credits A. Lewis)
  • implements an alternative parameter set for the primordial spectrum, consisting in amplitudes at two scales instead of one amplitude and one tilt, identical to the parameters in the isocurvature section of the Planck inflation paper. See explanatory.ini for all possibilities.
  • plethora of derived parameters defined in the python wrapper python/classy.pyx, ready to be used in Monte Python: slow-roll parameters, isocurvature fraction defined in different manners, tilt and running computed numerically at the end of the inflationary module.
  • for DM annihilation, new flag to switch on/off the on-the-spot approximation.
  • 28.03.2013: restored computation of lensed BB spectrum, set accidentally to zero in versions 1.6.x and 1.7.0 (but OK in earlier versions; thanks to Giulio Fabbian for pointing it out)
  • 04.04.2013: fixed bug introduced in 1.7.0, leading to segmentation fault in newtonian gauge (thanks to Ivan Duran Sancho for pointing it out)
v1.6 (15.01.2013)
  • computation of full-sky galaxy lensing potential Cl's, useful for cosmic shear experiments (if you add sCl to the field output=...)
  • for both lensing Cl's (sCl) and density Cl's (dCl), source galaxies can be distributed in redshift bins with either gaussian, tophat or dirac-like selection functions (see field selection in explanatory.ini). Also the dCl calculation has been speeded up and redesigned for more accurate results, even when the bins are many, and/or thin, and/or at small redhsift.
  • the python wrapper python/classy.pyx includes more functionalities, useful for running with the updated version 1.1 of Monte Python (credits Benjamin Audren)
  • several bugs fixed (many thanks to Stephane Plaszczynski, Sophie Henrot-Versille, Alberto Vallinotto, Katarina Markovic, Guido Pettinari, Matthieu Roman). The major one affected the CMB lensing potential Cl's, but only occasionally and when running with high precision settings (with a value of the precision parameter perturb_sampling_stepsize smaller than the default one). Another bug could occasionally affect the result of the Halofit routine.
v1.5 (25.10.2012)
  • changed three defaut values of RECFAST parameters to match RECFAST v1.5.2
  • module primordial includes an inflation simulator computing the primordial spectrum fully numerically, for a given expression of the scalar potential valid within the observable inflation range (as in Lesgourgues and Walkenburg (2007)), see explanatory.ini for details on possible input parameters
  • includes several parameters to model CDM annihilation (in the smooth background and in halos), as in Gisen et al. (2012)
  • code can output not only individual density transfer functions, but also individual velocity transfer functions (if you add vTk to the field output=...)
  • python wrapper python/classy.pyx expanded for compatibility with parameter inference code Monte Python v1.0
  • corrected bug that showed up when trying to get finely sampled transfer functions. Sampling can now be arbitrarily fine.
  • internal re-ordering of operations in transfer modules, that speeds up the calculation of matter density Cl's. Also, the user can compute correlation between all shells or only between neighbouring shells.
v1.4 (13.02.2012)
  • recombination can be computed either with RECFAST v1.5, or with the HyRec code by Y. Ali-Haimoud & C. Hirata. Just set the input parameter recombination to either RECFAST or HyRec. HyRec is slower, but more precise and flexible. Both codes agree at the level of precision of Planck and for standard cosmology. The November 2011 version of HyRec is distributed together with v1.4. Class can be compiled without HyRec by leaving HYREC = blank in the Makefile, instead of putting there the path to HyRec (default: compiled with the distributed version, located in class/hyrec/) (credits Y. Ali-Haimoud and C. Hirata)
  • user can choose between the same reionization history as in CAMB (featuring a single step for hydrogen reionization), or a binned reionization history, with arbitrary bin number, position and width (similar to implementation in Lewis, Weller and Battye (2006)). Set input parameter reionization to either reio_camb or reio_bins_tanh, and see explanatory.ini for more details on input parameters (binned_reio_z, binned_reio_z, etc.)
  • user can choose to pass a numerical value for the primordial helium fraction YHe, or let it be fixed as a function of omega_b and N_eff by standard BBN calculations, by setting YHe to BBN (as in Hamann, Lesgourgues and Mangano (2008))
  • includes latest version of HALOFIT, working even in presence of massive neutrinos (from Bird, Viel and Haehnelt (2011)). Set non linear to HALOFIT to get the non-linear P(k) (credits B. Audren and S. Bird)
  • improved newtonian gauge: phi is integrated over time rather than infered from constraint equation; in that way newtonian gauge calculations are more accurate than in v1.3, and remain stable even in presence of isocurvature modes or massive neutrinos (credits Guido W. Pettinari)
  • user can choose to pass some numerical values for the tensor tilt and running (n_t, alpha_t), or let them be fixed by the two self-consistency conditions of single field slow-roll inflation, by setting these entries to scc (see explanatory.ini for details)
  • if output includes dCl, the code will compute the Cl spectra of matter density perturbations in an arbitrary number of redshift bins (defined by gaussian window functions, with arbitrary centers and widths, fixed through input variables selection_mean and selection_width). The output ..._cl.dat file will then contain CMB (if requested) plus density spectra, including all possible cross-correlations. See explanatory.ini for details on input parameters.
  • corrected a few bugs previously affecting temperature/polarization tensor spectra.
  • python wrapper for class, available in the python/ directory (see python/README). Used by the cosmological parameter extraction code that we will release soon (credits K. Benabed and B. Audren)
  • c++ wrapper for class, available in the cpp/ directory (see cpp/README) (credits S. Plaszczynski)
v1.3 (08.11.2011)
  • implementation of the Newtonian / longitudinal gauge equations on top of the synchronous ones. The user can choose the gauge by writing e.g. gauge=newtonian in the input file (by default, set to synchronous gauge). The Newtonian gauge calculations turn out to be essentially as stable, fast and accurate as the synchronous ones for LambdaCDM. Instabilities may occur when ncdm (= non-cold dark matter, e.g. massive neutrinos) and/or isocurvature modes are turned on: in those two cases, the code outputs roughly the right answer (provided that the tol_ncdm precision parameter is decreased by a factor 100), but the convergence of the spectra in the limit of increased precision parameters is not obvious.
  • by default, the component called fluid can have not only an arbitrary sound speed, but also a time-varying equation of state of the form w=w0+wa*(1-a/a0); a couple of bugs in this fluid sector have been fixed.
  • CPU (Class Plotting Utility) upgraded to version 1.3, with an extra option -colnum N useful for plotting polarisation and lensing potential spectra. More details on CPU in the README file.
  • issue of initial conditions in the power spectrum renormalisation module trg.c fixed according to discussion in Audren & Lesgourgues 2011.
v1.2 (13.06.2011)
  • new trg.c module allowing to compute the non-linear density, velocity and cross density-velocity power spectra on mildly non-linear scales, using either the dynamical 1-loop method (fast) or the Time Renormalization Group method (1 hour/number of CPU); see Audren & Lesgourgues 2011. In the input file, you just need to set non linear=one-loop or non linear=trg. So far, this module works only for LambdaCDM with no non-cold relics or dark energy.
  • fast mode for CMB lensed spectra calculation. Speeds up the code significantly. For very accurate calculations, you can still tune the precision parameter accurate_lensing and use the previous method. Credits: Simon Prunet.
  • in input file, user can choose the format of output files: format=class for CLASS format (as in previous versions), format=camb for camb-like format (compatible with Healpix, etc.). Also, all output file headers can be omitted with headers=no.
  • convenient python module named CPU for plotting CLASS output spectra. Can plot one or several spectra, or the relative difference between two spectra (even when they are sampled with different values, as it is usually the case for P(k)'s). Works for C_l^TT and P(k). Detects the type of output file and infers axes and labels. See the various options by typing python CPU --help or python CPU -h. Typical usage: python CPU output/myspectrum.dat for a single spectrum. For using CPU you need to have on your machine a recent version of python and scientific python (scipy), as well as gnuplot.
  • new precision file chi2pl10.pre for even faster (but less accurate) CMB calculation than with default settings.
  • bug in dark energy fluid equations fixed on 16.06.11, thanks to Vid Irsic for pointing it out.
v1.1 (16.05.2011)
  • slightly modified definition of three trigger parameters controlling UFA and RSA approximations (refer to tau instead of tau_h). Changed precision files accordingly.
  • corrected bug previously leading to segmentation fault when computing lensed temperature but not polarisation
v1.0 (16.04.2011)
  • first public version


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 3.02.2024