nbodykit.cosmology.correlation

Functions

pk_to_xi(k, Pk[, extrap]) Return a callable function returning the correlation function, as computed from the Fourier transform of the input \(k\) and \(P(k)\) arrays.
xi_to_pk(r, xi[, extrap]) Return a callable function returning the power spectrum, as computed from the Fourier transform of the input \(r\) and \(\xi(r)\) arrays.

Classes

CorrelationFunction(power) Evaluate the correlation function by Fourier transforming a power spectrum object, with automatic re-scaling with redshift and sigma8.
class nbodykit.cosmology.correlation.CorrelationFunction(power)[source]

Evaluate the correlation function by Fourier transforming a power spectrum object, with automatic re-scaling with redshift and sigma8.

Parameters:power (callable) – a callable power spectrum that returns the power at a given k; this should have redshift, sigma8, and cosmo attributes

Attributes

attrs
cosmo
redshift
sigma8

Methods

__call__(r[, smoothing, kmin, kmax]) Return the correlation function (dimensionless) for separations r
__call__(r, smoothing=0.0, kmin=1e-05, kmax=10.0)[source]

Return the correlation function (dimensionless) for separations r

Parameters:
  • r (float, array_like) – the separation array in units of \(h^{-1} \mathrm(Mpc)\)
  • smoothing (float, optional) – the std deviation of the Fourier space Gaussian smoothing to apply to P(k) before taking the FFT
  • kmin (float, optional) – the minimum k value to compute P(k) for before taking the FFT
  • kmax (float, optional) – the maximum k value to compute P(k) for before taking the FFT
nbodykit.cosmology.correlation.pk_to_xi(k, Pk, extrap=True)[source]

Return a callable function returning the correlation function, as computed from the Fourier transform of the input \(k\) and \(P(k)\) arrays.

This uses the mcfit package perform the FFT.

Parameters:
  • k (array_like) – wavenumbers where Pk is evaluated
  • Pk (array_like) – the array holding the power spectrum values
  • extrap (bool, optional) – whether to extrapolate the power spectrum with a power law; can improve the smoothness of the FFT
Returns:

a spline holding the interpolated correlation function values

Return type:

InterpolatedUnivariateSpline

nbodykit.cosmology.correlation.xi_to_pk(r, xi, extrap=False)[source]

Return a callable function returning the power spectrum, as computed from the Fourier transform of the input \(r\) and \(\xi(r)\) arrays.

This uses the mcfit package perform the FFT.

Parameters:
  • r (array_like) – separation values where xi is evaluated
  • xi (array_like) – the array holding the correlation function values
  • extrap (bool, optional) – whether to extrapolate the power spectrum with a power law; can improve the smoothness of the FFT
Returns:

a spline holding the interpolated power spectrum values

Return type:

InterpolatedUnivariateSpline