nbodykit.algorithms.fftcorr

Classes

FFTCorr(first, mode[, Nmesh, BoxSize, ...])

Algorithm to compute the 1d or 2d correlation and/or multipoles in a periodic box, using a Fast Fourier Transform (FFT).

class nbodykit.algorithms.fftcorr.FFTCorr(first, mode, Nmesh=None, BoxSize=None, second=None, los=[0, 0, 1], Nmu=5, dr=None, rmin=0.0, rmax=None, poles=[])[source]

Algorithm to compute the 1d or 2d correlation and/or multipoles in a periodic box, using a Fast Fourier Transform (FFT).

This computes the power spectrum as the square of the Fourier modes of the density field, which are computed via a FFT. Then it is transformed back to obtain the correlation function.

Results are computed when the object is inititalized. See the documenation of run() for the attributes storing the results.

Note

This is very similar to FFTPower.

Parameters
  • first (CatalogSource, MeshSource) – the source for the first field; if a CatalogSource is provided, it is automatically converted to MeshSource using the default painting parameters (via to_mesh())

  • mode ({'1d', '2d'}) – compute either 1d or 2d power spectra

  • Nmesh (int, optional) – the number of cells per side in the particle mesh used to paint the source

  • BoxSize (int, 3-vector, optional) – the size of the box

  • second (CatalogSource, MeshSource, optional) – the second source for cross-correlations

  • los (array_like , optional) – the direction to use as the line-of-sight; must be a unit vector

  • Nmu (int, optional) – the number of mu bins to use from \(\mu=[0,1]\); if mode = 1d, then Nmu is set to 1

  • dr (float, optional) – the linear spacing of r bins to use; if not provided, the fundamental mode of the box is used; if dr=0, the bins are tight, such that each bin has a unique r value.

  • rmin (float, optional) – the lower edge of the first r bin to use

  • rmax (float, optional) – the upper limit of the last r bin to use

  • poles (list of int, optional) – a list of multipole numbers ell to compute \(\xi_\ell(r)\) from \(\xi(r,\mu)\)

Methods

load(output[, comm])

Load a saved result.

run()

Compute the correlation function in a periodic box, using FFTs.

save(output)

Save the result to disk.

classmethod load(output, comm=None)

Load a saved result. The result has been saved to disk with save().

run()[source]

Compute the correlation function in a periodic box, using FFTs.

Returns

  • corr (BinnedStatistic) – a BinnedStatistic object that holds the measured \(\xi(r)\) or \(\xi(r,\mu)\). It stores the following variables:

    • r :

      the mean value for each r bin

    • mumode=2d only

      the mean value for each mu bin

    • corr :

      real array storing the correlation function

    • modes :

      the number of modes averaged together in each bin

  • poles (BinnedStatistic or None) – a BinnedStatistic object to hold the multipole results \(\xi_\ell(r)\); if no multipoles were requested by the user, this is None. It stores the following variables:

    • r :

      the mean value for each r bin

    • power_L :

      complex array storing the real and imaginary components for the \(\ell=L\) multipole

    • modes :

      the number of modes averaged together in each bin

  • corr.attrs, poles.attrs (dict) – dictionary of meta-data; in addition to storing the input parameters, it includes the following fields computed during the algorithm execution:

    • shotnoisefloat

      the power Poisson shot noise, equal to \(V/N\), where \(V\) is the volume of the box and N is the total number of objects; if a cross-correlation is computed, this will be equal to zero

    • N1int

      the total number of objects in the first source

    • N2int

      the total number of objects in the second source

save(output)

Save the result to disk. The format is currently JSON.