pyccl.tk3d module

class pyccl.tk3d.Tk3D(self, *, a_arr, lk_arr, tkk_arr=None, pk1_arr=None, pk2_arr=None, is_logt=True, extrap_order_lok=1, extrap_order_hik=1)[source]

Bases: CCLObject

A container for “isotropized” connected trispectra, relevant for covariance matrix calculations. These are functions of 3 variables of the form \(T(k_1,k_2,a)\), where \(k_i\) are wavenumbers, and \(a\) is the scale factor. This function can be provided as a 3D array (one dimension per variable), or as two 2D arrays corresponding to functions \(f_i(k,a)\) such that

\[T(k_1,k_2,a) = f_1(k_1,a)\,f_2(k_2,a)\]

Typical uses for these objects will be:

  • To store perturbation theory or halo model “isotropized” connected trispectra of the form:

    \[\bar{T}_{abcd}(k_1, k_2, a) = \int \frac{d\varphi_1}{2\pi} \int \frac{d\varphi_2}{2\pi} T_{abcd}({\bf k_1},-{\bf k_1},{\bf k_2},-{\bf k_2}),\]

    where \({\bf k}_i\equiv k_i(\cos\varphi_i,\sin\varphi_i,0)\), and \(T_{abcd}({\bf k}_a,{\bf k}_b,{\bf k}_c,{\bf k}_d)\) is the connected trispectrum of fields \(\{a,b,c,d\}\).

  • To store the kernel for super-sample covariance calculations as a product of the responses of power spectra to long-wavelength overdensity modes \(\delta_L\):

\[\bar{T}_{abcd}(k_1,k_2,a)= \frac{\partial P_{ab}(k_1,a)}{\partial\delta_L}\, \frac{\partial P_{cd}(k_2,a)}{\partial\delta_L}.\]

These objects can then be used, analogously to Pk2D objects, to construct the non-Gaussian covariance of angular power spectra via Limber integration. See covariances.

Parameters:
  • a_arr (array) – an array holding values of the scale factor. Note that the trispectrum will be extrapolated as constant on values of the scale factor outside those held by this array.

  • lk_arr (array) – an array holding values of the natural logarithm of the wavenumber (in units of \({\rm Mpc}^{-1}\)).

  • tkk_arr (array) – a 3D array with shape [na,nk,nk], where na and nk are the sizes of a_arr and lk_arr respectively. This array should contain the values of the trispectrum at the values of scale factor and wavenumber held by a_arr and lk_arr. The array can hold the values of the natural logarithm of the trispectrum, depending on the value of is_logt. If tkk_arr is None, then it is assumed that the trispectrum can be factorized as described above, and the two functions \(f_i(k_i,a)\) are described by pk1_arr and pk2_arr. You are responsible for making sure all these arrays are sufficiently well sampled (i.e. the resolution of a_arr and lk_arr is high enough to sample the main features in the trispectrum). For reference, CCL will use bicubic interpolation to evaluate the trispectrum in the 2D space of wavenumbers \((k_1,k_2)\) at a fixed scale factor, and will use linear interpolation in the scale factor dimension.

  • pk1_arr (array) – a 2D array with shape [na,nk] describing the first function \(f_1(k,a)\) that makes up a factorizable trispectrum \(T(k_1,k_2,a)=f_1(k_1,a)f_2(k_2,a)\). pk1_arr and pk2_arr are ignored if tkk_arr is not None.

  • pk2_arr (array) – a 2D array with shape [na,nk] describing the second factor \(f_2(k,a)\) for a factorizable trispectrum.

  • is_logt (bool) – if True, tkk_arr/pk1_arr/pk2_arr hold the natural logarithm of the trispectrum (or its factors). Otherwise, the true values of the corresponding quantities are expected. Note that arrays will be interpolated in log space if is_logt is set to True.

  • extrap_order_lok (int) – extrapolation order to be used on k-values below the minimum of the splines (use 0 or 1). Note that the extrapolation will be done in either \(\log(T(k_1,k_2,a))\) or \(T(k_1,k_2,a)\), depending on the value of is_logt.

  • extrap_order_hik (int) – same as extrap_order_lok for k-values above the maximum of the splines.

__call__(k, a)[source]

Evaluate trispectrum. If k is a 1D array with size nk, and a is a scalar, the output out will be a 2D array with shape [nk,nk] holding out[i,j] = T(k[j],k[i],a), where T is the trispectrum function held by this Tk3D object. If a is an array, the shape will be [len(a),nk,nk].

Parameters:
  • k (float or array) – wavenumber value(s) in units of \({\rm Mpc}^{-1}\).

  • a (float or array) – value(s) of the scale factor

Returns:

value(s) of the trispectrum.

Return type:

(float or array)

property has_tsp
property extrap_order_lok
property extrap_order_hik
get_spline_arrays()[source]

Get the spline data arrays.

Returns:

Tuple containing

  • a_arr (1D numpy.ndarray): Array of scale factors.

  • lk_arr1, lk_arr2 (1D numpy.ndarray): Arrays of \(log(k)\).

  • out (list of numpy.ndarray): The trispectrum \(T(k_1, k_2, z)\) or its factors \(f(k_1, z),\,\,f(k_2, z)\).