Find the values in input_ids within match_ids and mask the weight
    array's.

    Parameters
    ----------
    input_ids : `numpy.ndarray`
        Sorted integer array of ids to find in ``match_ids``
    match_ids : `numpy.ndarray`
        Stored integer array of ids.
    input_weights : `numpy.ndarray`
        Weights of each of the input ids.
    match_weights : `numpy.ndarray`
        Weights of each of the match ids.

    Returns
    -------
    matched_pairs : `tuple`, (`numpy.ndarray`, `numpy.ndarray`)
        Views into ``input_weights`` and ``matched_weights`` where id values in
        ``input_ids`` and ``match_ids`` are present.


Run pair maker and create output

        Returns
        -------
        pm_output : `pandas.DataFrame`
            Return the output of PairMaker.


Read the file containing growth factor benchmarks for the low redshifts.


Read the file containing growth factor benchmarks for the high redshifts.


    Read the file containing growth factor benchmarks for
    the whole redshift range.


    Compare growth factor calculated by pyccl with the values in the benchmark
    file. This test only works if radiation is explicitly set to 0.


Calculate N_eff from the number of relativistic
    and massive neutrinos.


    Read the file containing all the radial comoving distance benchmarks
    (distances are in Mpc/h)


    Read the file containing all the radial comoving distance benchmarks
    with non-zero massive neutrinos
    (distances are in Mpc)


    Read the file containing the radial comoving distance benchmarks from
    CLASS for the CCL paper models. (distances are in Mpc)


    Read the file containing the radial comoving distance benchmarks from
    CLASS additional massive neutrino models. (distances are in Mpc)


Read the file containing all the distance modulus benchmarks


    Read the file containing all the distance modulus benchmarks
    for non-zero massive neutrinos.


    Read the file containing all the distance modulus benchmarks
    for non-zero massive neutrinos at high z.


    Read the file containing the distance modulus benchmarks from
    CLASS for the CCL paper models.


    Read the file containing the distance modulus benchmarks from
    CLASS for additional massive neutrino models.


    Compare distances calculated by pyccl with the distances in the benchmark
    file.
    This test is only valid when radiation is explicitly set to 0.


    Compare distances calculated by pyccl with the distances in the benchmark
    file.


    Compare distances calculated by pyccl with the distances in the CLASS
    benchmark file.


    Compare distances calculated by pyccl with the distances in the benchmark
    file, for a ccl cosmology with mu / Sigma parameterisation of gravity.
    Nonzero mu / Sigma should NOT affect distances so we compare to the same
    benchmarks as the mu = Sigma = 0 case deliberately.


    Build a data dictionary with columns named according to (k,z) bins, a
    threshold value, and some prefix.

    Assumes that stats_arr has shape: (N_samp, N_thres, N_z, N_kbins)


    Save a Latin hypercube to disk as a text file. Parameter columns will be
    ordered alphabetically by name.

    Parameters
    ----------
    fname : str
        Filename for output file.
    sample_points : dict
        Dictionary containing parameter names (keys) and array of parameter
        values for all sample points (values).


    Load a Latin hypercube from disk. Parameter columns will be ordered
    alphabetically by name.

    Parameters
    ----------
    fname : str
        Filename to read sample points from.

    Returns
    -------
    sample_points : dict
        Dictionary containing parameter names (keys) and array of parameter
        values for all sample points (values).


    Generate a Latin hypercube for a given set of parameters.

    Parameters
    ----------
    samples : int
        Number of samples points to draw from the hypercube.

    param_dict : dict
        Dictionary containing parameter names (keys) and tuple with min/max.
        values (values).

    class_root : str
        Path to directory containing 'class' executable.

    seed : int, optional
        Random seed to use when sampling from hypercube.

    Returns
    -------
    sample_points : dict
        Dictionary containing parameter names (keys) and array of parameter
        values for all sample points (values).


    Generate linear and non-linear power spectra using CCL, for a set of
    points in cosmological parameter space and redshift.

    Parameters
    ----------
    sample_points : dict
        Dictionary containing parameter names (keys) and array of parameter
        values for all sample points (values).

    root : str
        Path of directory in which output files should be stored.

    class_data_root : str
        Root of filenames in which CLASS power spectra were stored.

    zvals : array_like
        Array of redshifts at which the power spectra should be evaluated.

    default_params : dict, optional
        Dictionary of default cosmological parameters, to be used if a
        necessary parameter is not included in sample_points.

    nonlin : bool, optional
        Whether to load non-linear P(k). Default: False.

    mode : str, optional
        Which mode the CLASS run was performed in. Default: 'std'.


    Generate CLASS .ini files for a set of parameters.

    Parameters
    ----------
    sample_points : dict
        Dictionary containing parameter names (keys) and array of parameter
        values for all sample points (values).

    root : str
        Path of directory in which .ini files should be stored.

    nonlinear : bool, optional
        Whether CLASS should return the linear or nonlinear (halofit) power
        spectrum. Default: False.

    mnu : bool, optional
        Whether to include massive neutrinos.

    redshifts : array_like, optional
        Array of redshift values at which P(k) should be calculated. Default:
        Five bins from 0.0 to 2.5 in increments of 0.5.


    Run CLASS on a set of .ini files.

    Parameters
    ----------
    fname_pattern : str
        Pattern (glob format) for matching the .ini files to be run by CLASS.

    class_root : str
        Directory in which the 'class' executable is stored.

    precision : bool, optional
        Whether to run CLASS in high-precision mode (using the pk_ref.pre
        precision file).


    Calculate summary stats for the deviation between CCL and reference power
    spectra as a function of scale and redshift, for a large number of sample
    points over the cosmological parameter space.

    Parameters
    ----------
    sample_points : dict
        Dictionary containing parameter names (keys) and array of parameter
        values for all sample points (values).

    ccl_data_root : str
        Root of filenames of CCL power spectrum files

    class_data_root : str
        Root of filenames of CLASS power spectrum files. If the string '_nl_'
        is found in class_data_root, this will assume that nonlinear power
        spectra should be loaded.


    Calculate summary stats for the deviation between CCL and reference power
    spectra as a function of scale and redshift, for a large number of sample
    points over the cosmological parameter space.


 Returns the 'normalisation factor' that goes into the IA halo model
    power spectrum: satelite fraction * Nsat / tot_ns as a function of Mhalo.
    Mhalo is the vector of halo masses over which to integrate in units of Msol
    cosmo is a pyccl cosmology object
    conc is a concentration relation object
    z is the redshift at which to calculate this


    Computes BBKS power spectrum at input z, k and cosmological parameters.
    Saves results at "<prefix>_pk_bbks.txt"


 Generates a `Pk2D` object from a function that calculates a power
        spectrum.

        Args:
            pkfunc (:obj:`callable`):
                Function with signature ``f(k, a)`` which takes vectorized
                input in ``k`` (wavenumber in :math:`\\mathrm{Mpc}^{-1}`)
                and a scale factor`a``, and returns the value of the
                corresponding quantity. ``pkfunc`` will be sampled at the
                values of ``k`` and ``a`` used internally by CCL to store the
                linear and non-linear power spectra.
            spline_params (:obj:`~pyccl._core.parameters.parameters_base.SplineParameters`):
                optional spline parameters. Used to determine sampling rates
                in scale factor and wavenumber. Custom parameters can be passed
                via the :class:`~pyccl.cosmology.Cosmology` object with
                ``cosmo.cosmo.spline_params`` (C API), or with an instance of
                ``ccl.parameters.SplineParameters`` (Python API). If ``None``, it
                defaults to the global accuracy parameters in CCL at the moment
                this function is called.

        Returns:
            :class:`~pyccl.pk2d.Pk2D`. Power spectrum object.


:class:`Pk2D` constructor returning the power spectrum
        associated with a given numerical model.

        Arguments:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): A Cosmology object.
            model (:obj:`str`): Model to use. These models allowed:

                  - ``'bbks'`` (`Bardeen et al. 1986 <https://ui.adsabs.harvard.edu/abs/1986ApJ...304...15B/abstract>`_).
                  - ``'eisenstein_hu'`` (`Eisenstein & Hu 1997 <https://arxiv.org/abs/astro-ph/9709112>`_).
                  - ``'eisenstein_hu_nowiggles'`` (`Eisenstein & Hu 1997 <https://arxiv.org/abs/astro-ph/9709112>`_, no-wiggles version).

        Returns:
            :class:`~pyccl.pk2d.Pk2D`. The power spectrum of the input model.


Apply the "HALOFIT" transformation of
        `Takahashi et al. 2012 <https://arxiv.org/abs/1208.2701>`_ on the linear
        power spectrum represented by this :class:`Pk2D` object, and return the
        result as a :class:`Pk2D` object.

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.

        Return:
            :class:`Pk2D` object containing the non-linear power spectrum after
            applying HALOFIT.


Return a copy of this Pk2D object.


 Return the C-level `f2d` spline associated with a
    :class:`Pk2D` object.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): A Cosmology object.
        p_of_k_a (:class:`Pk2D` or :obj:`str`): if a
            :class:`Pk2D` object, its `f2d` spline will be used. If
            a string, the linear or non-linear power spectrum stored
            by ``cosmo`` under this name will be used. Defaults to the
            matter power spectrum stored in `cosmo`.
        is_linear (:obj:`bool`): if ``True``, and if ``p_of_k_a`` is a
            string or ``None``, the linear version of the corresponding
            power spectrum will be used (otherwise it'll be the
            non-linear version).


Helper to retrieve the right :class:`Pk2D` object.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
        p_of_k_a (:class:`~pyccl.pk2d.Pk2D`, :obj:`str` or :obj:`None`):
            3D Power spectrum to return. If a `Pk2D`, it is just returned.
            If `None` or `"linear"`, the linear power spectrum stored in
            ``cosmo`` is returned. If `"nonlinear"`, the nonlinear matter
            power spectrum stored in ``cosmo`` is returned.

    Returns:
        :class:`Pk2D` object corresponding to ``p_of_k_a``.


Calculate the angular (cross-)power spectrum for a pair of tracers.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): A Cosmology object.
        tracer1 (:class:`~pyccl.tracers.Tracer`): a Tracer object,
            of any kind.
        tracer2 (:class:`~pyccl.tracers.Tracer`): a second Tracer object.
        ell (:obj:`float` or `array`): Angular multipole(s) at which to evaluate
            the angular power spectrum.
        p_of_k_a (:class:`~pyccl.pk2d.Pk2D`, :obj:`str` or :obj:`None`): 3D Power
            spectrum to project. If a string, it must correspond to one of
            the non-linear power spectra stored in `cosmo` (e.g.
            `'delta_matter:delta_matter'`).
        l_limber (int, float or 'auto') : Angular wavenumber beyond which
            Limber's approximation will be used. Defaults to -1. If 'auto',
            then the non-limber integrator will be used to compute the right
            transition point given the value of limber_max_error.
        limber_max_error (float) : Maximum fractional error for Limber integration.
        limber_integration_method (string) : integration method to be used
            for the Limber integrals. Possibilities: 'qag_quad' (GSL's `qag`
            method backed up by `quad` when it fails) and 'spline' (the
            integrand is splined and then integrated numerically).
        non_limber_integration_method (string) : integration method to be used
            for the non-Limber integrals. Currently the only method implemented
            is ``'FKEM'`` (see the `N5K paper <https://arxiv.org/abs/2212.04291>`_
            for details).
        fkem_chi_min: Minimum comoving distance used by `FKEM` to sample the
            tracer radial kernels. If ``None``, the minimum distance over which
            the kernels are defined will be used (capped to 1E-6 Mpc if this
            value is zero). Users are encouraged to experiment with this parameter
            and ``fkem_Nchi`` to ensure the robustness of the output
            :math:`C_\\ell` s.
        fkem_Nchi: Number of values of the comoving distance over which `FKEM`
            will interpolate the radial kernels. If ``None`` the smallest number
            over which the kernels are currently sampled will be used. Note that
            `FKEM` will use a logarithmic sampling for distances between
            ``fkem_chi_min`` and the maximum distance over which the tracers
            are defined.  Users are encouraged to experiment with this parameter
            and ``fkem_chi_min`` to ensure the robustness of the output
            :math:`C_\\ell` s.
        p_of_k_a_lin (:class:`~pyccl.pk2d.Pk2D`, :obj:`str` or :obj:`None`):
            3D linear Power spectrum to project, for special use in
            PT calculations using the FKEM non-limber integration technique.
            If a string, it must correspond to one of
            the linear power spectra stored in `cosmo` (e.g.
            `'delta_matter:delta_matter'`).
        return_meta (bool): if `True`, also return a dictionary with various
            metadata about the calculation, such as l_limber as calculated by the
            non-limber integrator.

    Returns:
        :obj:`float` or `array`: Angular (cross-)power spectrum values, \
            :math:`C_\\ell`, for the pair of tracers, as a function of \
            :math:`\\ell`.


