pybird.nonlinear module
- class pybird.nonlinear.NonLinear(load_matrix=True, save_matrix=True, path=None, NFFT=256, fftbias=-1.6, co=<pybird.common.Common object>)[source]
Bases:
object
Computes the one-loop power spectrum and correlation function using FFTLog.
The NonLinear class calculates the one-loop power spectrum (P22, P13) and one-loop correlation function multipoles using the FFTLog method, which allows for efficient spherical Bessel transforms between Fourier and configuration space. The correlation function is particularly useful for performing the IR-resummation of the power spectrum.
Loop integrals and spherical Bessel transform matrices are either loaded from disk or computed at instantiation and optionally saved for future use.
- M22
22-loop power spectrum matrices.
- Type:
ndarray
- M13
13-loop power spectrum matrices.
- Type:
ndarray
- Mcf11
Linear correlation function multipole matrices.
- Type:
ndarray
- Ml
Auxiliary matrices for loop correlation function.
- Type:
ndarray
- Mcf22
22-loop correlation function multipole matrices.
- Type:
ndarray
- Mcf13
13-loop correlation function multipole matrices.
- Type:
ndarray
- Mcfct
Counterterm correlation function matrices.
- Type:
ndarray
- kPow
k^n powers for the loop power spectrum evaluation.
- Type:
ndarray
- sPow
s^n powers for the loop correlation function evaluation.
- Type:
ndarray
- optipathP22
Optimized einsum path for 22-loop power spectrum.
- Type:
einsum_path
- optipathC13l
Optimized einsum path for 13-loop correlation function.
- Type:
einsum_path
- optipathC22l
Optimized einsum path for 22-loop correlation function.
- Type:
einsum_path
Initialize the NonLinear engine for one-loop calculations.
- Parameters:
load_matrix (bool, optional) – Whether to load pre-computed matrices from disk, by default True
save_matrix (bool, optional) – Whether to save computed matrices to disk for future use, by default True
path (str, optional) – Directory path for saving/loading matrix files. If None, uses pybird/data/tmp, by default None
NFFT (int, optional) – Number of FFT points for FFTLog transforms, by default 256
fftbias (float, optional) – Real power bias parameter for FFTLog decomposition, by default -1.6
co (Common, optional) – Common parameters object, by default co
Notes
The initialization computes or loads the loop matrices (M22, M13) and correlation function transform matrices. Matrix files are named based on NFFT, bias, and multipole settings to ensure correct caching.
- setM22()[source]
Compute the 22-loop power spectrum matrices. Called at the instantiation of the class if the matrices are not loaded.
- setM13()[source]
Compute the 13-loop power spectrum matrices. Called at the instantiation of the class if the matrices are not loaded.
- setMcf11()[source]
Compute the 11-loop correlation function matrices. Called at the instantiation of the class if the matrices are not loaded.
- setMl()[source]
Compute the power spectrum to correlation function spherical Bessel transform matrices. Called at the instantiation of the class if the matrices are not loaded.
- setMcf22()[source]
Compute the 22-loop correlation function matrices. Called at the instantiation of the class if the matrices are not loaded.
- setMcf13()[source]
Compute the 13-loop correlation function matrices. Called at the instantiation of the class if the matrices are not loaded.
- setMcfct()[source]
Compute the counterterm correlation function matrices. Called at the instantiation of the class if the matrices are not loaded.
- setkPow()[source]
Compute the k’s to the powers of the FFTLog to evaluate the loop power spectrum. Called at the instantiation of the class.
- setsPow()[source]
Compute the s’s to the powers of the FFTLog to evaluate the loop correlation function. Called at the instantiation of the class.
- CoefkPow(Coef)[source]
Multiply the coefficients with the k’s to the powers of the FFTLog to evaluate the loop power spectrum.
- CoefsPow(Coef)[source]
Multiply the coefficients with the s’s to the powers of the FFTLog to evaluate the correlation function.
- makeCct(CoefsPow, bird)[source]
Perform the counterterm correlation function matrix multiplications
- Coef(bird)[source]
Perform the FFTLog (i.e. calculate the coefficients of the FFTLog) of the input linear power spectrum in the given a Bird().
- Parameters:
bird (class) – an object of type Bird()
- Ps(bird)[source]
Compute the loop power spectrum given a Bird(). Perform the FFTLog and the matrix multiplications.
- Parameters:
bird (class) – an object of type Bird()
- Cf(bird)[source]
Compute the loop correlation function given a Bird().
Performs the FFTLog spherical Bessel transform and matrix multiplications to compute the one-loop correlation function multipoles.
- Parameters:
bird (Bird) – Bird object containing cosmological parameters and linear power spectrum
Notes
This method computes C11, C22l, and C13l terms, which are the correlation function multipoles corresponding to linear, 22-loop, and 13-loop contributions. The results are stored in the bird object.
- PsCf(bird)[source]
Compute both power spectrum and correlation function loop terms.
This is the main method that computes both the one-loop power spectrum and correlation function multipoles for a given Bird object.
- Parameters:
bird (Bird) – Bird object containing cosmological parameters and linear power spectrum
Notes
This method combines Ps() and Cf() calculations, computing all one-loop terms (P22, P13, C11, C22l, C13l) and counterterms efficiently.