CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
The CosmoBolognaLib documentation

Here you can find the full documentation of the CosmoBolognaLib, a large set of free software C++ libraries for cosmological calculations. Among many other things, these libraries can be used to measure the two-point and three-point correlation functions, and to model redshift-space distortions and baryon acoustic oscillations.

Please have a look at the example codes in CosmoBolognaLib/Examples/ that show how to use the CosmoBolognaLib in either C++ or Python codes.

If you use the CosmoBolognaLib, please reference the code paper: CosmoBolognaLib: C++ libraries for cosmological calculations http://arxiv.org/abs/1511.00012

The specific tools to analyse cosmic void catalogues are presented in https://arxiv.org/abs/1703.07848

These are the scientific publications that used the CosmoBolognaLib: publications I and publications II



Author and BDFL:

Main contributors:

  • Sofia Contarini (voids, python, CBL logo, etc.)
  • Giorgio Lesci (cluster number counts, weak-lensing profiles, super-sample covariance, conda virtual environment, CAMB wrapper, etc.)
  • Michele Moresco (three-point correlation)
  • Alfonso Veropalumbo (two-point angular correlation, clustering wedges, jackknife and bootstrap, lognormal mocks, BAO modelling, MCMC, three-point correlation modelling, etc.)

Other contributors:

  • Carlo Cannarozzo (void detection)
  • Cosimo Fedeli (non-Gaussian cosmologies)
  • Giovanni Gandolfi (HOD modelling)
  • Jorge Enrique GarcĂ­a-Farieta (two-point correlation modelling)
  • Carlo Giocoli (mass accretion history)
  • Jacopo Neri (mass function)
  • Davide Pelliciari (probe combination)
  • Massimiliano Romanello (angular clustering)
  • Mauro Roncarelli (fast comoving distance estimator)
  • Tommaso Ronconi (void number counts)
  • Simone Sartori (void detection)
  • Luca Stabellini (HOD)
  • Alessandro Benati, Elena Sarpa, Akke Viitanen (code validation)


A configured virtual development environment to use the CosmoBolognaLib is available here:
https://apps.difa.unibo.it/files/people/Str957-cluster/astro/CosmoBolognaLib_VM/Ubuntu_CBL.ova
the password is: ilovecbl

Alternatively, to install the CosmoBolognaLib on a custom Unix/Mac distribution, please follow the instructions below:

first, make sure that the following external libraries are present in your system:

  • GSL (GNU Scientific Library) (v2.1 is required)
  • FFTW (Fastest Fourier Transform in the West)
  • OpenMP (Open Multiprocessing)
  • CFITSIO
  • Boost

if the paths of these libraries are not the default ones, then they have to be added to the LD_LIBRARY_PATH environment variable (e.g. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/your_path)

the FFTW have to be compiled as shared libraries and using OpenMP compiler directives (e.g. on Unix systems: ./configure –enable-shared –enable-openmp)

then:

  • download the CosmobolognaLib:

either, clone the public GitLab repository of the CosmobolognaLib with:

$ git clone git@gitlab.com:/federicomarulli/CosmoBolognaLib

or, alternatively, download the unzip the CosmoBolognaLib-master.zip archive at https://gitlab.com/federicomarulli/CosmoBolognaLib/archive/master.zip

  • enter the folder CosmoBolognaLib/ and type:

$ make


by default, make will compile the full set of libraries using the GNU project g++ compile (>=v11.2.0 is required); both the compiler and the compilation flags can be specified by modifying the variables C and FLAGS defined in the Makefile (e.g.: make C=icpc FLAGS="-O0 -g")

  • other Makefile options are:

$ make lib* [ —> compile the * library (e.g. make libFUNC will compile the library libFUNC.so) ]

$ make python [ —> compile the Python wrappers (SWIG >=v3.0.7 is required); in this case, CosmoBolognaLib/Python/ has to be added in PYTHONPATH (e.g. in .bashrc add the following line: export PYTHONPATH=$PYTHONPATH:/path_to/CosmoBolognaLib/Python/); to specify a different python version set the PY variable (e.g. make python PY=python2) ]

$ make cleanpy [ —> remove the Python wrappers ]


$ make allExamples [ —> compile all the C++ example codes ]

$ make cleanExamples [ —> remove all the object files of the examples ]

$ make documentation [ —> create the documentation (Doxygen is required) ]

$ make clean [ —> cleanExamples + remove all the object files of the libraries ]

$ make purge [ —> make clean + remove all the library files (i.e. *.so) ]

$ make purgeALL [—> make purge + make cleanpy + remove all the files stored for internal calculations ]


  • optionally, the following external softwares used by the CosmoBolognaLib can be compiled with the following commands:

$ make CUBA

$ make CCfits

$ make CAMB

$ make CLASS

$ make MPTbreeze

$ make mangle

It is also possible to create a conda environment for the CosmoBolognaLib, called "cbl".
In CosmoBolognaLib/, run

$ conda env create -f environment.yml

$ conda activate cbl

In order to compile the CosmoBolognaLib in the conda environment, run

$ python environment_compile.py

To run e.g. make clean in the conda environment, run

$ python environment_compile.py clean

In order to compile scripts that include CosmoBolognaLib, it is necessary to specify the library path for the compiler.
For example, in Ubuntu add the following line to the .bashrc file:

export LD_LIBRARY_PATH=/path/to/CosmoBolognaLib/

Then, to compile for example a script named script.cpp, run

$ make script CXX=$GXX HOME=$CONDA_PREFIX