 Returns a :class:`~pyccl.tk3d.Tk3D` object containing the 2-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.core.Cosmology`): a Cosmology object.
        hmc (:class:`HMCalculator`): a halo model calculator.
        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 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.
        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`.
        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.
        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 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 (int): extrapolation order to be used on
            k-values below the minimum of the splines. See
            :class:`~pyccl.tk3d.Tk3D`.
        extrap_order_hik (int): extrapolation order to be used on
            k-values above the maximum of the splines. See
            :class:`~pyccl.tk3d.Tk3D`.
        use_log (bool): if `True`, the trispectrum will be
            interpolated in log-space (unless negative or
            zero values are found).
        separable_growth (bool): Indicates whether a separable
            growth function approximation can be used to calculate
            the isotropized power spectrum.

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


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

    Args:
        cosmo (:class:`~pyccl.core.Cosmology`): a Cosmology object.
        hmc (:class:`HMCalculator`): a halo model calculator.
        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`.
        lk_arr (array): an array holding values of the natural
            logarithm of the wavenumber (in units of Mpc^-1) at
            which the trispectrum should be calculated for
            interpolation. If `None`, the internal values used
            by `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.
        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.
        extrap_order_lok (int): extrapolation order to be used on
            k-values below the minimum of the splines. See
            :class:`~pyccl.tk3d.Tk3D`.
        extrap_order_hik (int): extrapolation order to be used on
            k-values above the maximum of the splines. See
            :class:`~pyccl.tk3d.Tk3D`.
        use_log (bool): if `True`, the trispectrum will be
            interpolated in log-space (unless negative or
            zero values are found).
        separable_growth (bool): Indicates whether a separable
            growth function approximation can be used to calculate
            the isotropized power spectrum.

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


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

    Args:
        cosmo (:class:`~pyccl.core.Cosmology`): a Cosmology object.
        hmc (:class:`HMCalculator`): a halo model calculator.
        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`.
        lk_arr (array): an array holding values of the natural
            logarithm of the wavenumber (in units of Mpc^-1) at
            which the trispectrum should be calculated for
            interpolation. If `None`, the internal values used
            by `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.
        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.
        extrap_order_lok (int): extrapolation order to be used on
            k-values below the minimum of the splines. See
            :class:`~pyccl.tk3d.Tk3D`.
        extrap_order_hik (int): extrapolation order to be used on
            k-values above the maximum of the splines. See
            :class:`~pyccl.tk3d.Tk3D`.
        use_log (bool): if `True`, the trispectrum will be
            interpolated in log-space (unless negative or
            zero values are found).
        separable_growth (bool): Indicates whether a separable
            growth function approximation can be used to calculate
            the isotropized power spectrum.

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


 Returns a :class:`~pyccl.tk3d.Tk3D` object containing the non-Gaussian
    covariance trispectrum for four quantities defined by their respective halo
    profiles. This is the sum of the trispectrum terms 1h + 2h + 3h + 4h.

    Args:
        cosmo (:class:`~pyccl.core.Cosmology`): a Cosmology object.
        hmc (:class:`HMCalculator`): a halo model calculator.
        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 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.
        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 `prof12_2pt` for `prof` and `prof4`.
        prof24_2pt (:class:`~pyccl.halos.profiles_2pt.Profile2pt`):
            same as `prof12_2pt` for `prof2` and `prof4`.
        prof32_2pt (:class:`~pyccl.halos.profiles_2pt.Profile2pt`):
            same as `prof12_2pt` for `prof3` and `prof2`.
        prof34_2pt (:class:`~pyccl.halos.profiles_2pt.Profile2pt`):
            same as `prof12_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.
        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 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 (int): extrapolation order to be used on
            k-values below the minimum of the splines. See
            :class:`~pyccl.tk3d.Tk3D`.
        extrap_order_hik (int): extrapolation order to be used on
            k-values above the maximum of the splines. See
            :class:`~pyccl.tk3d.Tk3D`.
        use_log (bool): if `True`, the trispectrum will be
            interpolated in log-space (unless negative or
            zero values are found).
        separable_growth (bool): Indicates whether a separable
            growth function approximation can be used to calculate
            the isotropized power spectrum.

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


 Returns Lagrangian radius for a halo of mass :math:`M`.
    The Lagrangian radius is defined as that enclosing
    the mass of the halo assuming a homogeneous Universe.

    .. math::
        R = \\left(\\frac{3\\,M}{4\\pi\\,\\rho_{M,0}}\\right)^{1/3}

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): A Cosmology object.
        M (:obj:`float` or `array`): halo mass in units of :math:`M_\\odot`.

    Returns:
        (:obj:`float` or `array`): Lagrangian radius in comoving Mpc.


 Computes the concentration parameter for a different mass definition.
    This is done assuming an NFW profile. The output concentration ``c_new`` is
    found by solving the equation:

    .. math::
        f(c_{\\rm old}) \\Delta_{\\rm old} = f(c_{\\rm new}) \\Delta_{\\rm new}

    where

    .. math::
        f(x) = \\frac{x^3}{\\log(1+x) - x/(1+x)}.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): A Cosmology object.
        c_old (:obj:`float` or `array`): concentration to translate from.
        Delta_old (:obj:`float`): Delta parameter associated to the input
            concentration. See description of the :class:`MassDef` class.
        Delta_new (:obj:`float`): Delta parameter associated to the output
            concentration.

    Returns:
        (:obj:`float` or `array`): concentration parameter for the new
        mass definition.


Give a name to this mass definition.


 For SO-based mass definitions, this returns the corresponding
        value of Delta for a rho_matter-based definition.


 Return mass definition subclass from name string.

        Args:
            name (:obj:`str`):
                a mass definition name (e.g. ``'200m'`` for
                :math:`\\Delta=200` times the matter density).

        Returns:
            :class:`MassDef` instance corresponding to the input name.


Instantiate mass definition and halo model ingredients.

        Unspecified halo model ingredients are ignored. ``mass_def`` is always
        instantiated.

        Args:
            mass_def (:obj:`MassDef`, :obj:`str` or :obj:`None`):
                Mass definition. If a string, instantiate from its name.
                If `None`, obtain the one from the first specified halo model
                ingredient.
            mass_function (:class:`~pyccl.halos.halo_model_base.MassFunc` or :obj:`str`):
                Mass function subclass. Strings are auto-instantiated using
                ``mass_def``. ``None`` values are ignored.
            halo_bias (:class:`~pyccl.halos.halo_model_base.HaloBias` or :obj:`str`):
                Halo bias subclass. Strings are auto-instantiated using
                ``mass_def``. ``None`` values are ignored.
            concentration (:class:`~pyccl.halos.halo_model_base.Concentration` or :obj:`str`):
                Concentration subclass. Strings are auto-instantiated using
                ``mass_def``. ``None`` values are ignored.

        Returns:
            Tuple of up to 4 elements.

            - mass_def : :class:`MassDef`
            - mass_function : :class:`~pyccl.halos.halo_model_base.MassFunc`, if specified
            - halo_bias : :class:`~pyccl.halos.halo_model_base.HaloBias`, if specified
            - concentration : :class:`~pyccl.halos.halo_model_base.Concentration`, if specified


Translate between mass definitions, assuming an NFW profile.

    Returns a function that can be used to translate between halo
    masses according to two different definitions.

    Args:
        mass_in (:class:`MassDef` or :obj:`str`): mass definition of the
            input mass.
        mass_out (:class:`MassDef` or :obj:`str`): mass definition of the
            output mass.
        concentration (:class:`~pyccl.halos.halo_model_base.Concentration` or :obj:`str`):
            concentration-mass relation to use for the mass conversion. It must
            be calibrated for masses using the ``mass_in`` definition.

    Returns:
        Function that ranslates between two masses. The returned function
        ``f`` can be called as: ``f(cosmo, M, a)``, where
        ``cosmo`` is a :class:`~pyccl.cosmology.Cosmology` object, ``M``
        is a mass (or array of masses), and ``a`` is a scale factor.


 Update any of the parameters associated with this 1-halo
        2-point correlator. Any parameter set to ``None`` won't be updated.


 Return the Fourier-space two-point moment between
        two profiles.

        .. math::
           (1+\\rho_{u_1,u_2})\\langle u_1(k)\\rangle\\langle u_2(k) \\rangle

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`):
                a Cosmology object.
            k (:obj:`float` or `array`):
                comoving wavenumber in Mpc^-1.
            M (:obj:`float` or `array`):
                halo mass in units of M_sun.
            a (:obj:`float`):
                scale factor.
            prof (:class:`~pyccl.halos.profiles.HaloProfile`):
                halo profile for which the second-order moment
                is desired.
            prof2 (:class:`~pyccl.halos.profiles.HaloProfile`):
                second halo profile for which the second-order moment
                is desired. If ``None``, the assumption is that you want
                an auto-correlation, and `prof` will be used as `prof2`.
            diag (bool): If True, both halo profiles depend on the same k. If
            False, they will depend on k and k', respectively. The output
            dimension will change to `(N_M, N_k, N_k)`.Default True.

        Returns:
            (:obj:`float` or `array`): second-order Fourier-space
            moment. The shape of the output will be `(N_M, N_k)`
            where `N_k` and `N_m` are the sizes of `k` and `M`
            respectively, if diag is True. If False, the array will have
            dimension `(N_M, N_k, N_k)`, with k' corresponding to the second
            axis of the array.. If `k` or `M` are scalars, the
            corresponding dimension will be squeezed out on output.


 Returns the Fourier-space two-point moment for the HOD
        profile.

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
            k (:obj:`float` or `array`): comoving wavenumber in Mpc^-1.
            M (:obj:`float` or `array`): halo mass in units of M_sun.
            a (:obj:`float`): scale factor.
            prof (:class:`~pyccl.halos.profiles.hod.HaloProfileHOD`):
                halo profile for which the second-order moment
                is desired.
            prof2 (:class:`~pyccl.halos.profiles.hod.HaloProfileHOD` or :obj:`None`):
                second halo profile for which the second-order moment
                is desired. If ``None``, the assumption is that you want
                an auto-correlation. If the profiles are different we assume disjoint
                tracers and revert back to the usual Fourier-space two-point moment
                (see Profile2pt).
            diag (bool): If True, both halo profiles depend on the same k. If
                False, they will depend on k and k', respectively and we will
                approximate <uk uk'> to <uk><uk'>. The output dimension will
                change to `(N_M, N_k, N_k)`. Default True.

        Returns:
            (:obj:`float` or `array`): second-order Fourier-space
            moment. The shape of the output will be `(N_M, N_k)`
            where `N_k` and `N_m` are the sizes of `k` and `M`
            respectively, if diag is True. If False, the array will have
            dimension `(N_M, N_k, N_k)`, with k' corresponding to the second
            axis of the array.. If `k` or `M` are scalars, the
            corresponding dimension will be squeezed out on output.


 Returns the Fourier-space two-point moment for the CIB
        profile.

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
            k (:obj:`float` or `array`): comoving wavenumber in Mpc^-1.
            M (:obj:`float` or `array`): halo mass in units of M_sun.
            a (:obj:`float`): scale factor.
            prof (:class:`~pyccl.halos.profiles.cib_shang12.HaloProfileCIBShang12`):
                halo profile for which the second-order moment
                is desired.
            prof2 (:class:`~pyccl.halos.profiles.cib_shang12.HaloProfileCIBShang12`):
                second halo profile for which the second-order moment
                is desired. If ``None``, the assumption is that you want
                an auto-correlation. Note that only auto-correlations
                are allowed in this case.
            diag (bool): If True, both halo profiles depend on the same k. If
                False, they will depend on k and k', respectively and we will
                approximate <uk uk'> to <uk><uk'>. The output dimension will
                change to `(N_M, N_k, N_k)`. Default True.

        Returns:
            (:obj:`float` or `array`): second-order Fourier-space
            moment. The shape of the output will be `(N_M, N_k)`
            where `N_k` and `N_m` are the sizes of `k` and `M`
            respectively, if diag is True. If False, the array will have
            dimension `(N_M, N_k, N_k)`, with k' corresponding to the second
            axis of the array. If `k` or `M` are scalars, the
            corresponding dimension will be squeezed out on output.


    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
        hmc (:class:`~pyccl.halos.halo_model.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.

    Returns:
        (:obj:`float` or `array`): integral values evaluated at each
        combination of ``k`` and ``a``. The shape of the output will
        be ``(N_a, N_k)`` where ``N_k`` and ``N_a`` are the sizes of
        ``k`` and ``a`` respectively. If ``k`` or ``a`` are scalars, the
        corresponding dimension will be squeezed out on output.


 Returns the mass-weighted mean halo profile.

    .. math::
        I^0_1(k,a|u) = \\int dM\\,n(M,a)\\,\\langle u(k,a|M)\\rangle,

    where :math:`n(M,a)` is the halo mass function, and
    :math:`\\langle u(k,a|M)\\rangle` is the halo profile as a
    function of scale, scale factor and halo mass.


 Returns the mass-and-bias-weighted mean halo profile.

    .. math::
        I^1_1(k,a|u) = \\int dM\\,n(M,a)\\,b(M,a)\\,
        \\langle u(k,a|M)\\rangle,

    where :math:`n(M,a)` is the halo mass function,
    :math:`b(M,a)` is the halo bias, and
    :math:`\\langle u(k,a|M)\\rangle` is the halo profile as a
    function of scale, scale factor and halo mass.


Property that dictates whether ``mass_def_strict`` can be set
        as False on initialization.

        Some models are set up in a way so that the set of fitted parameters
        depends on the mass definition, (i.e. no one universal model exists
        to cover all cases). Setting this to True fixes ``mass_def_strict``
        to True irrespective of what the user passes.

        Set this propery to False to allow users to override strict checks.


 Use this function to initialize any internal attributes
        of this object. This function is called at the very end of the
        constructor call.


 Return False if the input mass definition agrees with
        the definitions for which this mass function parametrization
        works. True otherwise. This function gets called at the
        start of the constructor call.

        Args:
            mass_def (:class:`~pyccl.halos.massdef.MassDef`):
                a mass definition object.


Compute ``logM``, ``sigM``, and (optionally) ``dlns_dlogM``.


 Get the :math:`f(\\sigma_M)` function for this mass function
        object (see description of this class for details).

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): A Cosmology object.
            sigM (:obj:`float` or `array`): standard deviation in the
                overdensity field on the scale of this halo.
            a (:obj:`float`): scale factor.
            lnM (:obj:`float` or `array`): natural logarithm of the
                halo mass in units of M_sun (provided in addition
                to sigM for convenience in some mass function
                parametrizations).

        Returns:
            (:obj:`float` or `array`): :math:`f(\\sigma_M)` function.


 Get the halo bias as a function of sigmaM.

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): A Cosmology object.
            sigM (:obj:`float` or `array`): standard deviation in the
                overdensity field on the scale of this halo.
            a (:obj:`float`): scale factor.

        Returns:
            (:obj:`float` or `array`): f(sigma_M) function.


 Computes the halo model power spectrum for two
    quantities defined by their respective halo profiles.
    The halo model power spectrum for two profiles
    :math:`u` and :math:`v` is:

    .. math::
        P_{u,v}(k,a) = I^0_2(k,a|u,v) +
        I^1_1(k,a|u)\\,I^1_1(k,a|v)\\,P_{\\rm lin}(k,a)

    where :math:`P_{\\rm lin}(k,a)` is the linear matter
    power spectrum, :math:`I^1_1` is defined in the documentation
    of :meth:`~pyccl.halos.halo_model.HMCalculator.I_1_1`, and :math:`I^0_2`
    is defined in the documentation of
    :meth:`~pyccl.halos.halo_model.HMCalculator.I_0_2`.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
        hmc (:class:`~pyccl.halos.halo_model.HMCalculator`): a halo model calculator.
        k (:obj:`float` or `array`): comoving wavenumber in Mpc^-1.
        a (:obj:`float` or `array`): scale factor.
        prof (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`): halo
            profile.
        prof2 (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`): a
            second halo profile. If ``None``, ``prof`` will be used as
            ``prof2``.
        prof_2pt (:class:`~pyccl.halos.profiles_2pt.Profile2pt`):
            a profile covariance object
            returning the the two-point moment of the two profiles
            being correlated. If ``None``, the default second moment
            will be used, corresponding to the products of the means
            of both profiles.
        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.
        get_1h (:obj:`bool`): if ``False``, the 1-halo term (i.e. the first
            term in the first equation above) won't be computed.
        get_2h (:obj:`bool`): if ``False``, the 2-halo term (i.e. the second
            term in the first equation above) won't be computed.
        smooth_transition (:obj:`callable` or :obj:`None`):
            Modify the halo model 1-halo/2-halo transition region
            via a time-dependent function :math:`\\alpha(a)`,
            defined as in `HMCODE-2020 <https://arxiv.org/abs/2009.01858>`_:
            :math:`P(k,a)=
            (P_{1h}^{\\alpha(a)}(k)+P_{2h}^{\\alpha(a)}(k))^{1/\\alpha}`.
            If ``None`` the extra factor is just 1.
        suppress_1h (:obj:`callable` or :obj:`None`):
            Suppress the 1-halo large scale contribution by a
            time- and scale-dependent function :math:`k_*(a)`,
            defined as in `HMCODE-2020 <https://arxiv.org/abs/2009.01858>`_:
            :math:`1/[1+(k_*(a)/k)^4]`.
            If ``None`` the standard 1-halo term is returned with no damping.
        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.

    Returns:
        (:obj:`float` or `array`): integral values evaluated at each
        combination of ``k`` and ``a``. The shape of the output will
        be ``(N_a, N_k)`` where ``N_k`` and ``N_a`` are the sizes of
        ``k`` and ``a`` respectively. If ``k`` or ``a`` are scalars, the
        corresponding dimension will be squeezed out on output.


 Returns a :class:`~pyccl.pk2d.Pk2D` object containing
    the halo-model power spectrum for two quantities defined by
    their respective halo profiles. See :meth:`halomod_power_spectrum`
    for more details about the actual calculation.

    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`): a
            second halo profile. If ``None``, ``prof`` will be used as
            ``prof2``.
        prof_2pt (:class:`~pyccl.halos.profiles_2pt.Profile2pt`):
            a profile covariance object
            returning the the two-point moment of the two profiles
            being correlated. If ``None``, the default second moment
            will be used, corresponding to the products of the means
            of both profiles.
        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.
        get_1h (:obj:`bool`): if ``False``, the 1-halo term (i.e. the first
            term in the first equation above) won't be computed.
        get_2h (:obj:`bool`): if ``False``, the 2-halo term (i.e. the second
            term in the first equation above) won't be computed.
        a_arr (array): an array holding values of the scale factor
            at which the halo model power spectrum 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 Mpc^-1) at
            which the halo model power spectrum 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.pk2d.Pk2D`.
        extrap_order_hik (:obj:`int`): extrapolation order to be used on
            k-values above the maximum of the splines. See
            :class:`~pyccl.pk2d.Pk2D`.
        smooth_transition (:obj:`callable` or :obj:`None`):
            Modify the halo model 1-halo/2-halo transition region
            via a time-dependent function :math:`\\alpha(a)`,
            defined as in `HMCODE-2020 <https://arxiv.org/abs/2009.01858>`_:
            :math:`P(k,a)= (P_{1h}^{\\alpha(a)}(k)+P_{2h}^{\\alpha(a)}(k))^{1/\\alpha}`.
            If ``None`` the extra factor is just 1.
        suppress_1h (:obj:`callable` or :obj:`None`):
            Suppress the 1-halo large scale contribution by a
            time- and scale-dependent function :math:`k_*(a)`,
            defined as in `HMCODE-2020 <https://arxiv.org/abs/2009.01858>`_:
            :math:`1/[1+(k_*(a)/k)^4]`.
            If ``None`` the standard 1-halo term is returned with no damping.
        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.

    Returns:
        :class:`~pyccl.pk2d.Pk2D`: halo model power spectrum.


Compute mass function and halo bias at some scale factor.


 Returns the integral over mass of a given funcion times
        the mass function:

        .. math::
            \\int dM\\,n(M,a)\\,f(M)

        Args:
            func (:obj:`callable`): a function accepting an array of halo masses
                as a single argument, and returning an array of the
                same size.
            cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
            a (:obj:`float`): scale factor.

        Returns:
            :obj:`float`: integral value.


 Solves the integral:

        .. math::
            nc(sel) = \\int dM\\int da\\,\\frac{dV}{dad\\Omega}\\,
            n(M,a)\\,sel(M,a)

        where :math:`n(M,a)` is the halo mass function, and
        :math:`sel(M,a)` is the selection function as a function of halo mass
        and scale factor.

        Note that the selection function is normalized to integrate to unity
        and assumed to represent the selection probaility per unit scale factor
        and per unit mass.

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
            selection (:obj:`callable`): function of mass and scale factor
                that returns the selection function. This function
                should take in floats or arrays with a signature ``sel(m, a)``
                and return an array with shape ``(len(m), len(a))`` according
                to the numpy broadcasting rules.
            a_min (:obj:`float`): the minimum scale factor at which to start integrals
                over the selection function.
                Default: value of ``cosmo.cosmo.spline_params.A_SPLINE_MIN``
            a_max (:obj:`float`): the maximum scale factor at which to end integrals
                over the selection function.
            na (:obj:`int`): number of samples in scale factor to be used in
                the integrals.

        Returns:
            :obj:`float`: the total number of clusters/halos.


 Solves the integral:

        .. math::
            I^0_1(k,a|u) = \\int dM\\,n(M,a)\\,\\langle u(k,a|M)\\rangle,

        where :math:`n(M,a)` is the halo mass function, and
        :math:`\\langle u(k,a|M)\\rangle` is the halo profile as a
        function of scale, scale factor and halo mass.

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
            k (:obj:`float` or `array`): comoving wavenumber.
            a (:obj:`float`): scale factor.
            prof (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`):
                halo profile.

        Returns:
            (:obj:`float` or `array`): integral values evaluated at each
            value of ``k``.


 Solves the integral:

        .. math::
            I^1_1(k,a|u) = \\int dM\\,n(M,a)\\,b(M,a)\\,
            \\langle u(k,a|M)\\rangle,

        where :math:`n(M,a)` is the halo mass function,
        :math:`b(M,a)` is the halo bias, and
        :math:`\\langle u(k,a|M)\\rangle` is the halo profile as a
        function of scale, scale factor and halo mass.

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
            k (:obj:`float` or `array`): comoving wavenumber.
            a (:obj:`float`): scale factor.
            prof (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`):
                halo profile.

        Returns:
            (:obj:`float` or `array`): integral values evaluated at each
            value of ``k``.


 Solves the integral:

        .. math::
            I^1_3(k,a|u_2, v_1, v_2) = \\int dM\\,n(M,a)\\,b(M,a)\\,
            \\langle u_2(k,a|M) v_1(k',a|M) v_2(k',a|M)\\rangle,

        where we approximate

        .. math::
            \\langle u_2(k,a|M) v_1(k',a|M) v_2(k', a|M)\\rangle \\sim
            \\langle u_2(k,a|M)\\rangle
            \\langle v_1(k',a|M) v_2(k', a|M)\\rangle,

        where :math:`n(M,a)` is the halo mass function,
        :math:`b(M,a)` is the halo bias, and
        :math:`\\langle u_2(k,a|M) v_1(k',a|M) v_2(k',a|M)\\rangle` is the
        3pt halo profile as a function of scales `k` and `k'`, scale factor
        and halo mass.

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
            k (:obj:`float` or `array`): comoving wavenumber.
            a (:obj:`float`): scale factor.
            prof (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`):
                halo profile.

        Returns:
            (:obj:`float` or `array`): integral values evaluated at each
            value of ``k``. Its shape will be ``(N_k, N_k)``, with ``N_k`` the
            size of the ``k`` array.


 Solves the integral:

        .. math::
            I^0_2(k,a|u,v) = \\int dM\\,n(M,a)\\,
            \\langle u(k,a|M) v(k,a|M)\\rangle,

        where :math:`n(M,a)` is the halo mass function, and
        :math:`\\langle u(k,a|M) v(k,a|M)\\rangle` is the two-point
        moment of the two halo profiles.

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
            k (:obj:`float` or `array`): comoving wavenumber.
            a (:obj:`float`): scale factor.
            prof (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`):
                halo profile.
            prof2 (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`): a
                second halo profile. If ``None``, ``prof`` will be used as
                ``prof2``.
            prof_2pt (:class:`~pyccl.halos.profiles_2pt.Profile2pt`):
                a profile covariance object
                returning the the two-point moment of the two profiles
                being correlated.

        Returns:
             (:obj:`float` or `array`): integral values evaluated at each
             value of ``k``.


 Solves the integral:

        .. math::
            I^1_2(k,a|u,v) = \\int dM\\,n(M,a)\\,b(M,a)\\,
            \\langle u(k,a|M) v(k,a|M)\\rangle,

        where :math:`n(M,a)` is the halo mass function,
        :math:`b(M,a)` is the halo bias, and
        :math:`\\langle u(k,a|M) v(k,a|M)\\rangle` is the two-point
        moment of the two halo profiles.

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
            k (:obj:`float` or `array`): comoving wavenumber.
            a (:obj:`float`): scale factor.
            prof (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`):
                halo profile.
            prof2 (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`): a
                second halo profile. If ``None``, ``prof`` will be used as
                ``prof2``.
            prof_2pt (:class:`~pyccl.halos.profiles_2pt.Profile2pt`):
                a profile covariance object
                returning the the two-point moment of the two profiles
                being correlated.
            diag (bool): If True, both halo profiles depend on the same k. If
                False, they will depend on k and k', respectively. Default
                True.

        Returns:
             (:obj:`float` or `array`): integral values evaluated at each
             value of ``k``. If `diag` is True, the output will be a 1D-array;
             2D-array, otherwise.


 Solves the integral:

        .. math::
            I^0_{2,2}(k_u,k_v,a|u_{1,2},v_{1,2}) =
            \\int dM\\,n(M,a)\\,
            \\langle u_1(k_u,a|M) u_2(k_u,a|M)\\rangle
            \\langle v_1(k_v,a|M) v_2(k_v,a|M)\\rangle,

        where :math:`n(M,a)` is the halo mass function, and
        :math:`\\langle u(k,a|M) v(k,a|M)\\rangle` is the
        two-point moment of the two halo profiles.

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
            k (:obj:`float` or `array`): comoving wavenumber.
            a (:obj:`float`): scale factor.
            prof (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`):
                halo profile.
            prof2 (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`): a
                second halo profile. If ``None``, ``prof`` will be used as
                ``prof2``.
            prof3 (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`): a
                third halo profile. If ``None``, ``prof`` will be used as
                ``prof3``.
            prof4 (:class:`~pyccl.halos.profiles.profile_base.HaloProfile`): a
                fourth 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``.
            prof34_2pt (:class:`~pyccl.halos.profiles_2pt.Profile2pt`):
                a profile covariance object returning the the
                two-point moment of ``prof3`` and ``prof4``. If ``None``,
                ``prof12_2pt`` will be used.

        Returns:
             (:obj:`float` or `array`): integral values evaluated at each
             value of ``k``.


Update any of the parameters associated with this profile.
        Any parameter set to ``None`` won't be updated.

        .. note::

            A change in ``alpha``, ``beta``, ``gamma``, ``c500``, or ``x_out``
            recomputes the Fourier-space template, which may be slow.

        Args:
            mass_bias (:obj:`float`):
                The mass bias parameter :math:`1-b`.
            P0 (:obj:`float`):
                Profile normalization.
            c500 (:obj:`float`):
                Concentration parameter.
            alpha, beta, gamma (:obj:`float`):
                Profile shape parameters.
            alpha_P (:obj:`float`):
                Additional mass dependence exponent
            P0_hexp (:obj:`float`):
                Power of :math:`h` with which the normalization parameter
                scales. Equal to :math:`-1` for SZ-based normalizations,
                and :math:`-3/2` for X-ray-based normalizations.
            x_out (:obj:`float`):
                Profile threshold, in units of :math:`r_{\\mathrm{500c}}`.
                Defaults to :math:`+\\infty`.


 Update any of the parameters associated with
        this profile. Any parameter set to ``None`` won't be updated.

        Args:
            log10Mmin_0 (:obj:`float`): offset parameter for
                :math:`\\log_{10}M_{\\rm min}`.
            log10Mmin_p (:obj:`float`): tilt parameter for
                :math:`\\log_{10}M_{\\rm min}`.
            siglnM_0 (:obj:`float`): offset parameter for
                :math:`\\sigma_{{\\rm ln}M}`.
            siglnM_p (:obj:`float`): tilt parameter for
                :math:`\\sigma_{{\\rm ln}M}`.
            log10M0_0 (:obj:`float`): offset parameter for
                :math:`\\log_{10}M_0`.
            log10M0_p (:obj:`float`): tilt parameter for
                :math:`\\log_{10}M_0`.
            log10M1_0 (:obj:`float`): offset parameter for
                :math:`\\log_{10}M_1`.
            log10M1_p (:obj:`float`): tilt parameter for
                :math:`\\log_{10}M_1`.
            alpha_0 (:obj:`float`): offset parameter for
                :math:`\\alpha`.
            alpha_p (:obj:`float`): tilt parameter for
                :math:`\\alpha`.
            fc_0 (:obj:`float`): offset parameter for
                :math:`f_c`.
            fc_p (:obj:`float`): tilt parameter for
                :math:`f_c`.
            bg_0 (:obj:`float`): offset parameter for
                :math:`\\beta_g`.
            bg_p (:obj:`float`): tilt parameter for
                :math:`\\beta_g`.
            bmax_0 (:obj:`float`): offset parameter for
                :math:`\\beta_{\\rm max}`.
            bmax_p (:obj:`float`): tilt parameter for
                :math:`\\beta_{\\rm max}`.
            a_pivot (:obj:`float`): pivot scale factor :math:`a_*`.
            ns_independent (:obj:`bool`): drop requirement to only form
                satellites when centrals are present


If ``True``, this profile represents source-count overdensities,
        normalised by the mean number density within their survey window
        function. This must be propagated when estimated super-sample
        effects in the covariance matrix.


 This controls the value of `plaw_fourier` to be used
        as a function of cosmology and scale factor.

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
            a (:obj:`float`): scale factor.

        Returns:
            float: power law index to be used with FFTLog.


 This controls the value of `plaw_projected` to be
        used as a function of cosmology and scale factor.

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
            a (:obj:`float`): scale factor.

        Returns:
            float: power law index to be used with FFTLog.


        real(cosmo, r, M, a)
        Returns the 3D real-space value of the profile as a
        function of cosmology, radius, halo mass and scale factor.

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
            r (:obj:`float` or `array`): comoving radius in Mpc.
            M (:obj:`float` or `array`): halo mass in units of M_sun.
            a (:obj:`float`): scale factor.

        Returns:
            (:obj:`float` or `array`): halo profile. The shape of the
            output will be `(N_M, N_r)` where `N_r` and `N_m` are
            the sizes of `r` and `M` respectively. If `r` or `M`
            are scalars, the corresponding dimension will be
            squeezed out on output.


        fourier(cosmo, k, M, a)
        Returns the Fourier-space value of the profile as a
        function of cosmology, wavenumber, halo mass and
        scale factor.

        .. math::
           \\rho(k)=\\frac{1}{2\\pi^2} \\int dr\\, r^2\\,
           \\rho(r)\\, j_0(k r)

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
            k (:obj:`float` or `array`): comoving wavenumber (in :math:`Mpc^{-1}`).
            M (:obj:`float` or `array`): halo mass.
            a (:obj:`float`): scale factor.

        Returns:
            (:obj:`float` or `array`): Fourier-space profile. The shape of the
            output will be ``(N_M, N_k)`` where ``N_k`` and ``N_m`` are
            the sizes of ``k`` and ``M`` respectively. If ``k`` or ``M``
            are scalars, the corresponding dimension will be
            squeezed out on output.


        projected(cosmo, r_t, M, a)
        Returns the 2D projected profile as a function of
        cosmology, radius, halo mass and scale factor.

        .. math::
           \\Sigma(R)= \\int dr_\\parallel\\,
           \\rho(\\sqrt{r_\\parallel^2 + R^2})

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
            r_t (:obj:`float` or `array`): transverse comoving radius in Mpc.
            M (:obj:`float` or `array`): halo mass in units of M_sun.
            a (:obj:`float`): scale factor.

        Returns:
            (:obj:`float` or `array`): projected profile. The shape of the
            output will be `(N_M, N_r)` where `N_r` and `N_m` are
            the sizes of `r` and `M` respectively. If `r` or `M`
            are scalars, the corresponding dimension will be
            squeezed out on output.


        cumul2d(cosmo, r_t, M, a)
        Returns the 2D cumulative surface density as a
        function of cosmology, radius, halo mass and scale
        factor.

        .. math::
           \\Sigma(<R)= \\frac{2}{R^2} \\int dR'\\, R'\\,
           \\Sigma(R')

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): a Cosmology object.
            r_t (:obj:`float` or `array`): transverse comoving radius in Mpc.
            M (:obj:`float` or `array`): halo mass in units of M_sun.
            a (:obj:`float`): scale factor.

        Returns:
            (:obj:`float` or `array`): cumulative surface density. The shape of the
            output will be ``(N_M, N_r)`` where ``N_r`` and ``N_m`` are
            the sizes of ``r`` and ``M`` respectively. If ``r`` or ``M``
            are scalars, the corresponding dimension will be
            squeezed out on output.


        convergence(cosmo, r, M, *, a_lens, a_source)
        Returns the convergence as a function of cosmology,
        radius, halo mass and the scale factors of the source
        and the lens.

        .. math::
           \\kappa(R) = \\frac{\\Sigma(R)}{\\Sigma_{\\rm crit}},

        where :math:`\\Sigma(R)` is the 2D projected surface mass density
        (see :meth:`projected`), and :math:`\\Sigma_{\\rm crit}` is
        the critical surface density (see
        :meth:`~pyccl.background.sigma_critical`).

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): A Cosmology object.
            r (:obj:`float` or `array`): comoving radius.
            M (:obj:`float` or `array`): halo mass.
            a_lens (:obj:`float`): scale factor of lens.
            a_source (:obj:`float` or `array`): scale factor of source.
                If an array, it must have the same shape as ``r``.

        Returns:
            (:obj:`float` or `array`): convergence :math:`\\kappa`. The
            shape of the output will be ``(N_M, N_r)`` where ``N_r`` and
            ``N_m`` are the sizes of ``r`` and ``M`` respectively. If
            ``r`` or ``M`` are scalars, the corresponding dimension will
            be squeezed out on output.


        shear(cosmo, r, M, *, a_lens, a_source)
        Returns the shear (tangential) as a function of cosmology,
        radius, halo mass and the scale factors of the
        source and the lens.

        .. math::
           \\gamma(R) = \\frac{\\Delta\\Sigma(R)}{\\Sigma_{\\mathrm{crit}}} =
           \\frac{\\overline{\\Sigma}(< R) -
           \\Sigma(R)}{\\Sigma_{\\mathrm{crit}}},

        where :math:`\\overline{\\Sigma}(< R)` is cumulative surface density
        (see :meth:`cumul2d`), :math:`\\Sigma(R)` is the projected 2D density
        (see :meth:`projected`), and :math:`\\Sigma_{\\rm crit}` is the
        critical surface density (see
        :meth:`~pyccl.background.sigma_critical`).

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): A Cosmology object.
            r (:obj:`float` or `array`): comoving radius in Mpc.
            M (:obj:`float` or `array`): halo mass in units of M_sun.
            a_lens (:obj:`float`): scale factor of lens.
            a_source (:obj:`float` or `array`): source's scale factor.
                If array, it must have the same shape as `r`.

        Returns:
            (:obj:`float` or `array`): shear :math:`\\gamma`. The shape of the
            output will be ``(N_M, N_r)`` where ``N_r`` and ``N_m`` are
            the sizes of ``r`` and ``M`` respectively. If ``r`` or ``M``
            are scalars, the corresponding dimension will be
            squeezed out on output.


        reduced_shear(cosmo, r, M, *, a_lens, a_source)
        Returns the reduced shear as a function of cosmology,
        radius, halo mass and the scale factors of the
        source and the lens.

        .. math::
           g_t (R) = \\frac{\\gamma(R)}{(1 - \\kappa(R))},

        where :math:`\\gamma(R)` is the shear and :math:`\\kappa(R)` is the
        convergence.

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): A Cosmology object.
            r (:obj:`float` or `array`): comoving radius in Mpc.
            M (:obj:`float` or `array`): halo mass in units of M_sun.
            a_lens (:obj:`float`): scale factor of lens.
            a_source (:obj:`float` or `array`): source's scale factor.
                If array, it must have the same shape as `r`.

        Returns:
            (:obj:`float` or `array`): reduced shear :math:`g_t`. The shape
            of the output will be ``(N_M, N_r)`` where ``N_r`` and ``N_m``
            are the sizes of ``r`` and ``M`` respectively. If ``r`` or
            ``M`` are scalars, the corresponding dimension will be
            squeezed out on output.


        magnification(cosmo, r, M, a_lens, a_source)
        Returns the magnification for input parameters.

        .. math::
           \\mu(R) = \\frac{1}{\\left[(1 - \\kappa(R))^2 -
           \\vert \\gamma(R) \\vert^2 \\right]]},

        where :math:`\\gamma(R)` is the shear and :math:`\\kappa(R)` is the
        convergence (see :meth:`shear` and :meth:`convergence`).

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`): A Cosmology object.
            r (:obj:`float` or `array`): comoving radius in Mpc.
            M (:obj:`float` or `array`): halo mass in units of M_sun.
            a_lens (:obj:`float`): scale factor of lens.
            a_source (:obj:`float` or `array`): source's scale factor.
                If array, it must have the same shape as `r`.

        Returns:
            (:obj:`float` or `array`): magnification :math:`\\mu`. The shape
            of the output will be ``(N_M, N_r)`` where ``N_r`` and ``N_m``
            are the sizes of ``r`` and ``M`` respectively. If ``r`` or ``M``
            are scalars, the corresponding dimension will be
            squeezed out on output.


 Update any of the parameters associated with
        this profile. Any parameter set to `None` won't be updated.

        Args:
            a1h (:obj:`float`): Amplitude of the satellite intrinsic shear profile.
            b (:obj:`float`): Power-law index of the satellite intrinsic shear
                profile. If zero, the profile is assumed to be constant inside
                the halo.
            lmax (:obj:`int`): Maximum multipole to be summed in the plane-wave
                expansion.
            log10Mmin_0 (:obj:`float`): offset parameter for
                :math:`\\log_{10}M_{\\rm min}`.
            log10Mmin_p (:obj:`float`): tilt parameter for
                :math:`\\log_{10}M_{\\rm min}`.
            siglnM_0 (:obj:`float`): offset parameter for
                :math:`\\sigma_{{\\rm ln}M}`.
            siglnM_p (:obj:`float`): tilt parameter for
                :math:`\\sigma_{{\\rm ln}M}`.
            log10M0_0 (:obj:`float`): offset parameter for
                :math:`\\log_{10}M_0`.
            log10M0_p (:obj:`float`): tilt parameter for
                :math:`\\log_{10}M_0`.
            log10M1_0 (:obj:`float`): offset parameter for
                :math:`\\log_{10}M_1`.
            log10M1_p (:obj:`float`): tilt parameter for
                :math:`\\log_{10}M_1`.
            alpha_0 (:obj:`float`): offset parameter for
                :math:`\\alpha`.
            alpha_p (:obj:`float`): tilt parameter for
                :math:`\\alpha`.
            bg_0 (:obj:`float`): offset parameter for
                :math:`\\beta_g`.
            bg_p (:obj:`float`): tilt parameter for
                :math:`\\beta_g`.
            bmax_0 (:obj:`float`): offset parameter for
                :math:`\\beta_{\\rm max}`.
            bmax_p (:obj:`float`): tilt parameter for
                :math:`\\beta_{\\rm max}`.
            a_pivot (:obj:`float`): pivot scale factor :math:`a_*`.
            ns_independent (:obj:`bool`): drop requirement to only form
                satellites when centrals are present
            rmin (:obj:`float`): For `simpson` or `spline` integration, minimum value of
                physical radius used to carry out the radial integral (in Mpc).
            N_r (:obj:`int`): For `simpson` or `spline` integration, number of points to be
                used when sampling the radial integral (in logarithmic space).
            N_jn (:obj:`int`): For `simpson` or `spline` integration, number of points to
                be used when sampling the spherical Bessel functions, that are
                later used to interpolate. Interpolating the Bessel functions
                increases the speed of the computations compared to explicitly
                evaluating them, without significant loss of accuracy.


        Computes the integral

        .. math::
            I(a,b) = \\int_{-1}^1 \\mathrm{d}x (1-x^2)^{a/2}x^b =
            \\frac{((-1)^b+1)\\Gamma(a+1)\\Gamma\\left
            \\frac{b+1}{2}\\right}
            {2\\Gamma\\left(a+\\frac{b}{2}+\\frac{3}{2}\\right}.


        Computes the angular part of the satellite intrinsic shear field,
        Eq. (C8) in `Fortuna et al. 2021 <https://arxiv.org/abs/2003.02700>`_.


        Returns the intrinsic satellite shear,

        .. math::
            \\gamma^I(r)=a_{1\\mathrm{h}}
            \\left(\\frac{r}{r_\\mathrm{vir}}\\right)^b.

        If :math:`b` is 0, then only the value of the amplitude
        :math:`a_\\mathrm{1h}` is returned. In addition, according to
        `Fortuna et al. 2021 <https://arxiv.org/abs/2003.02700>`_, we
        use a constant value of 0.06 Mpc for
        :math:`r<0.06` Mpc and set a maximum of 0.3 for :math:`\\gamma^I(r)`.


        Returns the real part of the satellite intrinsic shear field,

        .. math::
            \\gamma^I(r) u(r|M),

        with :math:`u` being the halo density profile divided by its mass.
        For now, it assumes a NFW profile.


        Returns the fourier transform of the satellite intrinsic shear field.
        The density profile of the halo is assumed to be a truncated NFW
        profile and the radial integral (in the case of 'simpson' or 'spline'
        method) is evaluated up to the virial radius.


