Last update: 26-07-2019

arXiv GitHub version GitHub commits DOI GPLv3 license
PyPI version Docs Build Status

pySELFI is a statistical software package which implements the Simulator Expansion for Likelihood-Free Inference (SELFI) algorithm.

pySELFI is written in python 3 and licensed under GPLv3. The code is publicly available on GitHub, and the documentation is available on Read the Docs.

Limited user-support may be asked by email.

The SELFI algorithm

SELFI (Leclercq et al. 2019) is part of the family of approximate Bayesian computation (ABC) methods, which replace the use of the likelihood function with a data-generating "black-box" simulator. It builds upon a novel Gaussian effective likelihood, and upon the linearisation of black-box models around an expansion point. Further assuming that the prior is Gaussian, the effective posterior is Gaussian, with mean and covariance given by two "filter equations" reproduced below. The computational workload is fixed a priori by the user, and perfectly parallel.

SELFI summaryThe SELFI "filter equations" (top), and a summary of the statistical variables appearing in the equations and their interpretation in the context of galaxy survey data analysis (bottom).

An article on the Aquila Consortium's website discusses SELFI (in particular in comparison to BOLFI). It is available here: Algorithms for likelihood-free cosmological data analysis.

SELFI: primordial power spectrum inferencePrimordial matter power spectrum inference with pySELFI, using a Gaussian random field data model. The measurements of the final galaxy power spectrum in BOSS (0.2 < z < 0.5 bin, SGC, pre-recon, Beutler et al. 2016) are overplotted.

Key features

Current key features of pySELFI are:

  • implementation of the core "filter equations" of SELFI,
  • support of different black-box simulators,
  • input and output from simulation pools stored as hdf5 files,
  • optimisation of the prior hyperparameters for primordial power spectrum inference.


To acknowledge the use of pySELFI in research papers, please cite its doi:10.5281/zenodo.3341588 (or for the latest version, see the badge above), as well as the paper Leclercq et al. (2019):