PyCosmo

As wide-​field surveys yield ever more precise measurements, cosmology has entered a phase of high precision requiring highly accurate and fast theoretical predictions. At the heart of most cosmological model predictions is a numerical solution of the Einstein-​Boltzmann equations governing the evolution of linear perturbations in the Universe. PyCosmo is a Python-​based framework to solve this set of equations and relies on the external sympy2c package for generation of optimized C/C++ code from SymPy symbolic expressions. The symbolic representation of the Einstein-​Boltzmann equation system in PyCosmo provides a convenient interface for implementing extended cosmological models. The PyCosmo framework can also be used as a general framework to compute cosmological quantities as well as observables for both interactive and high-​performance batch jobs applications.

pycosmo_eth

PyCosmo Hub

PyCosmo is conceived as a multi-​purpose cosmology calculation tool in Python, and designed to be interactive and user-​friendly. In order to make its usage immediate to the users, we make PyCosmo publicly available on a hub platform, called PyCosmo Hub: https://pycosmohub.phys.ethz.ch/hub/login. The users accessing the Hub can follow tutorials showing how to use PyCosmo. Also, they have space to write their own notebooks, make their own calculations and save the results, without the need of installing any software.

Code release and documentation

If you are interested in installing the software, here you can find the latest public release: .
Documentation about the software can be found at the link: https://cosmo-​docs.phys.ethz.ch/PyCosmo/. Tutorial notebooks are available on the PyCosmo Hub.

Publications

The first version of the code is described in Refregier et al., 2017 (external pagehttps://arxiv.org/abs/1708.05177). This paper focuses on the implementation of the Boltzmann solver and shows its performance in computing cosmological transfer functions (see the figure below). Tarsitano et al., 2021 (external pagehttps://arxiv.org/abs/2005.00543) focuses on the computation of cosmological quantities at the level of background, linear and non-​linear perturbations and observables. The accuracy of PyCosmo computations has been assessed through code comparison with other similar codes (external pageCLASS, external pageiCosmo, external pageCCL, external pageHMCode). Moser et al., 2021 (external pagehttps://arxiv.org/abs/2112.08395) describes the re-implementation and extension of the Boltzmann solver, which now uses the external pagesympy2c (Schmitt et al., in prep) package to generate optimized C/C++ code from symbolic expressions. The extensions include cosmological models (dark energy with a constant equation of state and massive neutrinos) and an approximation scheme (the Radiation Streaming Approximation). We compared PyCosmo with CLASS and found a good agreement both in terms of numerical accuracy and computing time.


If you use PyCosmo for your publications, please cite the papers above.

PyCosmo
Transfer function T(k) for the main perturbation fields at a = 1 as computed by PyCosmo. They were normalised such that T(k) → 1 as k → 0 and the reference accuracy setting for PyCosmo were used.

Public code releases

JavaScript has been disabled in your browser