Update any of the parameters associated with this profile.
        Any parameter set to ``None`` won't be updated.

        Args:
            alpha (:obj:`float` or :obj:`str`): :math:`\\alpha` parameter, or
                set to ``'cosmo'`` to calculate the value from cosmology.


Subhalo mass function of `Tinker & Wetzel 2010
        <https://arxiv.org/abs/0909.1325>`_. Number of subhalos
        per (natural) logarithmic interval of mass.

        Args:
            Msub (:obj:`float` or `array`): sub-halo mass (in solar masses).
            Mparent (:obj:`float`): parent halo mass (in solar masses).

        Returns:
            (:obj:`float` or `array`): average number of subhalos.


 Update any of the parameters associated with
        this profile. Any parameter set to ``None`` won't be updated.

        Args:
            nu_GHz (:obj:`float`): frequency in GHz.
            alpha (:obj:`float`): dust temperature evolution parameter.
            T0 (:obj:`float`): dust temperature at :math:`z=0` in Kelvin.
            beta (:obj:`float`): dust spectral index.
            gamma (:obj:`float`): high frequency slope.
            s_z (:obj:`float`): luminosity evolution slope.
            log10Meff (:obj:`float`): :math:`\\log_{10}` of the most
                efficient mass.
            siglog10M (:obj:`float`): logarithmic scatter in mass.
            Mmin (:obj:`float`): minimum subhalo mass.
            L0 (:obj:`float`): luminosity scale (in
                :math:`{\\rm Jy}\\,{\\rm Mpc}^2\\,M_\\odot^{-1}`).


