pybird.emulator module
- class pybird.emulator.Emulator(emu_path, knots_path, load_models=True, co=<pybird.common.Common object>)[source]
Bases:
object
A class to emulate EFT of LSS calculations using neural networks.
The Emulator class provides fast predictions for various components of the EFT calculations by using pre-trained neural network models. It handles the emulation of loop corrections, counterterms, and IR resummation components.
- knots
Array of knot points used in the emulation.
- Type:
ndarray
- logknots
Log of the knot points.
- Type:
ndarray
- emu_ploopl_mono
Emulator model for monopole loop corrections.
- emu_ploopl_quad
Emulator model for quadrupole loop corrections.
- emu_ploopl_hex
Emulator model for hexadecapole loop corrections.
- emu_IRPs11
Emulator model for IR resummation P11 terms.
- emu_IRPsct
Emulator model for IR resummation counterterms.
- emu_IRPsloop_mono
Emulator model for monopole IR resummation loop terms.
- emu_IRPsloop_quad
Emulator model for quadrupole IR resummation loop terms.
- emu_IRPsloop_hex
Emulator model for hexadecapole IR resummation loop terms.
Initialize the Emulator for fast EFT calculations.
- Parameters:
emu_path (str) – Path to directory containing trained emulator model files
knots_path (str) – Path to file containing emulator knot points
load_models (bool, optional) – Whether to load models immediately upon initialization, by default True
co (Common, optional) – Common parameters object, by default co
Notes
The emulator provides 1000x speedup over full EFT calculations by using pre-trained neural networks. Models are valid up to kmax_emu = 0.4 h/Mpc.
- load_models()[source]
Load all pre-trained emulator models from disk.
Notes
This method loads neural network models for: - Loop corrections (monopole, quadrupole, hexadecapole) - IR resummation terms (P11, counterterms, loop terms)
Models are stored as HDF5 files and compiled for JAX execution.
- make_params(kk, pk, f=1.0, time=False, ir=False, pca=False)[source]
Prepare input parameters for emulator predictions.
- Parameters:
kk (ndarray) – k-array in h/Mpc
pk (ndarray) – Linear power spectrum in (Mpc/h)^3
f (float, optional) – Growth rate for RSD effects, by default 1.0
time (bool, optional) – Whether to include time dependence, by default False
ir (bool, optional) – Whether this is for IR resummation, by default False
pca (bool, optional) – Whether to use PCA compression, by default False
- Returns:
Formatted input parameters for the emulator models
- Return type:
ndarray
- setPsCfl(bird, kk, pk, time, make_params=True)[source]
Set power spectrum and correlation function using emulator predictions.
Uses neural network emulators to predict loop corrections and sets them in the provided Bird object.
- Parameters:
Notes
This method emulates the computationally expensive loop calculations, providing predictions for P22, P13, and correlation function multipoles.