Redshift-dependent modification to Poisson equation for massless
    particles under modified gravity.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
        a (:obj:`float` or `array`): Scale factor(s), normalized to 1 today.
        k (:obj:`float` or `array`): Wavenumber for scale

    Returns:
        (:obj:`float` or `array`): Modification to Poisson equation under
            modified gravity at scale factor a.
            Sig_MG is assumed to be proportional to Omega_Lambda(z),
            see e.g. Abbott et al. 2018, 1810.02499, Eq. 9.


Check that a redshift array lies within the support of the
    CCL background splines.


Returns the minimum comoving distance over which this tracer's
        radial kernel is defined, if it exists. For tracers with more than
        one contribution with an associated ``chi_min``, the
        lowest value is returned.


Returns the maximum comoving distance over which this tracer's
        radial kernel is defined, if it exists. For tracers with more than
        one contribution with an associated ``chi_max``, the
        highest value is returned.


Get list fft integral over chi for FKEM non-limber calculation
        contained in this ``Tracer``.

        Returns:
            `tuple`: k values and fft integral values at each k


Set list fft integral over chi for FKEM non-limber calculation
        contained in this ``Tracer``.

        Returns:
            `tuple`: k values and fft integral values at each k


 function to set mg_transfer in the right format and add MG tracers
            for different cases including different cases and biases like
            intrinsic alignements (IA) when present


 This function allows to obtain the function Sigma(z,k) (1 or 2D
            arrays) for an array of redshifts coming from a redshift
            distribution (defined by the user) and a single value or
            an array of k specified by the user. We obtain then Sigma(z,k) as a
            1D array for those z and k arrays and then convert it to a 2D array
            taking into consideration the given sizes of the arrays for z and k
            The MG parameter array goes then as a multiplicative factor within
            the MG transfer function. If k is not specified then only a 1D
            array for Sigma(a,k=0) is used.

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): cosmology object used
                to transform redshifts into distances.
            z (float or tuple of arrays): a single z value (e.g. for CMB)
                or a tuple of arrays (z, N(z)) giving the redshift distribution
                of the objects. The units are arbitrary; N(z) will be
                normalized to unity.
            k (float or array): a single k value or an array of k for which we
                calculate the MG parameter Sigma(a,k). For now, the k range
                should be limited to linear scales.