Build the ``Cosmology`` representation.

    Cosmology equivalence is tested via its representation. Therefore,
    there is limiting behavior where ``'=='`` will return ``False``
    even though the compared cosmologies return the same theoretical
    predictions. This happens whenever:

        * Exactly one Cosmology is an instance of ``CosmologyCalculator``.
        * Cosmologies defined with different parameter sets, where one can
          be computed from the other (e.g. ``sigma8`` and ``A_s``).
        * Instances of ``CosmologyCalculator`` which do not contain exactly
          the same linear & non-linear power spectrum entries.

    Example output::

        <pyccl.cosmology.Cosmology>
            Omega_b = 0.05
            Omega_c = 0.25
            h       = 0.67
            n_s     = 0.96
            sigma8  = 0.81
            extra_parameters =
                test = {'param': 18.4}
            HASH_ACCURACY_PARAMS = 0x1959cbc9
            HASH_PK = 0xbca03ab0


Build the ``Pk2D`` representation.

    Example output ::

        <pyccl.Pk2D>
            +===============+=============================================+
            | a \\ log10(k) | -4.30e+00 -4.16e+00 ...  9.29e-01  1.02e+00 |
            +===============+=============================================+
            |   1.00e-02    |  1.71e-01  2.36e-01 ...  5.82e-05  3.31e-05 |
            |   1.26e-02    |  2.78e-01  3.82e-01 ...  9.15e-05  5.21e-05 |
            |      ...      |                     ...                     |
            |   9.77e-01    |  1.14e+03  1.57e+03 ...  3.31e-01  1.88e-01 |
            |   1.00e+00    |  1.17e+03  1.60e+03 ...  3.39e-01  1.93e-01 |
            +===============+=============================================+
            | is_log = True , extrap_orders = (1, 2)                      |
            | HASH_ARRS = 0x1d3524ad                                      |
            +===============+=============================================+


