# nbodykit.cosmology.power.zeldovich¶

Functions

 isiterable(obj) Returns True if the given object is iterable. vectorize_if_needed(func, *x) Helper function to vectorize functions on array inputs

Classes

 An integral over $$j_0$$ needed to compute the Zeldovich power. An integral over $$j_1$$ needed to compute the Zeldovich power. ZeldovichPower(cosmo, redshift[, transfer, nmax]) The matter power spectrum in the Zel’dovich approximation. The integral needed to evaluate the density auto spectrum in the Zel’dovich approximation.
class nbodykit.cosmology.power.zeldovich.ZeldovichJ0(k)[source]

An integral over $$j_0$$ needed to compute the Zeldovich power. The integral is given by:

$I_0(r) = \int \frac{dk}{2\pi^2} P_L(k) j_0(kr).$
Attributes
postfac
prefac

Methods

 __call__(F[, axis, extrap, keeppads, convonly]) Evaluate the integral. Rough sanity checks on the input function. Invert the transform. matrix([full, keeppads]) Return matrix form of the integral transform.
__call__(F, axis=- 1, extrap=False, keeppads=False, convonly=False)

Evaluate the integral.

Parameters
• F ((..., Nin, ...) or (..., N, ...) array_like) – input function; to be padded according to extrap in size from Nin to N, but not if already of size N

• axis (int, optional) – axis along which to integrate

• extrap ({bool, 'const'} or 2-tuple, optional) – Method to extrapolate F. For a 2-tuple, the two elements are for the left and right pads, whereas a single value applies to both ends. Options are: * True: power-law extrapolation using the end segment * False: zero padding * ‘const’: constant padding with the end point value

• keeppads (bool, optional) – whether to keep the padding in the output

• convonly (bool, optional) – whether to skip the scaling by _xfac_ and _yfac_, useful for evaluating integral with multiple kernels

Returns

• y ((Nin,) or (N,) ndarray) – log-spaced output argument

• G ((…, Nin, …) or (…, N, …) ndarray) – output function

check(F)

Rough sanity checks on the input function.

inv()

Invert the transform.

After calling this method, calling the instance will do the inverse transform. Calling this twice return the instance to the original transform.

Return matrix form of the integral transform.

Parameters
• full (bool, optional) – when False return two vector factors and convolution matrix separately, otherwise return full transformation matrix

• keeppads (bool, optional) – whether to keep the padding in the output

Returns

• If full is False, output separately

• a ((1, N) or (1, Nin) ndarray) – “After” factor, _yfac_ or yfac

• b ((N,) or (Nin,) ndarray) – “Before” factor, _xfac_ or xfac

• C ((N, N) or (Nin, Nin) ndarray) – Convolution matrix, circulant

• Otherwise, output the full matrix, combining a, b, and C

• M ((N, N) or (Nin, Nin) ndarray) – Full transformation matrix, M = a * C * b

Notes

M, a, b, and C are padded by default.

This is not meant for evaluation with matrix multiplication but in case one is interested in the tranformation itself.

When N is even and lowring is False, $$C C^{-1}$$ and $$M M^{-1}$$ can deviate from the identity matrix because the imaginary part of the Nyquist modes are dropped.

The convolution matrix is a circulant matrix, with its first row and first column being the Fourier transform of $$u_m$$. Indeed $$u_m$$ are the eigenvalues of the convolution matrix, that are diagonalized by the DFT matrix. Thus $$1/u_m$$ are the eigenvalues of the inverse convolution matrix.

class nbodykit.cosmology.power.zeldovich.ZeldovichJ1(k)[source]

An integral over $$j_1$$ needed to compute the Zeldovich power. The integral is given by:

$I_1(r) = \int \frac{dk}{2\pi^2} P_L(k) \frac{j_1(kr)}{kr}.$
Attributes
postfac
prefac

Methods

 __call__(F[, axis, extrap, keeppads, convonly]) Evaluate the integral. Rough sanity checks on the input function. Invert the transform. matrix([full, keeppads]) Return matrix form of the integral transform.
__call__(F, axis=- 1, extrap=False, keeppads=False, convonly=False)

Evaluate the integral.

Parameters
• F ((..., Nin, ...) or (..., N, ...) array_like) – input function; to be padded according to extrap in size from Nin to N, but not if already of size N

• axis (int, optional) – axis along which to integrate

• extrap ({bool, 'const'} or 2-tuple, optional) – Method to extrapolate F. For a 2-tuple, the two elements are for the left and right pads, whereas a single value applies to both ends. Options are: * True: power-law extrapolation using the end segment * False: zero padding * ‘const’: constant padding with the end point value

• keeppads (bool, optional) – whether to keep the padding in the output

• convonly (bool, optional) – whether to skip the scaling by _xfac_ and _yfac_, useful for evaluating integral with multiple kernels

Returns

• y ((Nin,) or (N,) ndarray) – log-spaced output argument

• G ((…, Nin, …) or (…, N, …) ndarray) – output function

check(F)

Rough sanity checks on the input function.

inv()

Invert the transform.

After calling this method, calling the instance will do the inverse transform. Calling this twice return the instance to the original transform.

Return matrix form of the integral transform.

Parameters
• full (bool, optional) – when False return two vector factors and convolution matrix separately, otherwise return full transformation matrix

• keeppads (bool, optional) – whether to keep the padding in the output

Returns

• If full is False, output separately

• a ((1, N) or (1, Nin) ndarray) – “After” factor, _yfac_ or yfac

• b ((N,) or (Nin,) ndarray) – “Before” factor, _xfac_ or xfac

• C ((N, N) or (Nin, Nin) ndarray) – Convolution matrix, circulant

• Otherwise, output the full matrix, combining a, b, and C