Adds one more tracer to the list contained in this ``Tracer``.

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): cosmology object.
            kernel (:obj:`tuple`): A tuple of arrays
                ``(chi, w_chi)`` describing the radial kernel of this
                tracer. ``chi`` should contain values of the comoving
                radial distance in increasing order, and ``w_chi`` should
                contain the values of the kernel at those values of the
                radial distance. The kernel will be assumed to be zero
                outside the range of distances covered by ``chi``. If
                ``kernel`` is ``None`` a constant kernel
                :math:`W(\\chi)=1` will be assumed everywhere.
            transfer_ka (:obj:`tuple`): a tuple of arrays
                ``(a, lk,t_ka)`` describing the most general transfer
                function for a tracer. ``a`` should be an array of scale
                factor values in increasing order. ``lk`` should be an
                array of values of the natural logarithm of the wave
                number (in units of inverse Mpc) in increasing order.
                ``t_ka`` should be an array of shape ``(na, nk)``, where
                ``na`` and ``nk`` are the sizes of ``a`` and ``lk``
                respectively.``t_ka`` should hold the values of the transfer
                function at the corresponding values of ``a`` and ``lk``. If
                your transfer function is factorizable (i.e.
                :math:`T(a,k) = A(a)\\, K(k))`,
                it is more efficient to set this to ``None`` and use
                ``transfer_k`` and ``transfer_a`` to describe :math:`K` and
                :math:`A` respectively. The transfer function will be assumed
                continuous and constant outside the range of scale factors
                covered by ``a``. It will be extrapolated using polynomials
                of order ``extrap_order_lok`` and ``extrap_order_hik`` below
                and above the range of wavenumbers covered by ``lk``
                respectively. If this argument is not ``None``, the values of
                ``transfer_k`` and ``transfer_a`` will be ignored.
            transfer_k (:obj:`tuple`): a tuple of arrays
                ``(lk,t_k)`` describing the scale-dependent part of a
                factorizable transfer function. ``lk`` should be an
                array of values of the natural logarithm of the wave
                number (in units of inverse Mpc) in increasing order.
                ``t_k`` should be an array of the same size holding the
                values of the k-dependent part of the transfer function
                at those wavenumbers. It will be extrapolated using
                polynomials of order ``extrap_order_lok`` and
                ``extrap_order_hik`` below and above the range of wavenumbers
                covered by ``lk`` respectively. If ``None``, the k-dependent
                part of the transfer function will be set to 1 everywhere.
            transfer_a (:obj:`tuple`): a tuple of arrays
                `(a, t_a)`` describing the time-dependent part of a
                factorizable transfer function. ``a`` should be an array of
                scale factor values in increasing order. ``t_a`` should
                contain the time-dependent part of the transfer function
                at those values of the scale factor. The time dependence
                will be assumed continuous and constant outside the range
                covered by ``a``. If ``None``, the time-dependent part of the
                transfer function will be set to 1 everywhere.
            der_bessel (:obj:`int`): order of the derivative of the Bessel
                functions with which this tracer enters the calculation
                of the power spectrum. Allowed values are -1, 0, 1 and 2.
                0, 1 and 2 correspond to the raw functions, their first
                derivatives or their second derivatives. -1 corresponds to
                the raw functions divided by the square of their argument.
                We enable this special value because this type of dependence
                is ubiquitous for many common tracers (lensing, IAs), and
                makes the corresponding transfer functions more stable
                for small :math:`k` or :math:`\\chi`.
            der_angles (:obj:`int`): integer describing the ell-dependent prefactor
                associated with this tracer. Allowed values are 0, 1 and 2.
                0 means no prefactor. 1 means a prefactor
                :math:`\\ell(\\ell+1)`, associated with the angular
                Laplacian and used e.g. for lensing convergence and
                magnification. 2 means a prefactor
                :math:`\\sqrt{(\\ell+2)!/(\\ell-2)!}`, associated with the
                angular derivatives of spin-2 fields (e.g. cosmic shear, IAs).
            is_logt (:obj:`bool`): if ``True``, ``transfer_ka``, ``transfer_k`` and
                ``transfer_a`` will contain the natural logarithm of the
                transfer function (or their factorizable parts).
            extrap_order_lok (:obj:`int`): polynomial order used to extrapolate the
                transfer functions for low wavenumbers not covered by the
                input arrays.
            extrap_order_hik (:obj:`int`): polynomial order used to extrapolate the
                transfer functions for high wavenumbers not covered by the
                input arrays.


Constructor for tracers associated with a radial kernel of the form

        .. math::
            W(\\chi) = \\frac{A}{(1+z)^\\alpha},

        where :math:`A` is an amplitude and :math:`\\alpha` is a power
        law index. The kernel only has support in the redshift range
        ``[z_min, z_max]``.

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmology object.
            A (:obj:`float`): amplitude parameter.
            alpha (:obj:`float`): power law index.
            z_min (:obj:`float`): minimum redshift from to which we define the kernel.
            z_max (:obj:`float`): maximum redshift up to which we define the kernel.
            n_chi (:obj:`float`): number of intervals in the radial comoving
                distance on which we sample the kernel.


Specific `Tracer` associated to galaxy clustering with linear
    scale-independent bias, including redshift-space distortions and
    magnification. The associated contributions are described in
    detail in Section 2.4.1 of the `CCL paper
    <https://arxiv.org/abs/1812.05995>`_.

    .. warning:: When including redshift-space distortions, the
        current implementation assumes linear, scale-independent growth
        Although this should be valid in :math:`\\Lambda` CDM and on the
        large scales (especially when considering a broad :math:`N(z)`),
        this approximation should be borne in mind.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmology object.
        dndz (:obj:`tuple`): A tuple of arrays ``(z, N(z))``
            giving the redshift distribution of the objects. The units are
            arbitrary; ``N(z)`` will be normalized to unity.
        bias (:obj:`tuple`): A tuple of arrays ``(z, b(z))``
            giving the galaxy bias. If ``None``, this tracer won't include
            a term proportional to the matter density contrast.
        mag_bias (:obj:`tuple`): A tuple of arrays ``(z, s(z))``
            giving the magnification bias as a function of redshift. If
            ``None``, the tracer is assumed to not have magnification bias
            terms.
        has_rsd (:obj:`bool`): If ``True``, this tracer will include a
            redshift-space distortion term.
        n_samples (:obj:`int`): number of samples over which the
            magnification lensing kernel is desired. These will be equi-spaced
            in radial distance. The kernel is quite smooth, so usually O(100)
            samples is enough.


Specific `Tracer` associated to galaxy shape distortions including
    lensing shear and intrinsic alignments within the L-NLA model.
    The associated contributions are described in detail in Section 2.4.1
    of the `CCL paper <https://arxiv.org/abs/1812.05995>`_.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmology object.
        dndz (:obj:`tuple`): A tuple of arrays ``(z, N(z))``
            giving the redshift distribution of the objects. The units are
            arbitrary; ``N(z)`` will be normalized to unity.
        has_shear (:obj:`bool`): set to ``False`` if you want to omit the
            lensing shear contribution from this tracer.
        ia_bias (:obj:`tuple`): A tuple of arrays
            ``(z, A_IA(z))`` giving the intrinsic alignment amplitude
            ``A_IA(z)``. If ``None``, the tracer is assumed to not have
            intrinsic alignments.
        use_A_ia (:obj:`bool`): set to ``True`` to use the conventional IA
            normalization. Set to ``False`` to use the raw input amplitude,
            which will usually be 1 for use with perturbation theory IA
            modeling.
        n_samples (:obj:`int`): number of samples over which the lensing
            kernel is desired. These will be equi-spaced in radial distance.
            The kernel is quite smooth, so usually O(100) samples
            is enough.


r"""A Tracer for CMB lensing convergence :math:`\kappa`.
    The associated kernel and transfer function are described
    in Eq. 31 of the `CCL paper <https://arxiv.org/abs/1812.05995>`_.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmology object.
        z_source (:obj:`float`): Redshift of source plane for CMB lensing.
        n_samples (:obj:`int`): number of samples over which the kernel
            is desired. These will be equi-spaced in radial distance.
            The kernel is quite smooth, so usually O(100) samples
            is enough.


Specific :class:`Tracer` associated with the thermal Sunyaev Zel'dovich
    Compton-y parameter. The radial kernel for this tracer is simply given by

    .. math::
       W(\\chi) = \\frac{\\sigma_T}{m_ec^2} \\frac{1}{1+z},

    where :math:`\\sigma_T` is the Thomson scattering cross section and
    :math:`m_e` is the electron mass.

    Any angular power spectra computed with this tracer, should use
    a three-dimensional power spectrum involving the electron pressure
    in physical (non-comoving) units of :math:`eV\\,{\\rm cm}^{-3}`.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmology object.
        z_max (:obj:`float`): maximum redshift up to which we define the
            kernel.
        n_chi (:obj:`float`): number of intervals in the radial comoving
            distance on which we sample the kernel.


Specific :class:`Tracer` associated with the cosmic infrared
    background (CIB). The radial kernel for this tracer is simply

    .. math::
       W(\\chi) = \\frac{1}{1+z}.

    Any angular power spectra computed with this tracer, should use
    a three-dimensional power spectrum involving the CIB emissivity
    density in units of
    :math:`{\\rm Jy}\\,{\\rm Mpc}^{-1}\\,{\\rm srad}^{-1}` (or
    multiples thereof -- see e.g.
    :class:`~pyccl.halos.profiles.cib_shang12.HaloProfileCIBShang12`).

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmology object.
        z_min (:obj:`float`): minimum redshift down to which we define the
            kernel.
        z_max (:obj:`float`): maximum redshift up to which we define the
            kernel.
        n_chi (:obj:`float`): number of intervals in the radial comoving
            distance on which we sample the kernel.


Specific :class:`Tracer` associated with the integrated Sachs-Wolfe
    effect (ISW). Useful when cross-correlating any low-redshift probe with
    the primary CMB anisotropies. The ISW contribution to the temperature
    fluctuations is:

    .. math::
        \\Delta T_{\\rm CMB} =
        2T_{\\rm CMB} \\int_0^{\\chi_{LSS}}d\\chi a\\,\\dot{\\phi}

    Any angular power spectra computed with this tracer, should use
    a three-dimensional power spectrum involving the matter power spectrum.

    .. warning:: The current implementation of this tracer assumes a
        standard Poisson equation relating :math:`\\phi` and
        :math:`\\delta`, and linear, scale-independent structure growth.
        Although this should be valid in :math:`\\Lambda` CDM and on the
        large scales the ISW is sensitive to, these approximations must
        be borne in mind.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmology object.
        z_max (:obj:`float`): maximum redshift up to which we define the
            kernel.
        n_chi (:obj:`float`): number of intervals in the radial comoving
            distance on which we sample the kernel.


Wrapper to catch exceptions when tracers are spawned from C.


Check the status returned by a ccllib function.

    Args:
        status (:obj:`int` or :obj:`~pyccl.core.error_types`):
            Flag or error describing the success of a function.
        cosmo (:class:`~pyccl.cosmology.Cosmology`):
            A Cosmology object.

    :meta private:


Toggle debug mode on or off. If debug mode is on, the C backend is
    forced to print error messages as soon as they are raised, even if the
    flow of the program continues. This makes it easier to track down errors.

    If debug mode is off, the C code will not print errors, and the Python
    wrapper will raise the last error that was detected. If multiple errors
    were raised, all but the last will be overwritten within the C code, so the
    user will not necessarily be informed of the root cause of the error.

    Args:
        debug (:obj:`bool`): Switch debug mode on (True) or off (False).


Generic wrapper to allow vectorized (1D array) access to CCL
    functions with one vector argument, with a cosmology dependence.

    Args:
        fn (callable): Function with a single argument.
        fn_vec (callable): Function that has a vectorized implementation in
                           a .i file.
        cosmo (ccl_cosmology or Cosmology): The input cosmology which gets
                                            converted to a ccl_cosmology.
        x (:obj:`float` or `array`): Argument to fn.
        returns_stats (bool): Indicates whether fn returns a status.


Generic wrapper to allow vectorized (1D array) access to CCL
    functions with one vector argument and one integer argument,
    with a cosmology dependence.

    Args:
        fn (callable): Function with a single argument.
        fn_vec (callable): Function that has a vectorized implementation in
                           a .i file.
        cosmo (ccl_cosmology or Cosmology): The input cosmology which gets
                                            converted to a ccl_cosmology.
        x (:obj:`float` or `array`): Argument to fn.
        n (:obj:`int`): Integer argument to fn.
        returns_stats (bool): Indicates whether fn returns a status.


Generic wrapper to allow vectorized (1D array) access to CCL
    functions with one vector argument and two float arguments, with
    a cosmology dependence.

    Args:
        fn (callable): Function with a single argument.
        fn_vec (callable): Function that has a vectorized implementation in
                           a .i file.
        cosmo (ccl_cosmology or Cosmology): The input cosmology which gets
                                            converted to a ccl_cosmology.
        x (:obj:`float` or `array`): Argument to fn.
        a (float): Float argument to fn.
        d (float): Float argument to fn.
        returns_stats (bool): Indicates whether fn returns a status.


Generic wrapper to allow vectorized (1D array) access to CCL
    functions with two vector arguments of the same length,
    with a cosmology dependence.

    Args:
        fn (callable): Function with a single argument.
        fn_vec (callable): Function that has a vectorized implementation in
                           a .i file.
        cosmo (ccl_cosmology or Cosmology): The input cosmology which gets
                                            converted to a ccl_cosmology.
        x1 (:obj:`float` or `array`): Argument to fn.
        x2 (:obj:`float` or `array`): Argument to fn.
        returns_stats (bool): Indicates whether fn returns a status.


Generic wrapper to allow vectorized (1D array) access to CCL
    functions with two vector arguments of the any length,
    with a cosmology dependence.

    Args:
        fn (callable): Function with a single argument.
        fn_vec (callable): Function that has a vectorized implementation in
                           a .i file.
        cosmo (ccl_cosmology or Cosmology): The input cosmology which gets
                                            converted to a ccl_cosmology.
        x1 (:obj:`float` or `array`): Argument to fn.
        x2 (:obj:`float` or `array`): Argument to fn.
        returns_stats (bool): Indicates whether fn returns a status.


Create an array spaced first logarithmically, then linearly.

    .. note::

        The number of logarithmically spaced points used is ``num_log - 1``
        because the first point of the linearly spaced points is the same as
        the end point of the logarithmically spaced points.

    .. code-block:: text

        |=== num_log ==|   |============== num_lin ================|
      --*-*--*---*-----*---*---*---*---*---*---*---*---*---*---*---*--> (axis)
        ^                  ^                                       ^
     logstart             xmin                                    xmax


 Interpolates an input y array onto a set of x values.

    Args:
        x_in (`array`): input x-values.
        y_in (`array`): input y-values.
        x_out (`array`): x-values for output array.
        extrap_lo (:obj:`str`): type of extrapolation for x-values below the
            range of `x_in`. 'none' (for no interpolation), 'constant',
            'linx_liny' (linear in x and y), 'linx_logy', 'logx_liny' and
            'logx_logy'.
        extrap_hi (:obj:`str`): type of extrapolation for x-values above the
            range of `x_in`.
        fill_value_lo (:obj:`float`): constant value if `extrap_lo` is
            'constant'.
        fill_value_hi (:obj:`float`): constant value if `extrap_hi` is
            'constant'.
    Returns:
        `array`: output array.


Check whether an argument `f_arg` passed into the constructor of
    Tracer() is valid.

    If the argument is set to `None`, it will be replaced with a special array
    that signals to the CCL wrapper that this argument is NULL.


Get array data from a 1D GSL spline.

    Args:
        gsl_spline: `SWIGObject` of gsl_spline
            The SWIG object of the GSL spline.

    Returns:
        xarr: `array`
            The x array of the spline.
        yarr: `array`
            The y array of the spline.


Get array data from a 2D GSL spline.

    Args:
        gsl_spline: `SWIGObject` of gsl_spline2d *
            The SWIG object of the 2D GSL spline.

    Returns:
        yarr: `array`
            The y array of the spline.
        xarr: `array`
            The x array of the spline.
        zarr: `array`
            The z array of the spline. The shape is (yarr.size, xarr.size).


Get array data from an array of 2D GSL splines.

    Args:
        gsl_spline (`SWIGObject` of gsl_spline2d **):
            The SWIG object of the 2D GSL spline.
        length (:obj:`int`):
            The length of the 3rd dimension.

    Returns:
        xarr: `array`
            The x array of the spline.
        yarr: `array`
            The y array of the spline.
        zarr: `array`
            The z array of the spline. The shape is (yarr.size, xarr.size).


Return the OpenMP specification release date.
    Return 0 if OpenMP is not working.


Returns the number of processors available to the device.
    Return 0 if OpenMP is not working.


The linear power spectrum.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmological parameters.
        k (:obj:`float` or `array`): Wavenumber; :math:`{\\rm Mpc}^{-1}`.
        a (:obj:`float` or `array`): Scale factor.
        p_of_k_a (:obj:`str`): string specifying the power spectrum to
            compute (which should be stored in ``cosmo``). Defaults to
            the linear matter power spectrum.

    Returns:
        (:obj:`float` or `array`): Linear power spectrum.


The non-linear power spectrum.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmological parameters.
        k (:obj:`float` or `array`): Wavenumber; :math:`{\\rm Mpc}^{-1}`.
        a (:obj:`float` or `array`): Scale factor.
        p_of_k_a (:obj:`str`): string specifying the power spectrum to
            compute (which should be stored in ``cosmo``). Defaults to
            the non-linear matter power spectrum.

    Returns:
        (:obj:`float` or `array`): Non-linear power spectrum.


The linear matter power spectrum

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmological parameters.
        k (:obj:`float` or `array`): Wavenumber; :math:`{\\rm Mpc}^{-1}`.
        a (:obj:`float` or `array`): Scale factor.

    Returns:
        (:obj:`float` or `array`): Linear matter power spectrum;
        :math:`{\\rm Mpc}^3`.


The nonlinear matter power spectrum

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmological parameters.
        k (:obj:`float` or `array`): Wavenumber; :math:`{\\rm Mpc}^{-1}`.
        a (:obj:`float` or `array`): Scale factor.

    Returns:
        (:obj:`float` or `array`): Nonlinear matter power spectrum;
        :math:`{\\rm Mpc}^3`.


RMS on the scale of a halo of mass :math:`M`. Calculated
    as :math:`\\sigma_R` (see :func:`sigmaR`) with :math:`R` being
    the Lagrangian radius of a halo of mass :math:`M` (see
    :func:`~pyccl.halos.massdef.mass2radius_lagrangian`).

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmological parameters.
        M (:obj:`float` or `array`): Halo masses.
        a (:obj:`float`): scale factor.

    Returns:
        (:obj:`float` or `array`): RMS variance of halo mass.


RMS of the matter overdensity a top-hat sphere of radius :math:`R`.

    .. math::
        \\sigma_R^2(z)=\\frac{1}{2\\pi^2}\\int dk\\,k^2\\,P(k,z)\\,
        |W(kR)|^2,

    with :math:`W(x)=3(\\sin(x)-x\\cos(x))/x^3`.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmological parameters.
        R (:obj:`float` or `array`): Radius; Mpc.
        a (:obj:`float`): optional scale factor.
        p_of_k_a (:class:`~pyccl.pk2d.Pk2D`, :obj:`str` or :obj:`None`):
            power spectrum to integrate. If a string, it must correspond to
            one of the linear power spectra stored in ``cosmo`` (e.g.
            ``'delta_matter:delta_matter'``).

    Returns:
        (:obj:`float` or `array`): :math:`\\sigma_R`.


RMS of the linear displacement field in a top-hat sphere of radius R.

    .. math::
        \\sigma_V^2(z)=\\frac{1}{6\\pi^2}\\int dk\\,P(k,z)\\,|W(kR)|^2,

    with :math:`W(x)=3(\\sin(x)-x\\cos(x))/x^3`.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmological parameters.
        R (:obj:`float` or `array`): Radius; Mpc.
        a (:obj:`float`): optional scale factor.
        p_of_k_a (:class:`~pyccl.pk2d.Pk2D`, :obj:`str` or :obj:`None`):
            power spectrum to integrate. If a string, it must correspond to
            one of the linear power spectra stored in ``cosmo`` (e.g.
            ``'delta_matter:delta_matter'``).

    Returns:
        (:obj:`float` or `array`): :math:`\\sigma_V` (:math:`{\\rm Mpc}`).


RMS variance in a top-hat sphere of radius :math:`8\\,{\\rm Mpc}/h`,
    (with the value of :math:`h` extracted from ``cosmo``) at :math:`z=0`.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmological parameters.
        p_of_k_a (:class:`~pyccl.pk2d.Pk2D`, :obj:`str` or :obj:`None`):
            power spectrum  to integrate. If a string, it must correspond to
            one of the linear power spectra stored in ``cosmo`` (e.g.
            ``'delta_matter:delta_matter'``).

    Returns:
        :obj:`float`: :math:`\\sigma_8`.


r"""Non-linear scale :math:`k_{\rm NL}`. Calculated based on Lagrangian
    perturbation theory as the inverse of the rms of the displacement
    field, i.e.:

    .. math::
        k_{\rm NL}(z) = \left[\frac{1}{6\pi^2} \int dk\,P_L(k,z)\right]^{-1/2}.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmological parameters.
        a (:obj:`float` or `array`): Scale factor(s), normalized to 1 today.
        p_of_k_a (:class:`~pyccl.pk2d.Pk2D`, :obj:`str` or :obj:`None`):
            power spectrum  to integrate. If a string, it must correspond to
            one of the linear power spectra stored in ``cosmo`` (e.g.
            ``'delta_matter:delta_matter'``).

    Returns:
        :obj:`float` or `array`: :math:`k_{\rm NL}`.


r"""Compute the angular correlation function.

    .. math::

        \xi^{ab}_\pm(\theta) =
        \sum_\ell\frac{2\ell+1}{4\pi}\,(\pm1)^{s_b}\,
        C^{ab\pm}_\ell\,d^\ell_{s_a,\pm s_b}(\theta)

    where :math:`\theta` is the angle between the two fields :math:`a` and
    :math:`b` with spins :math:`s_a` and :math:`s_b` after alignement of their
    tangential coordinate. :math:`d^\ell_{mm'}` are the Wigner-d matrices and
    we have defined the power spectra

    .. math::
        C^{ab\pm}_\ell \equiv
        (C^{a_Eb_E}_\ell \pm C^{a_Bb_B}_\ell)+i
        (C^{a_Bb_E}_\ell \mp C^{a_Eb_B}_\ell),

    which reduces to the :math:`EE` power spectrum when all :math:`B`-modes
    are 0.

    The different spin combinations are:

        * :math:`s_a=s_b=0` e.g. galaxy-galaxy, galaxy-:math:`\kappa`
          and :math:`\kappa`-:math:`\kappa`
        * :math:`s_a=2`, :math:`s_b=0` e.g. galaxy-shear, and :math:`\kappa`-shear
        * :math:`s_a=s_b=2` e.g. shear-shear.

    .. note::
        For scales smaller than :math:`\sim 0.1^{\circ}`, the input power
        spectrum should be sampled to sufficienly high :math:`\ell` to ensure
        the Hankel transform is well-behaved. The following spline parameters,
        related to ``FFTLog``-sampling may also be modified for accuracy:

            * ``ccl.spline_params.ELL_MIN_CORR``
            * ``ccl.spline_params.ELL_MAX_CORR``
            * ``ccl.spline_params.N_ELL_CORR``.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): A Cosmology object.
        ell (array): Multipoles corresponding to the input angular power
                          spectrum.
        C_ell (array): Input angular power spectrum.
        theta (:obj:`float` or `array`): Angular separation(s) at which to
            calculate the angular correlation function (in degrees).
        type (:obj:`str`): Type of correlation function. Choices: ``'NN'`` (0x0),
            ``'NG'`` (0x2), ``'GG+'`` (2x2, :math:`\xi_+`),
            ``'GG-'`` (2x2, :math:`\xi_-`), where numbers refer to the spins
            of the two quantities being cross-correlated (see Section 2.4.2 of
            the CCL paper). The naming system roughly follows the nomenclature
            used in `TreeCorr
            <https://rmjarvis.github.io/TreeCorr/_build/html/correlation2.html>`_.
        method (:obj:`str`): Method to compute the correlation function.
            Choices: ``'Bessel'`` (direct integration over Bessel function),
            ``'FFTLog'`` (fast integration with FFTLog), ``'Legendre'``
            (brute-force sum over Legendre polynomials).

    Returns:
        (:obj:`float` or `array`): Value(s) of the correlation function at the
        input angular separations.


r"""Compute the 3D correlation function:

    .. math::
        \xi(r)\equiv\frac{1}{2\pi^2}\int dk\,k^2\,P(k)\,j_0(kr).

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): A Cosmology object.
        r (:obj:`float` or `array`): distance(s) at which to calculate the 3D
            correlation function (in Mpc).
        a (:obj:`float`): scale factor.
        p_of_k_a (:class:`~pyccl.pk2d.Pk2D`, :obj:`str` or :obj:`None`): 3D Power spectrum
            to integrate. If a string, it must correspond to one of the
            non-linear power spectra stored in `cosmo` (e.g.
            `'delta_matter:delta_matter'`).

    Returns:
        Value(s) of the correlation function at the input distance(s).