Simple representation.

    Example output ::

        <pyccl.emulator.Emulator>


Build a representation for an object from a list of attribute names
    given in the hook ``__repr_attrs__``.

    Example output::

        <pyccl.halos.halo_model.HMCalculator>
            mass_function = MassFuncTinker08,  HASH = 0xd3b29dd3
            halo_bias = HaloBiasTinker10,  HASH = 0x9da644b5
            mass_def = pyccl.halos.MassDef(Delta=500, rho_type=critical)


Buld a representation for a Tracer.

    .. note:: Tracer insertion order is important.

    Example output ::

        <pyccl.tracers.Tracer>
            num       kernel             transfer       prefac  bessel
             0  0x82ad882c232406bb  0xa0657c0f1c98fd77    0       2
             1  0x7ab385bb323530da         None           0       0


Build a representation for a Tk3D object.

    Example output ::

        <pyccl.Tk3D>
            +================+=============================================+
            | a \\ log10(k1) | -4.00e+00 -3.33e+00 ...  1.33e+00  2.00e+00 |
            +================+=============================================+
            |   5.00e-02     |  4.46e+07  9.62e+06 ...  2.07e+02  4.46e+01 |
            |       ...      |                     ...                     |
            |   1.00e+00     |  2.00e+09  4.30e+08 ...  9.26e+03  2.00e+03 |
            +================+=============================================+
            +================+=============================================+
            | a \\ log10(k2) | -4.00e+00 -3.33e+00 ...  1.33e+00  2.00e+00 |
            +================+=============================================+
            |   5.00e-02     |  4.46e+01  1.78e+00 ...  2.82e-10  1.12e-11 |
            |       ...      |                     ...                     |
            |   1.00e+00     |  2.00e+03  7.94e+01 ...  1.26e-08  5.01e-10 |
            +================+=============================================+
            | is_log = True , extrap_orders = (1, 1)                       |
            | HASH_ARRS = 0x780972f4                                       |
            +================+=============================================+


