Skip to content

PyCosmo: an integrated cosmological Boltzmann solver

Research output: Contribution to journalArticlepeer-review

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. We present PyCosmo, a new Python-based framework to solve this set of equations using a special purpose solver based on symbolic manipulations, automatic generation of C++ code and sparsity optimisation. The code uses a consistency relation of the field equations to adapt the time step and does not rely on physical approximations for speed-up. After reviewing the system of first-order linear homogeneous differential equations to be solved, we describe the numerical scheme implemented in PyCosmo. We then compare the predictions and performance of the code for the computation of the transfer functions of cosmological perturbations and compare it to existing cosmological Boltzmann codes. While PyCosmo does not yet have all the features of other codes, our approach is complementary to other fast cosmological Boltzmann solvers and can be used as an independent test of their numerical solutions. The symbolic representation of the Einstein–Boltzmann equation system in PyCosmo provides a convenient interface for implementing extended cosmological models. We also discuss how 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. Information about the PyCosmo package and future code releases are available at

Original languageEnglish
Pages (from-to)38-43
Number of pages6
JournalAstronomy and Computing
Early online date13 Aug 2018
Publication statusPublished - Oct 2018
Relations Get citation (various referencing formats)

ID: 20383160