r"""Compute the correlation function multipoles:

    .. math::
        \xi_\ell(r)\equiv\frac{i^\ell}{2\pi^2}\int dk\,k^2\,P(k)\,j_\ell(kr).

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): A Cosmology object.
        r (:obj:`float` or `array`): distance(s) at which to calculate the 3D
            correlation function (in Mpc).
        a (:obj:`float`): scale factor.
        beta (:obj:`float`): growth rate divided by galaxy bias.
        ell (:obj:`int`) : the desired multipole
        p_of_k_a (:class:`~pyccl.pk2d.Pk2D`, :obj:`str` or :obj:`None`): 3D Power spectrum
            to integrate. If a string, it must correspond to one of the
            non-linear power spectra stored in `cosmo` (e.g.
            `'delta_matter:delta_matter'`).

    Returns:
        Value(s) of the correlation function at the input distance(s).


r"""
    Compute the 3D correlation function with linear RSDs using
    multipoles:

    .. math::
        \xi(r,\mu) = \sum_{\ell\in\{0,2,4\}}\xi_\ell(r)\,P_\ell(\mu)

    where :math:`P_\ell(\mu)` are the Legendre polynomials, and
    :math:`\xi_\ell(r)` are the correlation function multipoles.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): A Cosmology object.
        r (:obj:`float` or `array`): distance(s) at which to calculate the
            3D correlation function (in Mpc).
        a (:obj:`float`): scale factor.
        mu (:obj:`float`): cosine of the angle at which to calculate the 3D
            correlation function.
        beta (:obj:`float`): growth rate divided by galaxy bias.
        p_of_k_a (:class:`~pyccl.pk2d.Pk2D`, :obj:`str` or :obj:`None`): 3D Power spectrum
            to integrate. If a string, it must correspond to one of the
            non-linear power spectra stored in `cosmo` (e.g.
            `'delta_matter:delta_matter'`).
        use_spline (:obj:`bool`): switch that determines whether the RSD correlation
            function is calculated using global splines of multipoles.

    Returns:
        Value(s) of the correlation function at the input distance(s) & angle.


    Compute the 3D correlation function averaged over angles with
    RSDs. Equivalent to calling :func:`correlation_multipole`
    with ``ell=0``.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): A Cosmology object.
        r (:obj:`float` or `array`): distance(s) at which to calculate the 3D
            correlation function (in Mpc).
        a (:obj:`float`): scale factor.
        beta (:obj:`float`): growth rate divided by galaxy bias.
        p_of_k_a (:class:`~pyccl.pk2d.Pk2D`, :obj:`str` or :obj:`None`): 3D Power spectrum
            to integrate. If a string, it must correspond to one of the
            non-linear power spectra stored in `cosmo` (e.g.
            `'delta_matter:delta_matter'`).

    Returns:
        Value(s) of the correlation function at the input distance(s) & angle.