Unlock the object.


Decorator that temporarily unlocks an instance of CCLObject.

        Arguments:
            func (``function``):
                Function which changes one of its ``CCLObject`` arguments.
            name (``str``):
                Name of the parameter to unlock. Defaults to the first one.
                If not a ``CCLObject`` the decorator will do nothing.
            mutate (``bool``):
                If after the function ``instance_old != instance_new``, the
                instance is mutated. If ``True``, the representation of the
                object will be reset.


Allow an instance to change or mutate when `name` is called.


Powerful helper for equivalence checking.


Enable the custom methods if they exist.


Disable custom methods and fall back to Python defaults.


Obtain particular model.


Process the input and generate an object of the class.
        Input can be an instance of the class, or a name string.
        Optional ``**kwargs`` may be passed.


Make unhashable objects hashable in a consistent manner.


Calculate the hex hash from arguments and keyword arguments.


Get the cached object container
        under the implemented caching policy.


Remove one cached item as per the implemented caching policy.


Cache the output of the decorated function, using the input
        arguments as a proxy to build a hash key.

        Arguments:
            func (``function``):
                Function to be decorated.
            maxsize (``int``):
                Maximum cache size for the decorated function.
            policy (``'fifo'``, ``'lru'``, ``'lfu'``):
                Cache retention policy. When the storage reaches maxsize
                decide which cached object will be deleted. Default is 'lru'.\n
                'fifo': first-in-first-out,\n
                'lru': least-recently-used,\n
                'lfu': least-frequently-used.


