---
title: 'PySCo-EFT: Python Toolkit for EFT Analyses'
url: https://www.emergentmind.com/topics/pysco-eft
type: topic
---

# PySCo-EFT: Python Toolkit for EFT Analyses

PySCo-EFT is a suite of Python-based computational tools and N-body simulation codes designed for Effective Field Theory (EFT) analyses in cosmology and quantum field theory. It encompasses both pipelines for reconstructing the EFT of Dark Energy (EFTofDE) from observational data and for establishing rigorous amplitude bounds in scalar EFTs, as well as high-performance numerical solvers for nonlinear large-scale structure simulations. The PySCo-EFT project integrates key developments from dispersive amplitude bounds, cosmological data inversion methods, and particle-mesh numerics, validated by direct comparison with theory and benchmark codes.

## 1. Conceptual Foundations and Scope

PySCo-EFT ("Python Scalar Code for Effective Field Theory") provides a modular framework for both theoretical and simulation-driven EFT studies. The package focuses on two principal domains:

- **Dispersive Amplitude Bounds**: Implements the sum-rule and positivity-based approach to bounding EFT coefficients of scalar field theories under causality and unitarity, as developed in "Extremal Effective Field Theories" [2011.02957].
- **Cosmological EFT of Dark Energy**: Supports the data-driven reconstruction and numerical simulation of the EFTofDE, including dark energy background reconstruction from $H(z)$ measurements [2512.03314] and large-scale structure evolution with nonlinear screening [2604.15434].

The architecture is characterized by modular Python/Numba codebases, statistical interfaces for covariance propagation, and, in its simulation variant, a parallelized particle-mesh (PM) N-body solver for scalar-tensor theories with nonlinear interactions and screening.

## 2. Mathematical Formalism of the Upstream Modules

### 2.1 Dispersive Sum-Rule and SDP Pipeline

