Kosmulator: A Python framework for cosmological inference with MCMC
Renier T. Hough, Robert Rugg, Shambel Sahlu, Amare Abebe
TL;DR
Kosmulator tackles the bottleneck of testing non-standard cosmologies by providing a vectorised, pure-Python MCMC framework that bypasses full Einstein–Boltzmann solvers for rapid background and growth inferences. By comparing to Cobaya on Pantheon$^+$ SH0ES, CC, and DESI DR2 BAO data, it achieves near-identical posterior constraints on $H_{0}$ and $Ω_{m}$ (within 0.3σ) and precise $χ^{2}$ values, while delivering substantial wall-clock speedups on a single core. It also handles non-analytically solvable Friedmann equations via numerical solvers (e.g., $f1$CDM) and includes automatic model selection using AIC/BIC. The framework serves as a fast 'scientific sieve' to filter theories before committing resources to full perturbation-level analyses, and the authors outline future goals toward vectorised perturbations to close the loop with Boltzmann solvers.
Abstract
We present Kosmulator, a modular and vectorised Python framework designed to accelerate the statistical testing of cosmological models. As the theoretical landscape expands beyond standard $Λ$CDM, implementing new expansion histories into traditional Einstein--Boltzmann solvers becomes a significant computational bottleneck. Kosmulator addresses this by leveraging array-native execution and efficient ensemble slice sampling (via Zeus) to perform rapid Bayesian inference. We validate the framework against the industry-standard Cobaya code using a combination of Type Ia Supernovae, Cosmic Chronometers, and Baryon Acoustic Oscillation (BAO) data. Our results demonstrate that Kosmulator reproduces Cobaya's posterior constraints to within $\leq0.3σ$ statistical agreement on $H_{0}$ and $Ω_{m}$ and $<0.6\%$ precision on $χ^{2}$, while achieving a $\sim 4.5\times$ reduction in wall-clock time on a single CPU core compared to a standard MPI-parallelised baseline. Furthermore, we showcase the framework's utility by constraining the implicit power-law $f(Q)$ "$f_1$CDM" model and demonstrating its automated model selection capabilities (AIC/BIC). Kosmulator is introduced as a "scientific sieve" for rapid hypothesis testing, allowing researchers to efficiently filter theoretical candidates before deploying high-precision resources.
