Skip to content

Fork of the Cosmic Linear Anisotropy Solving System (CLASS) version 2.9 used in https://arxiv.org/abs/2108.02747

Notifications You must be signed in to change notification settings

misharash/class_public

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CLASS: Cosmic Linear Anisotropy Solving System {#mainpage}

Authors: Julien Lesgourgues and Thomas Tram (base code), Michael Rashkovetskyi, Julian B. Muñoz, Daniel J. Eisenstein and Cora Dvorkin (this fork)

with several major inputs from other people, especially Benjamin Audren, Simon Prunet, Jesus Torrado, Miguel Zumalacarregui, Francesco Montanari, etc.

For download and information, see http://class-code.net

FORK DESCRIPTION

This is the implementation of three-zone model for recombination (mimicking small-scale baryon inhomogeneities/clumping) introduced in Rashkovetskyi et al 2021, as well as some others. One can use any of them by changing the recombination parameter of CLASS to the model's name from the following list:

  • recfast_3zones_lowlevel - M3 from Rashkovetskyi et al 2021. Uses parameters delta_m, delta_p and f2V (the latter corresponds to $f_0$ in the paper; default values -0.9, 1.05 and 1/3 respectively).
  • hyrec_3zones_lowlevel - the same as above except uses HyREC instead of RECFAST to handle each zone.
  • recfast_3zones - parametrization from Jedamzik & Pogosian 2020. Uses parameters Delta1, Delta2, f2V and clumping_b (default values 0.1, 1, 1/3 and 0 respectively). Changing only $b$ (clumping_b) gives M1 model from the paper, setting Delta1=0.3 gives M2. Also compatible with Thiele et al 2021.
  • hyrec_3zones - the same but HyREC instead of RECFAST.
  • recfast_Nzones or hyrec_Nzones - model with arbitrary number of zones. Uses binomial weights for zones and places densities log-uniformly to get the desired relative variance of density ($b$/clumping_b). Input parameters: clumping_b (default 0, meaning no clumping), Nzones (numer of zones, default 10) and p_zones (to compute binomial weights, default 0.5). Extreme densities cause recombination codes to fail, and it is hard to predict or avoid in this parametrization.
  • recfast_Nzones_lowlevel or hyrec_Nzones_lowlevel - a bit different parametrization of arbitrary number of zones. Uses binomial weights for zones, places densities log-uniformly between preset minimal and maximal values, also ensuring that mean relative density is 1. Refinement of original Nzones inspired by 3zones_lowlevel scheme and reuses some of its parameters. Input parameters: Nzones (numer of zones, default 10), delta_m (relative overdensity in the least dense zone, default -0.9) and delta_p (relative overdensity in the most dense zone, default 1.05). Gives tiny weights in extreme density zones thus typically weak clumping effect.
  • recfast_3zones_moments or hyrec_3zones_moments - parametrization based on skewness and kurtosis of density distribution, also ensures the densities do not get too low/high because it causes the recombination codes to fail, found very hard to explain and interpret. Input parameters: Delta_min (minimal allowed relative density, default 0.1), Delta_max (maximal allowed relative density, default 0.1), s_prime (where to place skewness between minimal and maximal ones following by density constraints, value between 0 and 1, default 0.5) and k_prime (kurtosis minus minimal kurtosis for the given skewness, default 2).

Compiling CLASS and getting started

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

Download the code from the webpage and unpack the archive (tar -zxvf class_vx.y.z.tar.gz), or clone it from https://github.com/lesgourg/class_public. Go to the class directory (cd class/ or class_public/ or class_vx.y.z/) and compile (make clean; make class). You can usually speed up compilation with the option -j: make -j 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 optimization 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). Many more details on the CLASS compilation are given on the wiki page

https://github.com/lesgourg/class_public/wiki/Installation

(in particular, for compiling on Mac >= 10.9 despite of the clang incompatibility with OpenMP).

To check that the code runs, type:

./class explanatory.ini

The explanatory.ini file is THE reference input file, containing and explaining 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, for instance:

./class test.ini cl_permille.pre

The files *.pre are suppposed to specify the precision parameters for which you don't want to keep default values. If you find it more convenient, you can pass these precision parameter values in your *.ini file instead of an additional *.pre file.

The automatically-generated documentation is located in

doc/manual/html/index.html
doc/manual/CLASS_manual.pdf

On top of that, if you wish to modify the code, you will find lots of comments directly in the files.

Python

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' (or for speeding up: 'make -j'). More details on the wrapper and its compilation are found on the wiki page

https://github.com/lesgourg/class_public/wiki

Plotting utility

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 output, 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 -h'. There is a similar script for MATLAB, written by Thomas Tram. To use it, once in MATLAB, type 'help plot_CLASS_output.m'

Developing the code

If you want to develop the code, we suggest that you download it from the github webpage

https://github.com/lesgourg/class_public

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. For related instructions, check

https://github.com/lesgourg/class_public/wiki/Public-Contributing

Using the code

You can use CLASS freely, provided that in your publications, you cite at least the paper CLASS II: Approximation schemes <http://arxiv.org/abs/1104.2933>. Feel free to cite more CLASS papers!

Support

To get support, please open a new issue on the

https://github.com/lesgourg/class_public

webpage!

About

Fork of the Cosmic Linear Anisotropy Solving System (CLASS) version 2.9 used in https://arxiv.org/abs/2108.02747

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 60.9%
  • Jupyter Notebook 22.2%
  • JavaScript 4.3%
  • Python 4.0%
  • Cython 2.4%
  • CSS 1.2%
  • Other 5.0%