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.

co

Common parameters shared across calculations.

Type:

Common

fftsettings

Settings for FFTLog (Nmax, xmin, xmax, bias, window).

Type:

dict

fft

FFTLog engine for the transforms.

Type:

FFTLog

pyegg

Path to the cached matrices file.

Type:

str

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

setM22()[source]

Compute the 22-loop power spectrum matrices.

setM13()[source]

Compute the 13-loop power spectrum matrices.

setMcf11()[source]

Compute the linear correlation function matrices.

setMl()[source]

Compute the auxiliary matrices for loop correlation function.

setMcf22()[source]

Compute the 22-loop correlation function matrices.

setMcf13()[source]

Compute the 13-loop correlation function matrices.

setMcfct()[source]

Compute the counterterm correlation function matrices.

setkPow()[source]

Compute the k^n powers for the loop power spectrum.

setsPow()[source]

Compute the s^n powers for the loop correlation function.

CoefkPow(Coef)[source]

Multiply coefficients with k^n powers.

CoefsPow(Coef)[source]

Multiply coefficients with s^n powers.

makeP22(CoefkPow, bird)[source]

Compute the 22-loop power spectrum.

makeP13(CoefkPow, bird)[source]

Compute the 13-loop power spectrum.

makeC11(CoefsPow, bird)[source]

Compute the linear correlation function.

makeCct(CoefsPow, bird)[source]

Compute the counterterm correlation function.

makeC22l(CoefsPow, bird)[source]

Compute the 22-loop correlation function.

makeC13l(CoefsPow, bird)[source]

Compute the 13-loop correlation function.

Coef(bird)[source]

Compute the FFTLog coefficients for the input linear power spectrum.

Ps(bird)[source]

Compute the loop power spectrum.

Cf(bird)[source]

Compute the loop correlation function.

PsCf(bird)[source]

Compute both loop power spectrum and correlation function.

clean_lowk(bird)[source]

Clean up low-k values of loop power spectra.

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.

makeP22(CoefkPow, bird)[source]

Perform the 22-loop power spectrum matrix multiplications

makeP13(CoefkPow, bird)[source]

Perform the 13-loop power spectrum matrix multiplications

makeC11(CoefsPow, bird)[source]

Perform the linear correlation function matrix multiplications

makeCct(CoefsPow, bird)[source]

Perform the counterterm correlation function matrix multiplications

makeC22l(CoefsPow, bird)[source]

Perform the 22-loop correlation function matrix multiplications

makeC13l(CoefsPow, bird)[source]

Perform the 13-loop 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.

clean_lowk(bird)[source]
pybird.nonlinear.M13a(n1)[source]

Common part of the 13-loop matrices

pybird.nonlinear.M22a(n1, n2)[source]

Common part of the 22-loop matrices