r"""
    Compute the 3D correlation in :math:`(\pi,\sigma)` space. This is
    just

    .. math::
        \xi(\pi,\sigma) = \xi(r=\sqrt{\pi^2+\sigma^2},\mu=\pi/r).

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): A Cosmology object.
        pi (:obj:`float`): distance times cosine of the angle (in Mpc).
        sigma (:obj:`float` or `array`): distance(s) times sine of the angle
            (in Mpc).
        a (:obj:`float`): scale factor.
        beta (:obj:`float`): growth rate divided by galaxy bias.
        p_of_k_a (:class:`~pyccl.pk2d.Pk2D`, :obj:`str` or :obj:`None`): 3D Power spectrum
            to integrate. If a string, it must correspond to one of the
            non-linear power spectra stored in `cosmo` (e.g.
            `'delta_matter:delta_matter'`).
        use_spline (:obj:`bool`): switch that determines whether the RSD correlation
            function is calculated using global splines of multipoles.

    Returns:
        Value(s) of the correlation function at the input pi and sigma.


clt1, clt2 are lists of tracer in a tracer object
    cosmo (:class:`~pyccl.core.Cosmology`): A Cosmology object.
    psp non-linear power spectrum
    l_limber max ell for non-limber calculation
    ell_use ells at which we calculate the non-limber integrals


Returns the neutrinos mass(es) for a given value of
    :math:`\\Omega_\\nu h^2`, according to the splitting convention
    specified by the user.

    Args:
        Omega_nu_h2 (:obj:`float`): Neutrino energy density at z=0 times
            :math:`h^2`.
        mass_split (:obj:`str`): indicates how the masses should be split up
            Should be one of 'normal', 'inverted', 'equal' or 'sum'.
        m_nu (:obj:`float` or array_like):
            Mass in eV of the massive neutrinos present.
            If a sequence is passed, it is assumed that the elements of the
            sequence represent the individual neutrino masses.

    Returns:
        :obj:`float` or `array`: Neutrino mass(es) corresponding to this
        :math:`\\Omega_\\nu h^2`.


Calculate the connected non-Gaussian covariance for a pair of
    angular power spectra :math:`C_{\\ell_1}^{ab}` and :math:`C_{\\ell_2}^{cd}`,
    between two pairs of tracers (:math:`(a,b)` and :math:`(c,d)`).

    Specifically, it computes:

    .. math::
        {\\rm Cov}_{\\rm cNG}(\\ell_1,\\ell_2)=\\frac{1}{4\\pi f_{\\rm sky}}
        \\int \\frac{d\\chi}{\\chi^6}
        \\tilde{\\Delta}^a_{\\ell_1}(\\chi)
        \\tilde{\\Delta}^b_{\\ell_1}(\\chi)
        \\tilde{\\Delta}^c_{\\ell_2}(\\chi)
        \\tilde{\\Delta}^d_{\\ell_2}(\\chi)\\,
        \\bar{T}_{abcd}\\left[\\frac{\\ell_1+1/2}{\\chi},
                              \\frac{\\ell_2+1/2}{\\chi}, a(\\chi)\\right]

    where :math:`\\Delta^x_\\ell(\\chi)` is the transfer function for tracer
    :math:`x` (see Eq. 39 in the CCL note), and
    :math:`\\bar{T}_{abcd}(k_1,k_2,a)` is the isotropized connected
    trispectrum of the four tracers (see the documentation of the
    :class:`~pyccl.tk3d.Tk3D` class for details).

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): A Cosmology object.
        tracer1 (:class:`~pyccl.tracers.Tracer`): a Tracer object.
        tracer2 (:class:`~pyccl.tracers.Tracer`): a second Tracer object.
        ell (:obj:`float` or `array`): Angular wavenumber(s) at which to evaluate
            the first dimension of the angular power spectrum covariance.
        t_of_kk_a (:class:`~pyccl.tk3d.Tk3D`): 3D connected
            trispectrum.
        tracer3 (:class:`~pyccl.tracers.Tracer`): a Tracer object.
            If ``None``, ``tracer1`` will be used instead.
        tracer4 (:class:`~pyccl.tracers.Tracer`): a Tracer object.
            If ``None``, ``tracer2`` will be used instead.
        ell2 (:obj:`float` or `array`): Angular wavenumber(s) at which to evaluate
            the second dimension of the angular power spectrum covariance. If
            ``None``, ``ell`` will be used instead.
        fsky (:obj:`float`): sky fraction.
        integration_method (:obj:`str`) : integration method to be used
            for the Limber integrals. Possibilities: ``'qag_quad'`` (GSL's
            `qag` method backed up by `quad` when it fails) and ``'spline'``
            (the integrand is splined and then integrated analytically).

    Returns:
        (:obj:`float` or `array`): 2D array containing the connected non-Gaussian \
            Angular power spectrum covariance \
            :math:`{\\rm Cov}_{\\rm cNG}(\\ell_1,\\ell_2)`, for the \
            four input tracers, as a function of :math:`\\ell_1` and \
            :math:`\\ell_2`. The ordering is such that \
            ``out[i2, i1] = Cov(ell2[i2], ell[i1])``.


Returns the variance of the projected linear density field
    over a circular disc covering a sky fraction `fsky` as a function
    of scale factor. This is given by

    .. math::
        \\sigma^2_B(z) = \\int_0^\\infty \\frac{k\\,dk}{2\\pi}
            P_L(k,z)\\,\\left[\\frac{2J_1(k R(z))}{k R(z)}\\right]^2,

    where :math:`R(z)` is the corresponding radial aperture as a
    function of redshift. This quantity can be used to compute the
    super-sample covariance (see :func:`angular_cl_cov_SSC`).

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
        a_arr (:obj:`float`, `array` or :obj:`None`): an array of scale factor
            values at which to evaluate the projected variance. If
            ``None``, a default sampling will be used.
        fsky (:obj:`float`): sky fraction.
        p_of_k_a (:class:`~pyccl.pk2d.Pk2D` or :obj:`str`): Linear
            power spectrum to use. Defaults to the
            internal linear power spectrum from ``cosmo``.

    Returns:
        Tuple containing

        - a_arr (`array`): an array of scale factor values at which the
          projected variance has been evaluated. Only returned if ``a_arr``
          is ``None`` on input.
        - sigma2_B (:obj:`float` or `array`): projected variance.


 Returns the variance of the projected linear density field, given the
    angular power spectrum of the footprint mask and scale factor. This is
    given by

    .. math::
        \\sigma^2_B(z) = \\frac{1}{\\chi^2(z)}\\sum_\\ell
            P_L\\left(\\frac{\\ell+\\frac{1}{2}}{\\chi(z)},z\\right)\\,
            \\sum_{m=-\\ell}^\\ell W^A_{\\ell m} {W^B}^*_{\\ell m},

    where :math:`W^A_{\\ell m}` and :math:`W^B_{\\ell m}` are the spherical
    harmonics decomposition of the footprint masks of fields `A` and `B`,
    normalized by their area. This quantity can be used to compute the
    super-sample covariance (see :func:`angular_cl_cov_SSC`).

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
        a_arr (:obj:`float`, `array` or :obj:`None`): an array of scale factor
            values at which to evaluate the projected variance.
        mask_wl (`array`): Array with the angular power spectrum of the
            masks. The power spectrum should be given at integer multipoles,
            starting at :math:`\\ell=0`. The power spectrum is normalized as
            :math:`{\\tt mask\\_wl}=\\sum_m W^A_{\\ell m} {W^B}^*_{\\ell m}`.
            It is the responsibility of the user to the provide the mask power
            out to sufficiently high ell for their required precision.
        p_of_k_a (:class:`~pyccl.pk2d.Pk2D` or :obj:`str`): Linear
            power spectrum to use. Defaults to the
            internal linear power spectrum from `cosmo`.

    Returns:
        Tuple containing

        - a_arr (`array`): an array of scale factor values at which the
          projected variance has been evaluated. Only returned if ``a_arr`` is
          ``None`` on input.
        - sigma2_B (:obj:`float` or `array`): projected variance.


Calculate the super-sample contribution to the connected
    non-Gaussian covariance for a pair of power spectra
    :math:`C_{\\ell_1}^{ab}` and :math:`C_{\\ell_2}^{cd}`,
    between two pairs of tracers (:math:`(a,b)` and :math:`(c,d)`).

    Specifically, it computes:

    .. math::
        {\\rm Cov}_{\\rm SSC}(\\ell_1,\\ell_2)=
        \\int \\frac{d\\chi}{\\chi^4}
        \\tilde{\\Delta}^a_{\\ell_1}(\\chi)
        \\tilde{\\Delta}^b_{\\ell_1}(\\chi)
        \\tilde{\\Delta}^c_{\\ell_2}(\\chi)
        \\tilde{\\Delta}^d_{\\ell_2}(\\chi)\\,
        \\bar{T}_{abcd}\\left[\\frac{\\ell_1+1/2}{\\chi},
                              \\frac{\\ell_2+1/2}{\\chi}, a(\\chi)\\right]

    where :math:`\\Delta^x_\\ell(\\chi)` is the transfer function for tracer
    :math:`x` (see Eq. 39 in the CCL note), and
    :math:`\\bar{T}_{abcd}(k_1,k_2,a)` is the isotropized connected
    trispectrum of the four tracers (see the documentation of the
    :class:`~pyccl.tk3d.Tk3D` class for details).

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): A Cosmology object.
        tracer1 (:class:`~pyccl.tracers.Tracer`): a Tracer object.
        tracer2 (:class:`~pyccl.tracers.Tracer`): a second Tracer object.
        ell (:obj:`float` or `array`): Angular wavenumber(s) at which to evaluate
            the first dimension of the angular power spectrum covariance.
        t_of_kk_a (:class:`~pyccl.tk3d.Tk3D`): 3D connected
            trispectrum.
        tracer3 (:class:`~pyccl.tracers.Tracer`): a Tracer object.
            If ``None``, ``tracer1`` will be used instead.
        tracer4 (:class:`~pyccl.tracers.Tracer`): a Tracer object.
            If ``None``, ``tracer2`` will be used instead.
        ell2 (:obj:`float` or `array`): Angular wavenumber(s) at which to evaluate
            the second dimension of the angular power spectrum covariance. If
            ``None``, ``ell`` will be used instead.
        sigma2_B (:obj:`tuple` or :obj:`None`): A tuple of arrays
            (a, sigma2_B(a)) containing the variance of the projected matter
            overdensity over the footprint as a function of the scale factor.
            If ``None``, a compact circular footprint will be assumed covering
            a sky fraction ``fsky``.
        fsky (:obj:`float`): sky fraction.
        integration_method (:obj:`str`) : integration method to be used
            for the Limber integrals. Possibilities: ``'qag_quad'`` (GSL's
            `qag` method backed up by `quad` when it fails) and ``'spline'``
            (the integrand is splined and then integrated analytically).

    Returns:
        (:obj:`float` or `array`): 2D array containing the super-sample \
            Angular power spectrum covariance \
            :math:`{\\rm Cov}_{\\rm SSC}(\\ell_1,\\ell_2)`, for the \
            four input tracers, as a function of :math:`\\ell_1` and \
            :math:`\\ell_2`. The ordering is such that \
            ``out[i2, i1] = Cov(ell2[i2], ell[i1])``.


Compute the distance splines.


Ratio of Hubble constant at `a` over Hubble constant today.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmological parameters.
        a (:obj:`float` or `array`): Scale factor(s), normalized to 1 today.

    Returns:
        (:obj:`float` or `array`): H(a)/H0.


Comoving radial distance.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmological parameters.
        a (:obj:`float` or `array`): Scale factor(s), normalized to 1 today.

    Returns:
        (:obj:`float` or `array`): Comoving radial distance; Mpc.


Scale factor, a, at a comoving radial distance chi.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmological parameters.
        chi (:obj:`float` or `array`): Comoving radial distance(s); Mpc.

    Returns:
        (:obj:`float` or `array`): Scale factor(s), normalized to 1 today.


Comoving angular distance.

    .. note:: This quantity is otherwise known as the transverse
              comoving distance, and is NOT angular diameter
              distance or angular separation. The comoving angular distance
              is defined such that the comoving distance between
              two objects at a fixed scale factor separated by an angle
              :math:`\\theta` is :math:`\\theta r_{A}(a)` where
              :math:`r_{A}(a)` is the comoving angular distance.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmological parameters.
        a (:obj:`float` or `array`): Scale factor(s), normalized to 1 today.

    Returns:
        (:obj:`float` or `array`): Comoving angular distance; Mpc.


Angular diameter distance.

    The angular diameter distance in Mpc from scale factor
    `a1` to scale factor `a2`. If `a2` is not provided, it is
    assumed that the distance will be calculated between 1 and
    `a1`.

    .. note:: `a2` has to be smaller than `a1` (i.e. a source at
              `a2` is behind one at `a1`). You can compute the
              distance between a single lens at `a1` and multiple
              sources at `a2` by passing a scalar `a1`.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmological parameters.
        a1 (:obj:`float` or `array`): Scale factor(s), normalized to 1 today.
        a2 (:obj:`float` or `array`): Scale factor(s), normalized to 1 today,
            optional.

    Returns:
        (:obj:`float` or `array`): angular diameter distance; Mpc.


Luminosity distance.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmological parameters.
        a (:obj:`float` or `array`): Scale factor(s), normalized to 1 today.

    Returns:
        (:obj:`float` or `array`): Luminosity distance; Mpc.


Distance Modulus, defined as

    .. math::
        \\mu = 5\\,\\log_{10}(d_L/10\\,{\\rm pc})

    where :math:`d_L` is the luminosity distance.

    .. note :: The distance modulus can be used to convert between apparent
               and absolute magnitudes via :math:`m = M + \\mu`, where
               :math:`m` is the apparent magnitude and :math:`M` is the
               absolute magnitude.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmological parameters.
        a (:obj:`float` or `array`): Scale factor(s), normalized to 1 today.

    Returns:
        (:obj:`float` or `array`): Distance modulus at a.


r"""Hubble distance in :math:`\rm Mpc`.

    .. math::

        D_{\rm H} = \frac{cz}{H_0}

    Arguments
    ---------
    cosmo : :class:`~pyccl.core.Cosmology`
        Cosmological parameters.
    a : float or (na,) array_like
        Scale factor(s) normalized to 1 today.

    Returns
    -------
    D_H : float or (na,) ``numpy.ndarray``
        Hubble distance.