This is a decorator which can be used to mark functions
    as deprecated. It will result in a warning being emitted
    when the function is used. If there is a replacement function,
    pass it as `new_function`.


This decorator can be used to deprecate attributes,
    warning users about it and pointing them to the new attribute.

    Parameters
    ----------
    getter : slot wrapper ``__getattribute__``
        This is the getter method to be decorated.
    pairs : list of pairs
        List of renaming pairs ``('old', 'new')``.

    Example
    -------
    We have the legacy attribute ``old_name`` which we want to rename
    to ``new_name``. To achieve this we decorate the ``__getattribute__``
    method of the parent class in the main class body to retrieve the
    ``__getattr__`` method for the main class, like so:

    >>>  __getattr__ = deprecate_attr([('old_name', 'new_name')])(
             super.__getattribute__)

    Now, every time the attribute is called via its old name, the user will
    be warned about the renaming, and the attribute value will be returned.

    .. note:: Make sure that you bind ``__getattr__`` to the decorator,
              rather than ``__getattribute__``, because ``__getattr__``
              provides the fallback mechanism we want to use. Otherwise,
              an infinite recursion will initiate.


Update the precision of FFTLog for the Hankel transforms.

        Arguments
        ---------
        padding_lo_fftlog: :obj:`float`
            Factor by which the minimum scale is multiplied to avoid
            aliasing. Default: 0.1.
        padding_hi_fftlog: :obj:`float`
            Factor by which the maximum scale is multiplied to avoid
            aliasing. Default: 10.
        n_per_decade : :obj:`float`
            Samples per decade for the Hankel transforms. Default: 100.
        extrapol : {'linx_liny', 'linx_logy'}
            Extrapolation type when FFTLog has narrower output support.
            Default ``'linx_liny'``.
        padding_lo_extra: :obj:`float`
            Additional minimum scale padding for double Hankel transforms,
            used when computing 2D projected and cumulative profiles. In
            these, the first transform goes from 3D real space to
            Fourier, and the second transform goes from Fourier to 2D
            real space.
            Default: 0.1.
        padding_hi_extra: :obj:`float`
            As ``padding_lo_extra`` for the maximum scale.
            Default: 10.
        large_padding_2D : :obj:`bool`
            Override ``padding_xx_extra`` in the intermediate transform,
            and use ``padding_xx_fftlog``. The default is False.
        plaw_fourier: :obj:`float`
            FFTLog pre-whitens its arguments (makes them flatter) to avoid
            aliasing. The ``plaw_fourier`` parameter describes the tilt of
            the profile, :math:`P(r) \\propto r^{\\mathrm{tilt}}`, for
            standard 3D transforms. Default: -1.5
        plaw_fourier_projected: :obj:`float`
            As ``plaw_fourier`` for 2D transforms (when computing 2D
            projected or cumulative profiles. Default: -1.0.


Reload the C-level default CCL parameters.


 Update the internal PT arrays.

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


 Get the number counts auto-spectrum at the internal
        set of wavenumbers and scale factors.

        Args:
            tr1 (:class:`~pyccl.nl_pt.tracers.PTTracer`): first
                tracer to correlate.
            tr2 (:class:`~pyccl.nl_pt.tracers.PTTracer`): first
                tracer to correlate.

        Returns:
            array: 2D array of shape `(N_a, N_k)`, where `N_k` \
                is the size of this object's `k_s` attribute, and \
                `N_a` is the size of the object's `a_s` attribute.


 Get the number counts - IA cross-spectrum at the internal
        set of wavenumbers and scale factors.

        .. note:: The full non-linear model for the cross-correlation
                  between number counts and intrinsic alignments is
                  still work in progress in FastPT. As a workaround
                  CCL assumes a non-linear treatment of IAs, but only
                  linearly biased number counts.

        Args:
            trg (:class:`~pyccl.nl_pt.tracers.PTTracer`): number
                counts tracer.
            tri (:class:`~pyccl.nl_pt.tracers.PTTracer`): intrinsic
                alignment tracer.

        Returns:
            array: 2D array of shape `(N_a, N_k)`, where `N_k` \
                is the size of this object's `k_s` attribute, and \
                `N_a` is the size of the object's `a_s` attribute.


 Get the number counts - matter cross-spectrum at the internal
        set of wavenumbers and scale factors.

        Args:
            trg (:class:`~pyccl.nl_pt.tracers.PTTracer`): number
                counts tracer.

        Returns:
            array: 2D array of shape `(N_a, N_k)`, where `N_k` \
                is the size of this object's `k_s` attribute, and \
                `N_a` is the size of the object's `a_s` attribute.


 Get the intrinsic alignment auto-spectrum at the internal
        set of wavenumbers and scale factors.

        Args:
            tr1 (:class:`~pyccl.nl_pt.tracers.PTTracer`): first tracer
                to correlate.
            tr2 (:class:`~pyccl.nl_pt.tracers.PTTracer`): first tracer
                to correlate.

        Returns:
            array: 2D array of shape `(N_a, N_k)`, where `N_k` \
                is the size of this object's `k_s` attribute, and \
                `N_a` is the size of the object's `a_s` attribute.


 Get the matter - IA cross-spectrum at the internal
        set of wavenumbers and scale factors.

        Args:
            tri (:class:`~pyccl.nl_pt.tracers.PTTracer`): intrinsic
                alignment tracer.

        Returns:
            array: 2D array of shape `(N_a, N_k)`, where `N_k` \
                is the size of this object's `k_s` attribute, and \
                `N_a` is the size of the object's `a_s` attribute.


 Get the one-loop matter power spectrum.

        Returns:
            array: 2D array of shape `(N_a, N_k)`, where `N_k` \
                is the size of this object's `k_s` attribute, and \
                `N_a` is the size of the object's `a_s` attribute.


    Function to convert from :math:`A_{ia}` values to :math:`c_{ia}` values,
    for the intrinsic alignment bias parameters using the standard
    convention of `Blazek et al. 2019 <https://arxiv.org/abs/1708.09247>`_
    or the variant used by the Dark Energy Survey analysis.

    Args:
        cosmo (:class:`~pyccl.cosmology.Cosmology`): cosmology object.
        z (:obj:`float` or `array`): z value(s) where amplitude is evaluated.
        a1 (:obj:`float` or `array`): IA :math:`A_1` at input z values.
        a1delta (:obj:`float` or `array`): IA :math:`A_{1\\delta}` at input
            z values.
        a2 (:obj:`float` or `array`): IA :math:`A_2` at input z values.
        Om_m2_for_c2 (:obj:`bool`): True to use the Blazek et al. 2019
            convention of :math:`\\Omega_m^2` scaling.
        Om_m_fid (:obj:`float`): Value for Blazek et al. 2019 scaling.

    Returns:
        Tuple of IA bias parameters

        - c1 (:obj:`float` or `array`): IA :math:`C_1` at input z values.
        - c1delta (:obj:`float` or `array`): IA :math:`C_{1\\delta}` at
          input z values.
        - c2 (:obj:`float` or `array`): IA :math:`C_2` at input z values.


Use baccoemu to convert sigma8 total matter to sigma8 cdm+baryons


Get k vector and uninterpolated power spectrum at given a.

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

        Returns:
            :tuple: k and pk arrays.


Get a 2D interpolator for the power of k and a.

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`):
                Cosmological parameters.

        Returns:
            :obj:`~pyccl.pk2d.Pk2D` object.


The BCM model boost factor for baryons.

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

        Returns:
            :obj:`float` or `array`: Correction factor to apply to \
            the power spectrum.


Update BCM parameters. All parameters set to ``None`` will
        be left untouched.

        Args:
            log10Mc (:obj:`float`): logarithmic mass scale of hot
                gas suppression.
            eta_b (:obj:`float`): ratio of escape to ejection radii.
            k_s (:obj:`float`): Characteristic scale (wavenumber) of
                the stellar component.


The vD19 model boost factor for baryons.

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

        Returns:
            :obj:`float` or `array`: Correction factor to apply \
            to the power spectrum.


Update van Daalen 2019 parameters. All parameters set to
        ``None`` will be left untouched.

        Args:
            fbar (:obj:`float`): baryonic fraction in halos.
            mass_def (:obj:`string`): mass definition ("500c" or
                "200c")


Apply baryonic effects to a given power spectrum.

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`):
                Cosmological parameters.
            pk (:class:`~pyccl.pk2d.Pk2D`): power spectrum.

        Returns:
            :obj:`~pyccl.pk2d.Pk2D` object.