The amplitude-bounds module of PySCo-EFT sets up the forward-scattering amplitude for massless scalar $2\to2$ processes using a twice-subtracted dispersion relation:
\[
A(s) = \sum_{k=0}^\infty a_{2k} \Lambda^{2k} s^k,\qquad a_{2k} = \frac{1}{\pi} \int_{M^2}^\infty \frac{ds'}{s'^{k+1}} \Im A(s').
\]
Positivity ($\rho(s) \ge 0$) gives rise to a Hankel-type matrix constraint:
\[
M_{rs} = \sum_{k=0}^{K-1} a_{2k} \mu_k^{(r,s)},\qquad
\mu_k^{(r,s)} = \int_1^\infty dx\, x^{-(k+r+s+1)} > 0,\qquad M \succeq 0,
\]
alongside crossing-symmetry (“null”) constraints that are imposed as linear equalities over the $a_{2k}$. The resulting problem is a semidefinite program (SDP) that can be solved for optimal upper and lower bounds on any low-energy Wilson coefficient. The practical code structure employs CVXPY/CVXOPT for SDP formulation and solution, and SciPy’s ConvexHull for outlining the extremal, allowed region [2011.02957]. Extremal points correspond to analytic simple spectra (such as $\delta$-peaks and stu-pole models).

### 2.2 EFTofDE Background and Phenomenological Functions

Within the EFTofDE formalism, the background dynamics in unitary-gauge scalar-tensor theories are controlled by time-dependent functions $M^2(t)$ (Planck mass squared), $\Lambda(t)$ (effective cosmological constant), and $c(t)$ (scalar-kinetic coefficient). These tadpole-like EFT functions are related to the Friedmann equations as:
\[
3 M^2 H^2 = \rho_m + \Lambda + c - 3 H \dot M^2
\]
\[
(2 \dot H + 3 H^2) M^2 = -p_m + \Lambda - c - 2 H \dot M^2 - \ddot M^2
\]
A common reparametrization uses the $\alpha$-basis:
- $\alpha_M = d \ln M^2 / d \ln a$ (Planck mass run-rate)
- $\alpha_K = c / (M^2 H^2)$ (kineticity)
- $\alpha_B$, $\alpha_T$ (braiding, tensor speed excess)

Reconstruction of $M^2$, $\Lambda$, $c$ from $H(z)$ and $\dot H(z)$—with observed $H(z)$ obtained via cosmic chronometers and Gaussian process regression—uses inversion formulae (e.g., eqs. (3.9)–(3.12) in [2512.03314]) with all time derivatives mapped to $z$-derivatives. These routines are implemented in Python (NumPy/SciPy), following a strict module separation between data acquisition, regression, differentiation, and nonlinear inversion.

## 3. PySCo-EFT N-Body Simulation Code for EFTofDE

### 3.1 Numerical Core and Data Structures

The PySCo-EFT PM code extends the original PySCo architecture with modules for EFTofDE perturbations and background evolution [2604.15434]. Key features include:
- Particle positions and velocities stored in Numba-typed float64 arrays for JIT compilation and parallelization.
- Density assignment to a uniform grid using cloud-in-cell (CIC) interpolation.
- Effective grid-level fields for gravitational potential and the scalar degree of freedom.
- Parallelization is realized with thread-level splitting of cell/particle loops, no MPI.
- All EFTofDE coefficient functions are precomputed on a grid in $a$ and interpolated per-step.

### 3.2 Physical Equations and Algorithmic Methods

The EFTofDE PM code solves:
- The **modified Poisson equation** for the gravitational potential $\Psi$,
\[
\tilde\nabla^2\,\Psi = \frac{3}{2} a \Omega_m(a)\frac{G_{\rm eff}(a)}{G}(\tilde\rho-1) + (\alpha_B-\alpha_M)\,\tilde\nabla^2\,\chi,
\]
where $G_{\rm eff}/G = \exp\left(-\int_0^a \frac{\alpha_M(a')}{a'} da'\right)$.

- A **nonlinear scalar field equation** incorporating Vainshtein screening,
\[
A_1(a)\,\tilde\nabla^2\chi + A_2(a)(\tilde\rho-1) - \frac{\mathcal C_4(a)}{4 E^2(a) a^4}
\Big[(\tilde\nabla^2\chi)^2 - \tilde\nabla_i \tilde\nabla_j \chi \tilde\nabla^i \tilde\nabla^j \chi\Big] = 0
\]

These equations are solved using a full-approximation-storage (FAS) multigrid method with local quadratic updates and under-relaxed Jacobi smoothing. The nonlinear Vainshtein bracket is discretized using finite-difference stencils for all second derivatives to maintain accuracy in high-density regimes.

## 4. Validation, Benchmarking, and Numerics

Validation includes:
- Agreement with linear theory on large scales ($k \lesssim 0.05\,h/{\rm Mpc}$) with power spectrum ratios $R(k)$ agreeing to <0.4% between code and analytic growth prediction.
- Cross-validation with ECOSMOG-EFT (RAMSES-AMR) finds agreement in $R(k)$ to <1% up to $k=3\,h/{\rm Mpc}$ for both linearised and fully nonlinear runs with $256^3$ particles in $328.125\,h^{-1}$Mpc boxes.

Extensive resolution and parameter convergence tests quantify the effects of mass resolution, finite-volume, refinement thresholds, smoothing parameters, and starting redshift on $R(k)$. For example, at $k=10\,h/{\rm Mpc}$, the aggregate numerical error is kept below 2% for all tested settings.

## 5. EFTofDE Parameter Dependence and Screening

The effect of model parameters is systematically explored:
- Varying $\alpha_{B0}$ determines the large-scale power spectrum boost and the importance of the Vainshtein mechanism. For $\alpha_{B0}=-0.36,-0.24,-0.12$, the larger the negative braiding, the stronger the linear boost.
- With $\alpha_{M0}<0$, the effective $G_{\rm eff}(a)$ is enhanced at late times, increasing small-scale clustering; for $\alpha_{M0}>0$, small-scale growth is suppressed.
- Screening is quantified by $|\mathcal{C}_4|$. For $|\mathcal{C}_4|\lesssim 0.1$, linearized and full nonlinear equations agree to <1% up to $k=2\,h/{\rm Mpc}$. For $|\mathcal{C}_4|\gtrsim 0.5$, fully nonlinear solution is essential; the difference reaches up to 35% in $R(k)$ at $k=2\,h/{\rm Mpc}$ for the largest $|\mathcal{C}_4|$ tested [2604.15434].

## 6. Data-Driven EFTofDE Reconstruction Pipeline

The background module provides a pipeline:
1. Loading $H(z)$ data from cosmic chronometers.
2. Gaussian process regression for interpolation and error propagation of $H(z)$ and $dH/dz$.
3. Inversion of $H(z)$ to obtain $M^2(z)$ (either constant, or using a parameterized $\alpha_M(z)$), then $\Lambda(z)$ and $c(z)$ using analytic formulae, propagating uncertainties throughout.
4. Validation is performed by comparing residuals $\Delta\Lambda(z)$ and normalized $c(z)$ to $\Lambda$CDM predictions and computing $\chi^2$-type tests.
5. For quintessence, reconstruction proceeds via the mapping $(z,H(z),c(z)) \to (\varphi(z),V(\varphi))$ with diagnostics on the scalar field’s reality and potential slope [2512.03314].

## 7. Algorithmic Summary and Usage

Representative module functions, all verifiable in the cited materials, include:
- Dispersive amplitude bounds: `PySCoEFT` class with `solve_bound()` to maximize/minimize $a_{2k}$ given positivity/null constraints [2011.02957].
- EFTofDE background: `reconstruct_EFT_functions(z,H,dHdz,...)` for inversion, `compute_dM2dz(z, M2, alpha_M)` for derivatives.
- Particle mesh code: command-line specification of cosmological and EFTofDE parameters, grid, particle number, redshift, and Jacobi smoothing; $>0.1$ cpu-hr per 256$^3$ run with percent-level accuracy at $k\sim1\,h/{\rm Mpc}$ [2604.15434].

The pipeline is encapsulated in self-contained Python modules—enabling researchers to perform causality/analyticity-constrained amplitude bounding, model-independent background reconstruction from cosmological data, and efficient PM-based N-body simulation of EFTofDE models, including nonlinear scalar screening and observable effects on the matter power spectrum.

Source: https://www.emergentmind.com/topics/pysco-eft