r"""Comoving volume element in :math:`\rm Mpc^3 \, sr^{-1}`.

    .. math::

        \frac{\mathrm{d}V}{\mathrm{d}a \, \mathrm{d} \Omega}

    Arguments
    ---------
    cosmo : :class:`~pyccl.core.Cosmology`
        Cosmological parameters.
    a : float or (na,) array_like
        Scale factor(s) normalized to 1 today.

    Returns
    -------
    dV : float or (na,) ``numpy.ndarray``
        Comoving volume per unit scale factor per unit solid angle.

    See Also
    --------
    comoving_volume : integral of the comoving volume element


r"""Comoving volume, in :math:`\rm Mpc^3`.

    .. math::

        V_{\rm C} = \int_{\Omega} \mathrm{{d}}\Omega \int_z \mathrm{d}z
        D_{\rm H} \frac{(1+z)^2 D_{\mathrm{A}}^2}{E(z)}

    See Eq. 29 in `Hogg 2000 <https://arxiv.org/abs/astro-ph/9905116>`_.

    Arguments
    ---------
    cosmo : :class:`~pyccl.core.Cosmology`
        Cosmological parameters.
    a : float or (na,) array_like
        Scale factor(s) normalized to 1 today.
    solid_angle : float
        Solid angle subtended in the sky for which
        the comoving volume is calculated.

    Returns
    -------
    V_C : float or (na,) ndarray
        Comoving volume at ``a``.

    See Also
    --------
    comoving_volume_element : comoving volume element


r"""Difference of the age of the Universe between some scale factor
    and today, in :math:`\rm Gyr`.

    Arguments
    ---------
    cosmo : :class:`~pyccl.core.Cosmology`
        Cosmological parameters.
    a : float or (na,) array_like
        Scale factor(s) normalized to 1 today.

    Returns
    -------
    t_L : float or (na,) ndarray
        Lookback time at ``a``. ``nan`` if ``a`` is out of bounds of the spline
        parametets stored in ``cosmo``.


r"""Age of the Universe at some scale factor, in :math:`\rm Gyr`.

    Arguments
    ---------
    cosmo : :class:`~pyccl.core.Cosmology`
        Cosmological parameters.
    a : float or (na,) array_like
        Scale factor(s) normalized to 1 today.

    Returns
    -------
    t_age : float or (na,) ndarray
        Age of the Universe at ``a``. ``nan`` if ``a`` is out of bounds of the
        spline parametets stored in ``cosmo``.


Returns the critical surface mass density.

    .. math::
         \\Sigma_{\\mathrm{crit}} = \\frac{c^2}{4\\pi G}
         \\frac{D_{\\rm{s}}}{D_{\\rm{l}}D_{\\rm{ls}}},

    where :math:`c` is the speed of light, :math:`G` is the
    gravitational constant, and :math:`D_i` is the angular diameter
    distance. The labels :math:`i = \\{s,\\,l,\\,ls\\}` denote the distances
    to the source, lens, and between source and lens, respectively.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): A Cosmology object.
        a_lens (:obj:`float`): lens' scale factor.
        a_source (:obj:`float` or `array`): source's scale factor.

    Returns:
        (:obj:`float` or `array`): :math:`\\Sigma_{\\mathrm{crit}}` in units
        of :math:`M_{\\odot}/{\\rm Mpc}^2`


Density fraction of a given species at a redshift different than z=0.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmological parameters.
        a (:obj:`float` or `array`): Scale factor(s), normalized to 1 today.
        species (:obj:`str`): species type. Should be one of

            * 'matter': cold dark matter, massive neutrinos, and baryons
            * 'dark_energy': cosmological constant or otherwise
            * 'radiation': relativistic species besides massless neutrinos
            * 'curvature': curvature density
            * 'neutrinos_rel': relativistic neutrinos
            * 'neutrinos_massive': massive neutrinos
            * 'critical'

    Returns:
        (:obj:`float` or `array`): Density fraction of a given species at a \
                             scale factor.


Physical or comoving density as a function of scale factor.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmological parameters.
        a (:obj:`float` or `array`): Scale factor(s), normalized to 1 today.
        species (:obj:`str`): species type. Should be one of

            - 'matter': cold dark matter, massive neutrinos, and baryons
            - 'dark_energy': cosmological constant or otherwise
            - 'radiation': relativistic species besides massless neutrinos
            - 'curvature': curvature density
            - 'neutrinos_rel': relativistic neutrinos
            - 'neutrinos_massive': massive neutrinos
            - 'critical'

        is_comoving (:obj:`bool`): either physical (False, default) or
            comoving (True)

    Returns:
        (:obj:`float` or `array`): Physical density of a given species
        at a scale factor, in units of :math:`M_\\odot / {\\rm Mpc}^3`.


Growth factor.

    .. warning:: CCL is not able to compute the scale-dependent growth
                 factor for cosmologies with massive neutrinos.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmological parameters.
        a (:obj:`float` or `array`): Scale factor(s), normalized to 1 today.

    Returns:
        (:obj:`float` or `array`): Growth factor, normalized to unity today.


Unnormalized growth factor.

    .. warning:: CCL is not able to compute the scale-dependent growth
                 factor for cosmologies with massive neutrinos.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmological parameters.
        a (:obj:`float` or `array`): Scale factor(s), normalized to 1 today.

    Returns:
        (:obj:`float` or `array`): Unnormalized growth factor, normalized to \
            the scale factor at early times.


Growth rate defined as the logarithmic derivative of the
    growth factor, :math:`f\\equiv d\\log D/d\\log a`.

    .. warning:: CCL is not able to compute the scale-dependent growth
                 rate for cosmologies with massive neutrinos.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): Cosmological parameters.
        a (:obj:`float` or `array`): Scale factor(s), normalized to 1 today.

    Returns:
        (:obj:`float` or `array`): Growth rate.


 Update the level of verbosity of the CCL warnings. Available
    levels are "none", "low", and "high". More warning messages will
    be output for higher verbosity levels. If "none", no CCL-level
    warnings will be shown. The default verbosity is "low". Note that
    unless the verbosity level is "high", all C-level warnings will
    be omitted.

    Args:
        verbosity (str): one of ``'none'``, ``'low'`` or ``'high'``.


Assign all functions in ``modules`` which take ``name`` as their
    first argument as methods of the class ``cls``.


Turn python objects into yaml types where possible.


Assemble all of the input data into a valid ccl_cosmology object.


Returns a dictionary of the arguments used to create the Cosmology
        object such that ``cosmo == pyccl.Cosmology(**cosmo.to_dict())``
        is ``True``.


Write a YAML representation of the parameters to file.

        Args:
            filename (:obj:`str`): file name, file pointer, or stream to write
                parameters to.


Read the parameters from a YAML file.

        Args:
            filename (:obj:`str`): file name, file pointer, or stream to read
                parameters from.
            **kwargs (:obj:`dict`): additional keywords that supersede
                file contents


Build a ccl_configuration struct.

        This function builds C ccl_configuration struct. This structure
        controls which various approximations are used for the transfer
        function, matter power spectrum, and baryonic effect in the matter
        power spectrum.

        It also does some error checking on the inputs to make sure they
        are valid and physically consistent.


Build a ccl_parameters struct


Compute the growth function.


Return the linear power spectrum.


Compute the linear power spectrum.


Return the non-linear power spectrum.


Compute the non-linear power spectrum.


Compute the sigma(M) spline.


A cosmology with typical flat Lambda-CDM parameters (`Omega_c=0.25`,
    `Omega_b = 0.05`, `Omega_k = 0`, `sigma8 = 0.81`, `n_s = 0.96`, `h = 0.67`,
    no massive neutrinos) for quick instantiation.

    Arguments:
        **kwargs (:obj:`dict`): a dictionary of parameters passed as arguments
            to the :class:`Cosmology` constructor. It should not contain any of
            the :math:`\\Lambda`-CDM parameters (`"Omega_c"`, `"Omega_b"`,
            `"n_s"`, `"sigma8"`, `"A_s"`, `"h"`), since these are fixed.


Check that all attributes listed in ``__repr_attrs__`` are defined in
    the constructor of all subclasses of ``CCLAutoRepr``.
    NOTE: Used in ``conftest.py``.


Determine if `__repr_attrs__` is defined somewhere in the MRO.