Apply baryonic effects to a given power spectrum.

        Args:
            cosmo (:class:`~pyccl.cosmology.Cosmology`):
                Cosmological parameters.
            pk (:class:`~pyccl.pk2d.Pk2D`): power spectrum.

        Returns:
            :obj:`~pyccl.pk2d.Pk2D` or :obj:`None`.


The baccoemu BCM model boost factor for baryons.

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

        Returns:
            :obj:`float` or `array`: Correction factor to apply to \
            the power spectrum.


Update parameters. All parameters set to ``None`` will
        be left untouched.

        Args:
            log10_M_c (:obj:`float`): characteristic halo mass to model baryon
                mass fraction (in :math:`M_\\odot`)
            log10_eta (:obj:`float`): extent of ejected gas
            log10_beta (:obj:`float`): slope of power law describing baryon
                mass fraction
            log10_M1_z0_cen (:obj:`float`): characteristic halo mass scale for
                central galaxies (in :math:`M_\\odot`)
            log10_theta_out (:obj:`float`):  outer slope of density profiles of
                hot gas in haloes
            log10_theta_inn (:obj:`float`): inner slope of density profiles of
                hot gas in haloes
            log10_M_inn (:obj:`float`): transition mass of density profiles of
                hot gas in haloes (in :math:`M_\\odot`)


    Create JSON file with metadata for OFFRED variables from Excel table
    Args:
        excel_filepath (str): Path to the Excel file that describes OFFRED data
        json_fpath: (str): Path to output file in JSON format
        columns_to_keep: (list): List of column names in Excel table to include in the JSON file


        Returns
        -------
        An object which describes this dataset's attributes/configuration to an end-user, providing details which are
        useful or necessary for querying it.


       Given a requested_aggregation_level and a timespan, check that the requested_aggregation_level is valid for the
       timespan and Dataproduct class/subclass.  Return it if valid, else return the lowest allowable value.

       For non-timeseries data products (which do not support aggregation), this will always be 0.


Pull channel id values from the stateful metadata cache


Insert additional columns into default report table schema before the 'timestamp' clause


Get either the min or max timestamp for a given dataset, version and instruments


        Given a collection of column names, return a select clause to fetch those columns when querying SQL.
        Processes special cases (in this case, just location) where some transformation must be applied between SQL-land
        and Python-land.

        This type of behaviour may end up being necessary for fields other than location.  If this is necessary, this
        should be refactored, as this implementation is a stopgap approach.


        Assign approximate locations to a set of results from TimeSeriesDataset.select(), using ingested GNV data to map
        datum timestamps to a lat/lon.  The format is 'location': {'latitude': $value, 'longitude': $value}
        The maximal error will be equal to +/- the satellite's movement in one second (i.e. half the temporal resolution
        of the GNV dataset).
        TODO: N.B. this may only hold true for timespans where downsampling of the GNV is not required - need to confirm
        A value of None will be assigned to input data for which there is no GNV data available.


        Derive channel id values from the raw data - this is expensive and should be avoided in favor of
        DataProduct.fetch_channel_id_values(), which uses the stateful metadata cache


        This is a stub to instantiate plausible min/max values for those types which are intended to be supported.
        TODO: In the future, this will fetch the values, if present, from the database.  It will be necessary to create
         a resolver factory method to allow instantiation of a collection of configuration objects with a single
         database query.

        TODO: Refactor all this, splitting the construction from the parsing of the static file (if database storage
         of configuration isn't immediately implemented or it's decided to use static json)


        Returns
        -------
        An object which describes this data product's attributes/configuration to an end-user, providing details which are
        useful or necessary for querying it.


        Generate the necessary series of bucket intervals for this dataset, given its raw resolution.

        The step factor is applied repeatedly until a value of aligned_bucket_span is reached, ensuring that
        aligned_bucket_span is included in the series, at which point the step factor is repeatedly applied to
        aligned_bucket_span such that all data from that point onward is time-aligned across datasets.

        The series continues until it reaches a point sufficient to represent the forseeable dataset temporal span in no
        more than ~approximate_pixel_count data.


Given a start/end datetime and a set of filter conditions, prepare conditions for use in SQL WHERE


Given a start/end datetime and a set of filter conditions, prepare parameters for use in SQL parametrized query


    Ensure that database is consistent and up-to-date (within limits)
    :param database_name:
    :param populate_dataproducts_versions: Not yet implemented
    :param is_database_init: Set True to skip superfluous db calls for when there is no data.
    :return:


Ensure existence of ingest-manager tables used to track files which have been or have yet to be ingested.


    Ensure existence of metadata tables used to track inherent dataset properties (such as column definitions), as well
    as mutable properties like extant data span and extant dataset versions.


    :param dataset: the dataset for which to update metadata
    :param data_span: the data span, if any, to update the data with
    :param channel_ids: the unique values for each channel id field
    :param populate_versions: not yet implemented - currently unclear what this was intended to accomplish
    :param accumulate_data_span: If True, update the metadata with the union of the provided data_span and the span
           already present in the db.  If False, overwrite the span with the provided data_span.
    :return:


Ensure that the table for this dataset exists, creating and configuring the table if it does not.


    Ensure that the table for this dataset and instrument_id's data exists, creating the table and all necessary views if
    the table doesn't exist.  Does not check for or fix partial existence (i.e. table exists but views do not).


Return a JSON representation of this aggregation for use in the API


        Append a location and orbit_direction (ascending or descending flag)
        columns to the data frame.

        Parameters
        ----------
        df -  pd.DataFrame


        X/Y/Z are the positions from the GNV files. Longitude is imbedded in the code.
        The output here is geodetic latitude;
        however, if you only want geocentric latitude, the entire while loop is unnecessary.
        Note that np here is numpy.


    Refresh all continuous aggregates for a given TimeSeriesDataset.
    Optionally, split the refresh operations into chunks, for faster runtime and improved log responsiveness.
    Unexpectedly, the refresh runtime increases superlinearly with timespan, so this is necessary when refreshing a
    large span.


Refresh a single cagg over a given span


Convert the object into a dictionary suitable for psycopg2 INSERT/UPDATE.


Create an object from a dictionary returned by psycopg2 (e.g. from cursor.fetchone()).


    Parameters
    ----------
    src - the directory containing input files, identified by ACC1A_{YYYY-MM-DD}_{satellite_id}_04.txt
    dest - the destination parquet root directory

    Returns
    -------


Extract instruments id from unzipped input file


Extract version id from unzipped input file


Given a path to a source file, return a pandas dataframe containing fully-prepared/transformed data, ready
        for insertion to the database.


        Use this method to append fields that are not read directly from the product file,
        for example, geolocation field

        Parameters
        ----------
        df -  pd.DataFrame


Ensure that an array only contains the expected value, raising ValueError on failure


Return index(0-based) of 'prod_flag' column in an input ASCII file


        Return index(0-based) of first column in the input ASCII file with data defined by prod_flag.
        It is not always the next column after the prod_flag column
        TODO: This assumes that prod_data is contiguous and always at the end of the row


        Get prod_flag as 2D numpy array of integer, drop columns of bits that are not defined

        orig_prod_flag: prod_flag data from the input file as 1D np.array of strings


Return index(0-based) of the start of repeated clusters in the input ASCII file


Return name of a column that specifies number of repeated clusters per row


Return number of variables in data cluster


        Returns name of a log message variable in the log file
        -------


        Returns max number of characters in the log message
        -------


Given a list of keys, return a list of values from the dictionary. Some values could be None.


        Read field names from the OFFRED data file header and return them as a list
        Args:
            filepath (str): OFFRED data file

        Returns:
            List[str]: Field names as a list


           Returns list of AsciiDataFileReaderColumn that defines columns for a current input file.
           Note that the output file will have different columns definitions

           Parameters
           ----------
           data_fpath: path to input data file
           check_time_col_names: flag to turn on/off check for the assumption that the first 4 time-related column names
                                are the same in all input files. Could be turned off for unit tests

           Returns: List of AsciiDataFileReaderColumn definitions for the current input file
           -------


Wrapper for np.loadtxt call, to pass encoding and to avoid repeating all other arguments


Read up to num_rows from data file and return data type for each data column


        Look at data fron a field and try to figure out if they are int, float or string
        Parameters
        ----------
        arr : np.array(str) - chunk of data from a field represented as strings


Return number of values in data cluster


    Parse array-like fields into int ot boolean columns and append to the dataframe.
    The name of the columns are <source_col_name>_<index>

    Parameters
    ----------
    df: DataFrame - Frame to append int or boolean columns. Mast have an array-like column with name specified in source_col_name
    source_col_name:str - Name of the array-like column
    -------


    Given a row from Panda's frame, extract character at position 'idx'
    from array-like column specified by 'source_col_name'

    Parameters
    ----------
    row: row from Panda's dataframe. A row in a Pandas DataFrame is a Pandas Series object
    source_col_name: name of the array-like column in Panda's frame
    idx: index of element in array-like column to extract
    Returns  value at the inx position of the array-like element, as int
    -------


    Given a name of a field and array_size, returns list of objects of type 'DerivedAsciiDataFileReaderColumn'
    with names composed as <base_field_name>_<str(n)>, where n is range of int from 0 to array_size-1

    Parameters
    ----------
    base_field_name: name of array-like column that will be used as a prefix for derived column names
    array_size: number of elements in the array-like data. For qualflag column, it is a length of the string

    Returns List of DerivedAsciiDataFileReaderColumn that represent the new boolean columns derived from array-like column
    -------


    Given a directory root and a regex match pattern, return all matching filepaths under it.

    Parameters
    ----------
    root_dir - the root directory path under which to search
    match_regex - the match pattern applied to each filepath/filename
    match_filename_only - apply the match pattern to the filename only, rather than the full filepath

    Returns
    -------
    an iterable collection of matching filepaths within the directory tree rooted at root_dir


    Provide crude temporal ordering of input files by sorting them on filename. Timescaledb is optimised for insertion
    of most-recent data to a given table, so it is desirable to sort them during ingestion.