• M ((N, N) or (Nin, Nin) ndarray) – Full transformation matrix, M = a * C * b

Notes

M, a, b, and C are padded by default.

This is not meant for evaluation with matrix multiplication but in case one is interested in the tranformation itself.

When N is even and lowring is False, $$C C^{-1}$$ and $$M M^{-1}$$ can deviate from the identity matrix because the imaginary part of the Nyquist modes are dropped.

The convolution matrix is a circulant matrix, with its first row and first column being the Fourier transform of $$u_m$$. Indeed $$u_m$$ are the eigenvalues of the convolution matrix, that are diagonalized by the DFT matrix. Thus $$1/u_m$$ are the eigenvalues of the inverse convolution matrix.

class nbodykit.cosmology.power.zeldovich.ZeldovichPower(cosmo, redshift, transfer='CLASS', nmax=32)[source]

The matter power spectrum in the Zel’dovich approximation.

Parameters
• cosmo (Cosmology) – the cosmology instance

• z (float) – the redshift of the power spectrum

• transfer (str, optional) – string specifying the transfer function to use for the linear power spectrum; one of ‘CLASS’, ‘EisensteinHu’, ‘NoWiggleEisensteinHu’

cosmo

the object giving the cosmological parameters

Type

class:Cosmology, astropy.cosmology.FLRW

sigma8

the z=0 amplitude of matter fluctuations

Type

float

redshift

the redshift to compute the power at

Type

float

Plin

the linear power spectrum class used to compute the Zel’dovich power

Type

class:LinearPower

nmax

max order of integrals.

Type

int

Attributes
attrs

The meta-data dictionary

redshift

The redshift of the power spectrum

sigma8

The amplitude of matter fluctuations at $$z=0$$.

Methods

 Return the Zel’dovich power in $$h^{-3} \mathrm{Mpc}^3 at :attr:$$ and k, where k is in units of $$h \mathrm{Mpc}^{-1}$$.
__call__(k)[source]

Return the Zel’dovich power in $$h^{-3} \mathrm{Mpc}^3 at :attr:$$ and k, where k is in units of $$h \mathrm{Mpc}^{-1}$$.

Parameters

k (float, array_like) – the wavenumbers to evaluate the power at

property attrs

The meta-data dictionary

property redshift

The redshift of the power spectrum

property sigma8

The amplitude of matter fluctuations at $$z=0$$.

class nbodykit.cosmology.power.zeldovich.ZeldovichPowerIntegral(r, n)[source]

The integral needed to evaluate the density auto spectrum in the Zel’dovich approximation.

This evaluates:

$I(k, n) = 4\pi \int dr r^2 \mathrm{exp}\left[-0.5k^2(X(r) + Y(r)) \right] \left (\frac{k Y(r)}{r} \right)^n j_n(kr).$
Attributes
postfac
prefac

Methods

 __call__(F[, axis, extrap, keeppads, convonly]) Evaluate the integral. Rough sanity checks on the input function. Invert the transform. matrix([full, keeppads]) Return matrix form of the integral transform.
__call__(F, axis=- 1, extrap=False, keeppads=False, convonly=False)

Evaluate the integral.

Parameters
• F ((..., Nin, ...) or (..., N, ...) array_like) – input function; to be padded according to extrap in size from Nin to N, but not if already of size N

• axis (int, optional) – axis along which to integrate

• extrap ({bool, 'const'} or 2-tuple, optional) – Method to extrapolate F. For a 2-tuple, the two elements are for the left and right pads, whereas a single value applies to both ends. Options are: * True: power-law extrapolation using the end segment * False: zero padding * ‘const’: constant padding with the end point value

• keeppads (bool, optional) – whether to keep the padding in the output

• convonly (bool, optional) – whether to skip the scaling by _xfac_ and _yfac_, useful for evaluating integral with multiple kernels

Returns

• y ((Nin,) or (N,) ndarray) – log-spaced output argument

• G ((…, Nin, …) or (…, N, …) ndarray) – output function

check(F)

Rough sanity checks on the input function.

inv()

Invert the transform.

After calling this method, calling the instance will do the inverse transform. Calling this twice return the instance to the original transform.

Return matrix form of the integral transform.

Parameters
• full (bool, optional) – when False return two vector factors and convolution matrix separately, otherwise return full transformation matrix

• keeppads (bool, optional) – whether to keep the padding in the output

Returns

• If full is False, output separately

• a ((1, N) or (1, Nin) ndarray) – “After” factor, _yfac_ or yfac

• b ((N,) or (Nin,) ndarray) – “Before” factor, _xfac_ or xfac

• C ((N, N) or (Nin, Nin) ndarray) – Convolution matrix, circulant

• Otherwise, output the full matrix, combining a, b, and C

• M ((N, N) or (Nin, Nin) ndarray) – Full transformation matrix, M = a * C * b

Notes

M, a, b, and C are padded by default.

This is not meant for evaluation with matrix multiplication but in case one is interested in the tranformation itself.

When N is even and lowring is False, $$C C^{-1}$$ and $$M M^{-1}$$ can deviate from the identity matrix because the imaginary part of the Nyquist modes are dropped.

The convolution matrix is a circulant matrix, with its first row and first column being the Fourier transform of $$u_m$$. Indeed $$u_m$$ are the eigenvalues of the convolution matrix, that are diagonalized by the DFT matrix. Thus $$1/u_m$$ are the eigenvalues of the inverse convolution matrix.

nbodykit.cosmology.power.zeldovich.isiterable(obj)[source]

Returns True if the given object is iterable.

nbodykit.cosmology.power.zeldovich.vectorize_if_needed(func, *x)[source]

Helper function to vectorize functions on array inputs