nbodykit.cosmology.correlation

Functions

pk_to_xi(k, Pk[, ell, extrap])

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

xi_to_pk(r, xi[, ell, extrap])

Return a callable function returning the power spectrum multipole of degree \(\ell\), as computed from the Fourier transform of the input \(r\) and \(\xi_\ell(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__(self, r[, smoothing, kmin, kmax])

Return the correlation function (dimensionless) for separations r

__call__(self, 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, ell=0, extrap=True)[source]

Return a callable function returning the correlation function multipole of degree \(\ell\), as computed from the Fourier transform of the input \(k\) and \(P_\ell(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 multipole values

  • ell (int) – multipole degree of the input power spectrum and the output correlation function; monopole by default

  • 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, ell=0, extrap=False)[source]

Return a callable function returning the power spectrum multipole of degree \(\ell\), as computed from the Fourier transform of the input \(r\) and \(\xi_\ell(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 multipole values

  • ell (int) – multipole degree of the input correlation function and the output power spectrum; monopole by default

  • 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