Yields all non-dict-valued items within the given dict, recursing into any dict-valued items


    Coerces an iterable with expected length 1 to its single element, else throws a ValueError.
    If throw_on_zero is False, returns None on zero-length iterable instead of throwing a ValueError.


 Import all submodules of a module, recursively, including subpackages

    :param package: package (name or actual module)
    :type package: str | module
    :rtype: dict[str, types.ModuleType]


        :param d:
        :return: whether any portion of d overlaps this TimeSpan


Yield the intersection of this TimeSpan and another TimeSpan, returning None if there is no overlap


Runs anything before the yield prior to app startup, and runs anything after the yield upon app exit


    Normally, fetching dataset metadata requires one query per dataset, but that is unnecessarily slow if many
    datasets are desired.

    This optimized query returns metadata dicts for all datasets, keyed by dataset full-id


    Normally, fetching channel-id enum values requires one query per product, but that is unnecessarily slow if many
    products are desired.

    This optimized query returns channel-id enum value dicts for all products, keyed by product full-id, then field name


Stores a JSON blob with a unique key in the database.


Fetches a JSON blob from the database by its unique key.


        Returns
        -------
        np.ndarray
            Layer delta scaling coefficient, shape (nlayer, nwavel)


Instrumental broaden the grid


Decimate the grid


Make the spectral axes possess uniform coordinates


Show an interactive dashboard for the Sonora grid;
        heavily inspired by the lightkurve .interact() method.

        Parameters
        ----------
        data: Spectrum1D-like
            A normalized data spectrum over which to plot the models
        notebook_url: str
            Location of the Jupyter notebook page (default: "localhost:8888")
            When showing Bokeh applications, the Bokeh server must be
            explicitly configured to allow connections originating from
            different URLs. This parameter defaults to the standard notebook
            host and port. If you are running on a different location, you
            will need to supply this value for the application to display
            properly. If no protocol is supplied in the URL, e.g. if it is
            of the form "localhost:8888", then "http" will be used.


Callback to take action when smoothing slider changes


Callback to take action when vz slider changes


Callback to take action when teff slider changes


Callback to take action when logg slider changes


Callback to take action when metallicity slider changes


Step forward in time by a single cadence


Step back in time by a single cadence


Applies a numpy-style boolean mask to an input spectrum (True=Keep, False=Discard)

    Parameters
    ----------
    spec : Spectrum1D object
        Object containing a spectrum
    mask : boolean mask, typically a numpy array
        The mask to apply to the spectrum

    Returns
    -------
    masked_spec: Spectrum1D object
        The spectrum with the mask applied


Truncate the wavelength range of the grid

    Parameters
    ----------
    wavelength_range: list or tuple
        A pair of values (with units) that denote the shortest and longest wavelengths
        for truncating the grid.
    data: Spectrum1D-like
        A spectrum to which this method will match the wavelength limits

    Returns
    -------
    truncated_spectrum: Spectrum1D-like
        The spectrum after being truncated to the given wavelength range


The velocity sampling of the spectrum

        Returns
        -------
        velocity_spacing : np.array
            vector of per pixel velocity sampling


Normalize spectrum by some given percentile

        Parameters
        ----------
        percentile : int
            The percentile to which the spectrum will be normalized (default: 50th percentile)

        Returns
        -------
        normalized_spec : PrecomputedSpectrum
            Normalized spectrum


r"""Rotationally broaden the spectrum for a given :math:`v\sin{i}`
        Implementation inspired by https://github.com/HajimeKawahara/exojax

        Known limitation: If the wavelength sampling changes with wavelength,
          the convolution becomes inaccurate.  It may be better to FFT,
          following Starfish.

        Parameters
        ----------
        vsini : int
            :math:`v\sin{i}` in units of km/s
        u1 : float
            Limb-darkening coefficient 1
        u2 : float
            Limb-darkening coefficient 2

        Returns
        -------
        broadened_spec : PrecomputedSpectrum
            Rotationally Broadened Spectrum


r"""Instrumentally broaden the spectrum for a given instrumental resolution

        Known limitation: If the wavelength sampling changes with wavelength,
          the convolution becomes inaccurate.  It may be better to FFT,
          following Starfish.

        Parameters
        ----------
        resolving_power : int
            Instrumental resolving power :math:`R = \frac{\lambda}{\delta \lambda}`

        Returns
        -------
        broadened_spec : PrecomputedSpectrum
            Instrumentally broadened spectrum


Shift the spectrum by a radial velocity

        Parameters
        ----------
        rv : int
            Radial velocity in km/s

        Returns
        -------
        shifted_spec : PrecomputedSpectrum
            RV-Shifted Spectrum


Resample spectrum at the wavelength points of another spectrum

        Parameters
        ----------
        target_spectrum : Spectrum1D
            Spectrum whose wavelength grid you seek to match

        Returns
        -------
        resampled_spec : PrecomputedSpectrum
            Resampled spectrum


Resample spectrum to a uniform-in-velocity pixel spacing

        Parameters
        ----------
        oversample : float
            The desired oversampling in velocity, compared to the typical velocity sampling at original pixel spacing.
            Typically, you will want to oversample to ensure the narrowest lines remain resolved at the new sampling,
            at the expense of more pixels than you started with.
            If your original spectrum has large gaps, you may end up with many more pixels than you started with.

        Returns
        -------
        resampled_spec : PrecomputedSpectrum
            Resampled spectrum


Decimate the number of samples in the spectrum

        Parameters
        ----------
        decimation_factor : float
            The fraction of pixels to keep. Default: 0.1
        n_pixels  : int
            The number of pixels to keep. Default: 2,000
        resolving_power : int
            The resolving power of the new spectrum.  Default: 3,000

        Returns
        -------
        decimated_spec : PrecomputedSpectrum
            Decimated Spectrum


Divide the spectrum by a blackbody

        Parameters
        ----------
        teff : float
            The effective temperature of the blackbody to divide by.

        Returns
        -------
        divided_spec : PrecomputedSpectrum
            The spectrum after being divided by the blackbody.


Tilt the template towards a data spectrum by fitting and dividing by a low-order polynomial

        Parameters
        ----------
        target_spectrum : Spectrum1D
            A Spectrum1D object whose flux tilt to match against
        return_model : bool
            Whether or not to return the model

        Returns
        -------
        tilted_spec : PrecomputedSpectrum
            Tilted spectrum


Finds the low frequency continuum trend using scipy's find_peaks filter and linear algebra.

        Parameters
        ----------
        pixel_distance : int
            The minimum separation between peaks, in pixels. Default = 5001 px
        polyorder : int
            The polynomial degree to be used for peak fitting
        return_coeffs : bool
            If `True`, returns a 2-tuple (trend_spec, trend_coeffs) where trend_spec is the fitted trend.

        Returns
        -------
        spec_out : PrecomputedSpectrum
            New Spectrum object representing a fit of the continuum.
        If `return_coeffs` is set to `True`, this method will also return:
            coeffs : np.array
                New vector of polynomial coefficients that reproduce the trend.


Export the spectrum to a pandas dataframe


Plot a quick look of the spectrum"

        Parameters
        ----------
        ax : `~matplotlib.axes.Axes`
            A matplotlib axes object to plot into. If no axes is provided, a new one will be generated.
        xlo : float
            X-axis lower bound
        xhi : float
            X-axis upper bound
        ylo : float
            Y-axis lower bound
        yhi : float
            Y-axis upper bound
        figsize : tuple
            Dimensions of the figure
        label : str
            The label for plt.legend()

        Returns
        -------
        ax : `~matplotlib.axes.Axes`
            The axis to display and/or modify


Show an interactive dashboard for the experimental PHOENIX grid;
        heavily inspired by the lightkurve .interact() method

        Parameters
        ----------
        data: Spectrum1D-like
            A normalized data spectrum over which to plot the models
        url: str
            Location of the Jupyter notebook page (default: "localhost:8888")
            If you are running on a different location, you
            will need to supply this value for the application to display
            properly. If no protocol is supplied in the URL, e.g. if it is
            of the form "localhost:8888", then "http" will be used.


Callback that toggles continuum auto-fit


Callback that rotationally broadens the spectrum


Callback that updates the starspot's temperature


Callback that updates the starspot's fill factor


Callback that updates the intrinsic parameters of the star


Broaden the grid by a given resolution.

        Parameters
        ----------
        R : int
            The resolution to broaden the grid to.


Show an interactive dashboard for the PHOENIX grid;
        heavily inspired by the lightkurve .interact() method.

        If data is used, we recommend that the grid first be truncated to it,
        with a margin of 50 Angstroms on either end of the spectral axis to allow for
        radial velocity shift and rotational broadening to operate properly.

        Parameters
        ----------
        data : Spectrum1D-like
            A normalized data spectrum over which to plot the models
        notebook_url : str
            Location of the Jupyter notebook page (default: "localhost:8888")
            When showing Bokeh applications, the Bokeh server must be
            explicitly configured to allow connections originating from
            different URLs. This parameter defaults to the standard notebook
            host and port. If you are running on a different location, you
            will need to supply this value for the application to display
            properly. If no protocol is supplied in the URL, e.g. if it is
            of the form "localhost:8888", then "http" will be used.