[Paper Review] PyTransport: A Python package for the calculation of inflationary correlation functions
PyTransport 2.0 is a Python-C++ hybrid package that calculates inflationary correlation functions—such as the power spectrum and bispectrum—for multi-field inflation models with curved field space metrics. It uses the transport approach to solve coupled differential equations numerically, combining C++'s speed with Python’s usability for efficient, accurate, and extensible computation of cosmological observables.
PyTransport constitutes a straightforward code written in C++ together with Python scripts which automatically edit, compile and run the C++ code as a Python module. It has been written for Unix-like systems (OS X and Linux). Primarily the module employs the transport approach to inflationary cosmology to calculate the tree-level power-spectrum and bispectrum of user specified models of multi-field inflation, accounting for all sub and super-horizon effects. The transport method we utilise means only coupled differential equations need to be solved, and the implementation presented here combines the speed of C++ with the functionality and convenience of Python. This document details the code and illustrates how to use it with a worked example. It has been updated to be a companion to the second version of the code, PyTransport 2.0, which includes functionality to deal with models of inflation with a curved field space metric.
Motivation & Objective
- To provide a user-friendly, high-performance tool for computing inflationary correlation functions in multi-field inflation models.
- To extend the original PyTransport framework to handle models with curved field space metrics, enabling more realistic cosmological model analysis.
- To combine the numerical efficiency of C++ with the scripting flexibility of Python for rapid prototyping and large-scale computation.
- To support parallelization via MPI for scalable computation across multiple processors.
- To offer a reusable, extensible framework that allows researchers to easily adapt and extend the code for custom inflationary models.
Proposed method
- The code employs the transport method, reformulating inflationary correlation functions as systems of coupled ordinary differential equations (ODEs) for numerical integration.
- Numerically intensive ODE solving is performed in compiled C++ code, which is wrapped as a Python module for high performance.
- Python scripts manage compilation, configuration, and execution, enabling seamless integration and rapid prototyping.
- The package uses variable-step-size ODE solvers with error control to ensure numerical accuracy and convergence testing.
- It supports parallel computation via Mpi4Py, distributing k-mode calculations across multiple processes for scalability.
- The framework includes utility functions for common tasks such as power spectrum and bispectrum evaluation across a range of k-modes.
Experimental results
Research questions
- RQ1How can inflationary correlation functions be efficiently and accurately computed for multi-field models with curved field space metrics?
- RQ2What is the performance and accuracy trade-off when combining Python’s usability with C++'s computational speed in cosmological simulations?
- RQ3Can the transport method be effectively implemented in a modular, reusable, and extensible software framework for inflationary model building?
- RQ4How does parallelization via MPI improve scalability for large-scale k-mode sampling in bispectrum and power spectrum computations?
- RQ5What are the practical challenges in supporting both Python 2.7 and Python 3, and how can backward compatibility be managed during major version upgrades?
Key findings
- PyTransport 2.0 successfully computes the tree-level power spectrum and bispectrum for multi-field inflation models with curved field space metrics using the transport approach.
- The hybrid Python-C++ implementation achieves near-native C++ performance, making it suitable for large-scale numerical studies.
- The package supports parallel computation via Mpi4Py, enabling efficient distribution of k-mode calculations across multiple processors.
- Functions such as PyTransScripts.pSpectra and PyTransScripts.eqSpectra allow users to compute power spectra and equilateral bispectra over arrays of k-modes with full error control.
- The alpBetSpectra and alpBetMpi functions enable time-resolved tracking of the bispectrum across multiple times and k-mode configurations, supporting dynamic analysis of non-Gaussianity evolution.
- The code is designed for extensibility, allowing users to modify the underlying C++ code or adapt Python scripts to suit custom inflationary models.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.