Returns True if all elements are finite (i.e. not NaN or inf).


 Computes the halo model 1-halo trispectrum for four different
    quantities defined by their respective halo profiles. The 1-halo
    trispectrum for four profiles :math:`u_{1,2}`, :math:`v_{1,2}` is
    calculated as:

    .. math::
        T_{u_1,u_2;v_1,v_2}(k_u,k_v,a) =
        I^0_{2,2}(k_u,k_v,a|u_{1,2},v_{1,2})

    where :math:`I^0_{2,2}` is defined in the documentation
    of :meth:`~pyccl.halos.halo_model.HMCalculator.I_0_22`.

    .. note:: This approximation assumes that the 4-point
              profile cumulant is the same as the product of two
              2-point cumulants. We may relax this assumption in
              future versions of CCL.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
        hmc (:class:`HMCalculator`): a halo model calculator.
        k (:obj:`float` or `array`): comoving wavenumber in
            :math:`{\\rm Mpc}^{-1}`.
        a (:obj:`float` or `array`): scale factor.
        prof (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`): halo
            profile (corresponding to :math:`u_1` above).
        prof2 (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`): halo
            profile (corresponding to :math:`u_2` above). If ``None``,
            ``prof`` will be used as ``prof2``.
        prof12_2pt (:class:`~pyccl.halos.profiles_2pt.Profile2pt`):
            a profile covariance object returning the the two-point
            moment of ``prof`` and ``prof2``. If ``None``, the default
            second moment will be used, corresponding to the
            products of the means of both profiles.
        prof3 (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`): halo
            profile (corresponding to :math:`v_1` above. If ``None``,
            ``prof`` will be used as ``prof3``.
        prof4 (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`): halo
            profile (corresponding to :math:`v_2` above. If ``None``,
            ``prof2`` will be used as ``prof4``.
        prof34_2pt (:class:`~pyccl.halos.profiles_2pt.Profile2pt`):
            same as ``prof12_2pt`` for ``prof3`` and ``prof4``.

    Returns:
        (:obj:`float` or `array`): 1-halo trispectrum evaluated at each
        combination of ``k`` and ``a``. The shape of the output will
        be ``(N_a, N_k, N_k)`` where ``N_k`` and ``N_a`` are the sizes of
        ``k`` and ``a`` respectively. The ordering is such that
        ``output[ia, ik2, ik1] = T(k[ik1], k[ik2], a[ia])``
        If ``k`` or ``a`` are scalars, the corresponding dimension will
        be squeezed out on output.


 Returns a :class:`~pyccl.tk3d.Tk3D` object containing
    the 1-halo trispectrum for four quantities defined by
    their respective halo profiles. See :meth:`halomod_trispectrum_1h`
    for more details about the actual calculation.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
        hmc (:class:`HMCalculator`): a halo model calculator.
        prof (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`): halo
            profile (corresponding to :math:`u_1` above.
        prof2 (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`): halo
            profile. If ``None``, ``prof`` will be used as ``prof2``.
        prof3 (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`): halo
            profile. If ``None``, ``prof`` will be used as ``prof3``.
        prof4 (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`): halo
            profile. If ``None``, ``prof2`` will be used as ``prof4``.
        prof12_2pt (:class:`~pyccl.halos.profiles_2pt.Profile2pt`):
            a profile covariance object returning the the two-point
            moment of ``prof`` and ``prof2``. If ``None``, the default
            second moment will be used, corresponding to the
            products of the means of both profiles.
        prof34_2pt (:class:`~pyccl.halos.profiles_2pt.Profile2pt`):
            same as ``prof12_2pt`` for ``prof3`` and ``prof4``.
        a_arr (array): an array holding values of the scale factor
            at which the trispectrum should be calculated for
            interpolation. If ``None``, the internal values used
            by ``cosmo`` will be used.
        lk_arr (array): an array holding values of the natural
            logarithm of the wavenumber (in units of
            :math:`{\\rm Mpc}^{-1}`) at which the trispectrum should
            be calculated for interpolation. If ``None``, the internal
            values used by ``cosmo`` will be used.
        extrap_order_lok (:obj:`int`): extrapolation order to be used on
            k-values below the minimum of the splines. See
            :class:`~pyccl.tk3d.Tk3D`.
        extrap_order_hik (:obj:`int`): extrapolation order to be used on
            k-values above the maximum of the splines. See
            :class:`~pyccl.tk3d.Tk3D`.
        use_log (:obj:`bool`): if ``True``, the trispectrum will be
            interpolated in log-space (unless negative or
            zero values are found).

    Returns:
        :class:`~pyccl.tk3d.Tk3D`: 1-halo trispectrum.


 Returns a :class:`~pyccl.tk3d.Tk3D` object containing
    the super-sample covariance trispectrum, given by the tensor
    product of the power spectrum responses associated with the
    two pairs of quantities being correlated. Each response is
    calculated as:

    .. math::
        \\frac{\\partial P_{u,v}(k)}{\\partial\\delta_L} = b_u b_v \\left(
        \\left(\\frac{68}{21}-\\frac{1}{3}\\frac{d\\log k^3P_L(k)}{d\\log k}\\right)
        P_L(k)+I^1_2(k|u,v)\\right) - (b_{u} + b_{v}) P_{u,v}(k)

    where the :math:`I^1_2` is defined in the documentation
    :meth:`~pyccl.halos.halo_model.HMCalculator.I_1_2` and :math:`b_{u}`
    and :math:`b_{v}` are the linear halo biases for quantities :math:`u`
    and :math:`v`, respectively. The second term is only included if the
    corresponding profiles do not represent number counts.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
        hmc (:class:`HMCalculator`): a halo model calculator.
        prof (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`): a halo
            profile representing the matter overdensity.
        bias1 (:obj:`float` or `array`): linear galaxy bias for quantity 1.
            If an array, it has to have the shape of ``a_arr``.
        bias2 (:obj:`float` or `array`): linear galaxy bias for quantity 2.
        bias3 (:obj:`float` or `array`): linear galaxy bias for quantity 3.
        bias4 (:obj:`float` or `array`): linear galaxy bias for quantity 4.
        is_number_counts1 (:obj:`bool`): If ``True``, quantity 1 will be considered
            number counts and the clustering counter terms computed.
        is_number_counts2 (:obj:`bool`): as ``is_number_counts1`` but for quantity 2.
        is_number_counts3 (:obj:`bool`): as ``is_number_counts1`` but for quantity 3.
        is_number_counts4 (:obj:`bool`): as ``is_number_counts1`` but for quantity 4.
        p_of_k_a (:class:`~pyccl.pk2d.Pk2D`): a `Pk2D` object to
            be used as the linear matter power spectrum. If ``None``,
            the power spectrum stored within ``cosmo`` will be used.
        a_arr (array): an array holding values of the scale factor
            at which the trispectrum should be calculated for
            interpolation. If ``None``, the internal values used
            by ``cosmo`` will be used.
        lk_arr (array): an array holding values of the natural
            logarithm of the wavenumber (in units of
            :math:`{\\rm Mpc}^{-1}`) at which the trispectrum should be
            calculated for interpolation. If ``None``, the internal values
            used by ``cosmo`` will be used.
        extrap_order_lok (:obj:`int`): extrapolation order to be used on
            k-values below the minimum of the splines. See
            :class:`~pyccl.tk3d.Tk3D`.
        extrap_order_hik (:obj:`int`): extrapolation order to be used on
            k-values above the maximum of the splines. See
            :class:`~pyccl.tk3d.Tk3D`.
        use_log (:obj:`bool`): if ``True``, the trispectrum will be
            interpolated in log-space (unless negative or
            zero values are found).
        extrap_pk (:obj:`bool`):
            Whether to extrapolate ``p_of_k_a`` in case ``a`` is out of its
            support. If ``False``, and the queried values are out of bounds,
            an error is raised. The default is ``False``.

    Returns:
        :class:`~pyccl.tk3d.Tk3D`: SSC effective trispectrum.


 Returns a :class:`~pyccl.tk3d.Tk3D` object containing
    the super-sample covariance trispectrum, given by the tensor
    product of the power spectrum responses associated with the
    two pairs of quantities being correlated. Each response is
    calculated as:

    .. math::
        \\frac{\\partial P_{u,v}(k)}{\\partial\\delta_L} =
        \\left(\\frac{68}{21}-\\frac{1}{3}\\frac{d\\log k^3P_L(k)}{d\\log k}
        \\right)P_L(k)I^1_1(k,|u)I^1_1(k,|v)+I^1_2(k|u,v) - (b_{u} + b_{v})
        P_{u,v}(k)

    where the :math:`I^a_b` are defined in the documentation
    of :meth:`~pyccl.halos.halo_model.HMCalculator.I_1_1` and
    :meth:`~pyccl.halos.halo_model.HMCalculator.I_1_2` and
    :math:`b_{u}` and :math:`b_{v}` are the linear halo biases for
    quantities :math:`u` and :math:`v`, respectively (zero if the
    profiles are not number counts).

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
        hmc (:class:`~pyccl.halos.halo_model.HMCalculator`):
            a halo model calculator.
        prof (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`): halo
            profile.
        prof2 (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`): halo
            profile (corresponding to :math:`u_2` above). If ``None``,
            ``prof`` will be used as ``prof2``.
        prof3 (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`): halo
            profile (corresponding to :math:`v_1` above). If ``None``,
            ``prof`` will be used as ``prof3``.
        prof4 (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`): halo
            profile (corresponding to :math:`v_2` above). If ``None``,
            ``prof2`` will be used as ``prof4``.
        prof12_2pt (:class:`~pyccl.halos.profiles_2pt.Profile2pt`):
            a profile covariance object returning the the two-point
            moment of ``prof`` and ``prof2``. If ``None``, the default
            second moment will be used, corresponding to the
            products of the means of both profiles.
        prof34_2pt (:class:`~pyccl.halos.profiles_2pt.Profile2pt`):
            same as ``prof12_2pt`` for ``prof3`` and ``prof4``. If ``None``,
            ``prof12_2pt`` will be used.
        p_of_k_a (:class:`~pyccl.pk2d.Pk2D`): a `Pk2D` object to
            be used as the linear matter power spectrum. If ``None``,
            the power spectrum stored within ``cosmo`` will be used.
        a_arr (array): an array holding values of the scale factor
            at which the trispectrum should be calculated for
            interpolation. If ``None``, the internal values used
            by ``cosmo`` will be used.
        lk_arr (array): an array holding values of the natural
            logarithm of the wavenumber (in units of
            :math:`{\\rm Mpc}^{-1}`) at which the trispectrum should
            be calculated for interpolation. If ``None``, the internal
            values used by ``cosmo`` will be used.
        extrap_order_lok (:obj:`int`): extrapolation order to be used on
            k-values below the minimum of the splines. See
            :class:`~pyccl.tk3d.Tk3D`.
        extrap_order_hik (:obj:`int`): extrapolation order to be used on
            k-values above the maximum of the splines. See
            :class:`~pyccl.tk3d.Tk3D`.
        use_log (:obj:`bool`): if ``True``, the trispectrum will be
            interpolated in log-space (unless negative or
            zero values are found).
        extrap_pk (:obj:`bool`):
            Whether to extrapolate ``p_of_k_a`` in case ``a`` is out of its
            support. If ``False``, and the queried values are out of bounds,
            an error is raised. The default is ``False``.

    Returns:
        :class:`~pyccl.tk3d.Tk3D`: SSC effective trispectrum.


Helper to compute counter-terms.


Helper that controls how the undefined profiles are allocated.


Helper that returns the profiles normalization.


Helper that returns the I_1_1 integrals for 4 profiles.


 Computes the "22" term of the isotropized halo model 2-halo trispectrum
    for four profiles :math:`u_{1,2}`, :math:`v_{1,2}` as

    .. math::
        \\bar{T}^{2h}_{22}(k_1, k_2, a) = \\int \\frac{d\\varphi_1}{2\\pi}
        \\int \\frac{d\\varphi_2}{2\\pi}
        T^{2h,(22)}_{u_1,u_2;v_1,v_2}({\\bf k}_1,-{\\bf k}_1,
        {\\bf k}_2,-{\\bf k}_2),

    with

    .. math::
        T^{2h,(22)}_{u_1,u_2;v_1,v_2}(k_u,k_v,a) =
        \\langle P_{\\rm lin}(|{\\bf k}_u + {\\bf k}_v|)\\rangle_{\\varphi}\\,
        I^1_2(k_u, k_v|u_1,v_1)\\,
        I^1_2(k_u, k_v|u_2,v_2) + 1\\,{\\rm perm.}

    where :math:`\\langle\\cdots\\rangle_\\varphi` denotes averaging over the
    relative angle between the two wavevectors, and :math:`I^1_2` is defined in
    the documentation of :meth:`~pyccl.halos.halo_model.HMCalculator.I_1_2`.

    Args:
        cosmo (:class:`~pyccl.core.Cosmology`): a Cosmology object.
        hmc (:class:`HMCalculator`): a halo model calculator.
        k (float or array_like): comoving wavenumber in Mpc^-1.
        a (float or array_like): scale factor.
        prof (:class:`~pyccl.halos.profiles.HaloProfile`): halo
            profile (corresponding to :math:`u_1` above.
        prof2 (:class:`~pyccl.halos.profiles.HaloProfile`): halo
            profile (corresponding to :math:`u_2` above. If `None`,
            `prof` will be used as `prof2`.
        prof12_2pt (:class:`~pyccl.halos.profiles_2pt.Profile2pt`):
            a profile covariance object returning the the two-point
            moment of `prof` and `prof2`. If `None`, the default
            second moment will be used, corresponding to the
            products of the means of both profiles.
        prof3 (:class:`~pyccl.halos.profiles.HaloProfile`): halo
            profile (corresponding to :math:`v_1` above. If `None`,
            `prof` will be used as `prof3`.
        prof4 (:class:`~pyccl.halos.profiles.HaloProfile`): halo
            profile (corresponding to :math:`v_2` above. If `None`,
            `prof2` will be used as `prof4`.
        prof13_2pt (:class:`~pyccl.halos.profiles_2pt.Profile2pt`):
            same as `prof12_2pt` for `prof` and `prof3`.
        prof14_2pt (:class:`~pyccl.halos.profiles_2pt.Profile2pt`):
            same as `prof14_2pt` for `prof` and `prof4`.
        prof24_2pt (:class:`~pyccl.halos.profiles_2pt.Profile2pt`):
            same as `prof14_2pt` for `prof2` and `prof4`.
        prof32_2pt (:class:`~pyccl.halos.profiles_2pt.Profile2pt`):
            same as `prof14_2pt` for `prof3` and `prof2`.
        p_of_k_a (:class:`~pyccl.pk2d.Pk2D`): a `Pk2D` object to
            be used as the linear matter power spectrum. If `None`, the power
            spectrum stored within `cosmo` will be used.
        separable_growth (bool): Indicates whether a separable
            growth function approximation can be used to calculate
            the isotropized power spectrum.

    Returns:
        float or array_like: integral values evaluated at each
        combination of `k` and `a`. The shape of the output will
        be `(N_a, N_k, N_k)` where `N_k` and `N_a` are the sizes of
        `k` and `a` respectively. The ordering is such that
        `output[ia, ik2, ik1] = T(k[ik1], k[ik2], a[ia])`
        If `k` or `a` are scalars, the corresponding dimension will
        be squeezed out on output.


 Computes the "12" term of the isotropized halo model 2-halo trispectrum
    for four profiles :math:`u_{1,2}`, :math:`v_{1,2}` as

    .. math::
        \\bar{T}^{2h}_{13}(k_1, k_2, a) = \\int \\frac{d\\varphi_1}{2\\pi}
        \\int \\frac{d\\varphi_2}{2\\pi}
        T^{2h,(13)}_{u_1,u_2;v_1,v_2}({\\bf k}_1,
        -{\\bf k}_1,{\\bf k}_2,-{\\bf k}_2),

    with

    .. math::
        T^{2h,(13)}_{u_1,u_2;v_1,v_2}(k_u,k_v,a) =
        P_{\\rm lin}(k_u)\\, [I^1_1(k_u|u_1)\\,
        I^1_3(k_u,k_v,k_v|u_2,v_1,v_2)+(u_1\\leftrightarrow u_2)]+
        (u_i\\leftrightarrow v_i)

    where :math:`I^1_1` is defined in the documentation of
    :meth:`~pyccl.halos.halo_model.HMCalculator.I_1_1` and
    :math:`I^1_3` is defined in the documentation of
    :meth:`~pyccl.halos.halo_model.HMCalculator.I_1_3`.

    Args:
        cosmo (:class:`~pyccl.core.Cosmology`): a Cosmology object.
        hmc (:class:`HMCalculator`): a halo model calculator.
        k (float or array_like): comoving wavenumber in Mpc^-1.
        a (float or array_like): scale factor.
        prof (:class:`~pyccl.halos.profiles.HaloProfile`): halo
            profile (corresponding to :math:`u_1` above.
        prof2 (:class:`~pyccl.halos.profiles.HaloProfile`): halo
            profile (corresponding to :math:`u_2` above. If `None`,
            `prof` will be used as `prof2`.
        prof3 (:class:`~pyccl.halos.profiles.HaloProfile`): halo
            profile (corresponding to :math:`v_1` above. If `None`,
            `prof` will be used as `prof3`.
        prof4 (:class:`~pyccl.halos.profiles.HaloProfile`): halo
            profile (corresponding to :math:`v_2` above. If `None`,
            `prof2` will be used as `prof4`.
        prof12_2pt (:class:`~pyccl.halos.profiles_2pt.Profile2pt`):
            a profile covariance object returning the 2-point
            moment of `prof`, `prof2`. If `None`, the default second moment
            will be used, corresponding to the products of the means of each
            profile.
        prof34_2pt (:class:`~pyccl.halos.profiles_2pt.Profile2pt`):
            same as `prof34_2pt` for `prof3` and `prof4`.
        p_of_k_a (:class:`~pyccl.pk2d.Pk2D`): a `Pk2D` object to
            be used as the linear matter power spectrum. If `None`, the power
            spectrum stored within `cosmo` will be used.

    Returns:
        float or array_like: integral values evaluated at each
        combination of `k` and `a`. The shape of the output will
        be `(N_a, N_k, N_k)` where `N_k` and `N_a` are the sizes of
        `k` and `a` respectively. The ordering is such that
        `output[ia, ik2, ik1] = T(k[ik1], k[ik2], a[ia])`
        If `k` or `a` are scalars, the corresponding dimension will
        be squeezed out on output.


 Computes the isotropized halo model 3-halo trispectrum for four
    profiles :math:`u_{1,2}`, :math:`v_{1,2}` as

    .. math::
        \\bar{T}^{3h}(k_1, k_2, a) = \\int \\frac{d\\varphi_1}{2\\pi}
        \\int \\frac{d\\varphi_2}{2\\pi}
        T^{3h}_{u_1,u_2;v_1,v_2}({\\bf k_1},
        -{\\bf k_1},{\\bf k_2},-{\\bf k_2}),

    with

    .. math::
        T^{3h}_{u_1,u_2;v_1,v_2}({\\bf k}_u,{\\bf k}_v,a) =
        B^{\\rm PT}({\\bf k}_u, -{\\bf k}_v,
                    -{\\bf k}_u+{\\bf k}_v)
        I^1_1(k_u | u_1) I^1_1(k_v | v_1) I^1_2(k_u, k_v|u_2,v_2) \\,
        + 3\\,{\\rm perm.}

    where :math:`I^1_1` and :math:`I^1_2` are defined in the documentation
    of :meth:`~pyccl.halos.halo_model.HMCalculator.I_1_1` and
    :meth:`~pyccl.halos.halo_model.HMCalculator.I_1_2`,
    respectively; and the tree-level bispectrum :math:`B^{PT}` is calculated
    according to Eq. 30 of `Takada et al. 2013
    <https://arxiv.org/abs/1302.6994>`_

    Args:
        cosmo (:class:`~pyccl.core.Cosmology`): a Cosmology object.
        hmc (:class:`HMCalculator`): a halo model calculator.
        k (float or array_like): comoving wavenumber in Mpc^-1.
        a (float or array_like): scale factor.
        prof (:class:`~pyccl.halos.profiles.HaloProfile`): halo
            profile (corresponding to :math:`u_1` above.
        prof2 (:class:`~pyccl.halos.profiles.HaloProfile`): halo
            profile (corresponding to :math:`u_2` above. If `None`,
            `prof` will be used as `prof2`.
        prof3 (:class:`~pyccl.halos.profiles.HaloProfile`): halo
            profile (corresponding to :math:`v_1` above. If `None`,
            `prof` will be used as `prof3`.
        prof4 (:class:`~pyccl.halos.profiles.HaloProfile`): halo
            profile (corresponding to :math:`v_2` above. If `None`,
            `prof2` will be used as `prof4`.
        prof13_2pt (:class:`~pyccl.halos.profiles_2pt.Profile2pt`):
            a profile covariance object returning the the two-point
            moment of `prof` and `prof3`. If `None`, the default
            second moment will be used, corresponding to the
            products of the means of both profiles.
        prof14_2pt (:class:`~pyccl.halos.profiles_2pt.Profile2pt`):
            same as `prof14_2pt` for `prof` and `prof4`.
        prof24_2pt (:class:`~pyccl.halos.profiles_2pt.Profile2pt`):
            same as `prof14_2pt` for `prof2` and `prof4`.
        prof32_2pt (:class:`~pyccl.halos.profiles_2pt.Profile2pt`):
            same as `prof14_2pt` for `prof3` and `prof2`.
        p_of_k_a (:class:`~pyccl.pk2d.Pk2D`): a `Pk2D` object to
            be used as the linear matter power spectrum. If `None`, the power
            spectrum stored within `cosmo` will be used.
        separable_growth (bool): Indicates whether a separable
            growth function approximation can be used to calculate
            the isotropized power spectrum.

    Returns:
        float or array_like: integral values evaluated at each
        combination of `k` and `a`. The shape of the output will
        be `(N_a, N_k, N_k)` where `N_k` and `N_a` are the sizes of
        `k` and `a` respectively. The ordering is such that
        `output[ia, ik2, ik1] = T(k[ik1], k[ik2], a[ia])`
        If `k` or `a` are scalars, the corresponding dimension will
        be squeezed out on output.


 Computes the isotropized halo model 4-halo trispectrum for four
    profiles :math:`u_{1,2}`, :math:`v_{1,2}` as

    .. math::
        \\bar{T}^{4h}(k_1, k_2, a) = \\int \\frac{d\\varphi_1}{2\\pi}
        \\int \\frac{d\\varphi_2}{2\\pi}
        T^{4h}_{u_1,u_2;v_1,v_2}({\\bf k_1},-{\\bf k_1},
        {\\bf k_2},-{\\bf k_2}),

    with

    .. math::
        T^{4h}_{u_1,u_2;v_1,v_2}({\\bf k}_u,{\\bf k}_v,a) =
        T^{PT}({\\bf k}_u, -{\\bf k}_u, {\\bf k}_v, -{\\bf k}_v) \\,
        I^1_1(k_u | u_1) I^1_1(k_u | u_2) I^1_1(k_v | v_1)
        I^1_1(k_v | v_2) \\,

    where :math:`I^1_1` is defined in the documentation
    of :meth:`~pyccl.halos.halo_model.HMCalculator.I_1_1`, and
    the tree-level trispectrum :math:`T^{PT}` is calculated
    according to Eq. 30 of `Takada et al. 2013
    <https://arxiv.org/abs/1302.6994>`_

    Args:
        cosmo (:class:`~pyccl.core.Cosmology`): a Cosmology object.
        hmc (:class:`HMCalculator`): a halo model calculator.
        k (float or array_like): comoving wavenumber in Mpc^-1.
        a (float or array_like): scale factor.
        prof (:class:`~pyccl.halos.profiles.HaloProfile`): halo
            profile (corresponding to :math:`u_1` above.
        prof2 (:class:`~pyccl.halos.profiles.HaloProfile`): halo
            profile (corresponding to :math:`u_2` above. If `None`,
            `prof` will be used as `prof2`.
        prof3 (:class:`~pyccl.halos.profiles.HaloProfile`): halo
            profile (corresponding to :math:`v_1` above. If `None`,
            `prof` will be used as `prof3`.
        prof4 (:class:`~pyccl.halos.profiles.HaloProfile`): halo
            profile (corresponding to :math:`v_2` above. If `None`,
            `prof2` will be used as `prof4`.
        p_of_k_a (:class:`~pyccl.pk2d.Pk2D`): a `Pk2D` object to
            be used as the linear matter power spectrum. If `None`, the power
            spectrum stored within `cosmo` will be used.
        separable_growth (bool): Indicates whether a separable
            growth function approximation can be used to calculate
            the isotropized power spectrum.

    Returns:
        float or array_like: integral values evaluated at each
        combination of `k` and `a`. The shape of the output will
        be `(N_a, N_k, N_k)` where `N_k` and `N_a` are the sizes of
        `k` and `a` respectively. The ordering is such that
        `output[ia, ik2, ik1] = T(k[ik1], k[ik2], a[ia])`
        If `k` or `a` are scalars, the corresponding dimension will
        be squeezed out on output.