    Return the halo bias for the Tinker form.

    Tinker, J., et al., 2010. ApJ 724, 878-886.
    http://iopscience.iop.org/0004-637X/724/2/878


Return sigma from bias


Evaluate the spline for the given loaded name


        Load data into a given power attribute, as specified by power_term
        and mu_term.


Delete the given power attribute, as specified by power_term.


Print out the RSD model version


Load a model from a npy


    Decorator to remove units from :class:`astropy.units.Quantity`
    instances


        Interpolate the function for the given argument (`argname`)
        with a :class:`~scipy.interpolate.InterpolatedUnivariateSpline`

        `range` and `bins` behave like :func:`numpy.histogram`

        Parameters
        ----------
        argname : str
            the name of the variable to interpolate
        kwargs : dict; optional
            dict of keywords to pass to the original function
        bins : int, iterable; optional
            either an iterable specifying the bin edges, or an
            integer specifying the number of linearly-spaced bins
        range : tuple; optional
            the range to fit over if `bins` specifies an integer

        Returns
        -------
        spl : callable
            the callable spline function


    Helper function to vectorize functions on array inputs;
    borrowed from :mod:`astropy.cosmology.core`


    Returns `True` if the given object is iterable;
    borrowed from :mod:`astropy.cosmology.core`


        Return a :class:`Cosmology` instance from an astropy cosmology

        Parameters
        ----------
        cosmo : subclass of :class:`astropy.cosmology.FLRW`
            the astropy cosmology instance
        **kwargs :
            extra key/value parameters to store in the dictionary


        Returns a copy of this object, potentially with some changes.

        Returns
        -------
        newcos : Subclass of FLRW
            A new instance of this class with the specified changes.

        Notes
        -----
        This assumes that the values of all constructor arguments
        are available as properties, which is true of all the provided
        subclasses but may not be true of user-provided ones.  You can't
        change the type of class, so this can't be used to change between
        flat and non-flat.  If no modifications are requested, then
        a reference to this object is returned.

        Examples
        --------
        To make a copy of the Planck15 cosmology with a different Omega_m
        and a new name:

        >>> from astropy.cosmology import Planck15
        >>> cosmo = Cosmology.from_astropy(Planck15)
        >>> newcos = cosmo.clone(name="Modified Planck 2013", Om0=0.35)


        Convert the object to a :class:`pyRSD.pygcl.Cosmology` instance in
        order to interface with the CLASS code

        Parameters
        ----------
        **class_config : key/value pairs
            keywords to pass to the CLASS engine; defaults are `z_max_pk=2.0`
            and `P_k_max_h/Mpc=20.0`

        Returns
        -------
        cosmo : pygcl.Cosmology
            the pygcl Cosmology object which interfaces with CLASS


Write out the grid to a plaintext file.


        Return a :class:`PkmuGrid` instance, reading the data from a
        plaintext file.


        The power array holding :math:`P(k,\mu)` on the grid.

        Shape is (:attr:`Nk`, :attr`Nmu`), with NaNs for any null grid points.


        A list of tuples specifying the lower and upper limits for each
        desired ``mu`` bin.

        .. note::
            A small tolerance is added to bins that end at :math:`\mu=1` to
            make that bin inclusive.


The edges of the ``mu`` bins desired for output.


        The minimum wavenumber ``k`` to include.

        Shape can be either a float or array of length :attr:`N2`


        The maximum wavenumber ``k`` to include.

        Shape can be either a float or array of length :attr:`N2`.


        The size of the flattened (valid) grid points, i.e., the number of
        (k,mu) or (k,ell) data points.


First axis is ``k``.


Second axis is the ``mu`` bins.


        A list holding the flattened coordinates (``k``, ``mu``), where
        ``mu`` refers to the center of the ``mu`` wedge.

        .. note::
            These coordinates corresponds to the final power with NaNs removed.


        A boolean array with elements set to ``True`` specifying the
        elements on the underlying (k,mu) grid within the desired
        :attr:`kmin` and :attr:`kmax`.


Convenience attribute to store the dimensions of the bin counting arrays.


Multi-index for re-binning the ``mu`` grid.


        Sum the input data over the `mu` bins specified by `mu_edges`

        Parameters
        ----------
        d : array_like, (``grid.Nk``, ``grid.Nmu``)
            the data array to sum over the grid


        Average the input data, with optional weights, as a function of ``mu``
        on the grid, using :attr:`mu_edges` to specify the edges of the new
        ``mu`` bins.

        Parameters
        ----------
        d : array_like, (``grid.Nk``, ``grid.Nmu``)
            the data array to average over the grid
        w : array_like, (``grid.Nk``, ``grid.Nmu``)
            optional weight array to apply before averaging


        The multipole numbers to compute -- this corresponds to the
        second axis (columns).


The ``k`` values averaged over the ``mu`` dimension


The number of multipoles (2nd axis).


Legendre weighting for the multipoles.


        The default parameters for P_hm, CF_hm

        References
        ----------
        These parameters are from:

        file: ``global_Phm_kmax-0.5_final.npz``
        directory: ``$RSD_DIR/SimCalibrations/HaloMatterHZPT/results``
        git hash: 72834b10d


The linear bias


        Returns the A0 radius parameter

        Note: the units are power [(h/Mpc)^3]


        Returns the R1 radius parameter

        Note: the units are length [Mpc/h]


        Returns the R1h radius parameter

        Note: the units are length [Mpc/h]


        Returns the R2h radius parameter

        Note: the units are length [Mpc/h]


        Returns the R radius parameter

        Note: the units are length [Mpc/h]


        Return a power law as a linear bias and sigma8(z) with the specified
        parameters


        The correlation function broadband correction term

        This is given by the Fourier transform of the Pade function


Return the Zel'dovich correlation at the specified `r`


Initialize the class from a Zel'dovich object instance


        Set the default parameters for P00/P01 HZPT

        References
        ----------
        These parameters are from:

        file: ``P00_P01_CF_rmin-0.3_kmax-0.5.npz``
        directory: ``$RSD_DIR/SimCalibrations/MatterHZPT/results``
        git hash: aed2b025


The driver object that computes the Zel'dovich term


The cosmology parameter object


The redshift; this should only be set when initializing


The sigma8 value at z


        Returns the A0 radius parameter (see eqn 4 of arXiv:1501.07512)

        Note: the units are power [(h/Mpc)^3]


        Returns the R radius parameter (see eqn 4 of arXiv:1501.07512)

        Note: the units are length [Mpc/h]


        Returns the R1 radius parameter (see eqn 5 of arXiv:1501.07512)

        Note: the units are length [Mpc/h]


        Returns the R1h radius parameter (see eqn 5 of arXiv:1501.07512)

        Note: the units are length [Mpc/h]


        Returns the R2h radius parameter (see eqn 5 of arXiv:1501.07512)

        Note: the units are length [Mpc/h]


Update any attributes with the specified values


r"""
        The broadband power in units of :math:`(\mathrm{Mpc}/h)^3`

        The functional form is given by:

        .. math::

            P_\mathrm{BB} = A_0 F(k) \left[ \frac{1 + (k R_1)^2}{1 + (k R_{1h})^2 + (k R_{2h})^4} \right],

        as given by Eq. 1 in arXiv:1501.07512.

        Parameters
        ----------
        k : float, array_like
            the wavenumber in units of :math:`h/\mathrm{Mpc}`


        Return the Zel'dovich power term at the specified `k`

        Parameters
        ----------
        k : float, array_like
            the wavenumber in units of :math:`h/\mathrm{Mpc}`


Compute the Zel'dovich term from the table


Internal utility function


The value of sigma8 at z


Set `sigma8_z` for each existing model


The value of the growth rate


Set `f` for the models that need it


The P00 Halo Zel'dovich model


The P01 Halo Zel'dovich model


The P11 Halo Zel'dovich model


The Phm Halo Zel'dovich model


Return HZPT P00


Return HZPT P01


Return HZPT P11


Return HZPT Phm


        The correlation function broadband correction term

        This is given by the Fourier transform of the Pade function

        Parameters
        ----------
        r : float, array_like
            the separation array, in units of :math:`\mathrm{Mpc}/h`


        Return the Zel'dovich correlation at the specified `r`

        Parameters
        ----------
        r : float, array_like
            the separation array, in units of :math:`\mathrm{Mpc}/h`


The logarithmic growth rate


        The broadband power correction for P01 in units of (Mpc/h)^3

        This is the derivative of the broadband band term for P00, taken
        with respect to ``lna``


        The default parameters

        References
        ----------
        These parameters are from:

        file: ``mcmc_fit_kmin-0.005_kmax-1.0.npz``
        directory: ``$RSD_DIR/SimCalibrations/P11HaloZeldovich/results``
        git hash: 8e1304e6


        Return a power law as a function of f(z) and sigma8(z) with the
        specified parameters


        The broadband power correction in units of (Mpc/h)^3

        Modeled with a Pade function,

        .. math::

            P_{BB} = F(k) A_0 / (1 + (k R_{1h})^2)


Memoization decorator for power terms


Return the registered subclasses


    Compute the total derivative of `Pgal` with
    respect to the input parameter `name`

    Parameters
    ----------
    registry : dict
        the dictionary of available analytic derivatives
    name : str
        the parameter to compute the derivative with respect to
    m : subclass of DarkMatterSpectrum
        the RSD model instance
    pars : ParameterSet
        the theory parameters
    k : array_like
        the array of `k` values to evaluate the derivative at
    mu : array_like
        the array of `mu` values to evaluate the derivative at


    Update the model and call power(k,mu) from the global driver
    instance

    This is defined at the module level so we can pickle it


        Internal function to determine which derivatives require a
        numerical derivative


Internal function to update the parameters and the model


        Internal function that handles updating the model and calling power(k,mu)

        This is defined at the module level so we can pickle it


Constant as a function of `k`, so derivative is zero


No `mu` dependence so derivative is zero


The first linear bias for this term


        The second linear bias for this term, defaulting
        to `b1`


        Evaluate the `k` derivative by calling :func:`derivative_k`,
        evaluated at (`k`,`mu`)


        Evaluate the `mu` derivative by calling :func:`derivative_mu`,
        evaluated at (`k`,`mu`)


        Sum the `k` derivative for each sub-term, weighting by the
        coefficient of each sub-term


        Sum the `mu` derivative for each sub-term, weighting by the
        coefficient of each sub-term


The first velocity dispersion value


The second velocity disperson value, or `None`


Derivative with respect to `k`


Derivative with respect to `mu`


        A GalaxyPowerParameters object holding the default model parameters

        The model associated with the parameter is ``self``


The fraction of satellites in SO halo finders compared to FOF


        The FOG velocity dispersion for type A centrals in Mpc/h, accounting
        for FOG from SO/FOF differences around central type A galaxies


        Function to return the FOG suppression factor, which reads in a
        single variable `x = k \mu \sigma`


The satellite fraction, fs = N_sat / N_gal


The centrals with sats (cB) fraction, fcB = N_cB / N_cen


The satellite with sats fraction, fsB = N_sB / N_sat


The linear bias factor for the centrals with no sats in same halo.


The linear bias factor for the centrals with sats in same halo.


The linear bias factor for satellites with no other sats in same halo.


The linear bias factor for satellites with other sats in same halo.


The FOG velocity dispersion for centrals in Mpc/h


The FOG velocity dispersion for satellites in Mpc/h


The FOG velocity dispersion for "type A" satellites in Mpc/h


The FOG velocity dispersion for "type B" satellites in Mpc/h


Constant for the P_cBs 1-halo term


Constant for the P_sBsB 1-halo term


Constant offset to model, set to 0 by default


Return the FOG function


        The linear bias factor for all centrals. This is not a free parameter,
        but is computed as weighted mean of b1_cA and b1_cB.


        The linear bias factor for all satellites. This is not a free parameter,
        but is computed as weighted mean of b1_sA and b1_sB.


The auto power spectrum of type A centrals


The cross power spectrum of type A and type B centrals


The auto power spectrum of type B centrals


The auto power spectrum of all centrals


The cross power spectrum of type A centrals and type A sats


The cross power spectrum of type A centrals and type B sats


The cross power spectrum of type B centrals and type A sats


The cross power spectrum of type B centrals and type B sats


The cross power spectrum of centrals and satellites


The auto power spectrum of type A satellites


The cross power spectrum of type A and type B satellites


The auto power spectrum of type B satellites


The auto power spectrum of all satellites


        The total redshift-space galaxy power spectrum at ``k`` and ``mu``

        Parameters
        ----------
        k : float, array_like
            The wavenumbers to evaluate the power spectrum at, in `h/Mpc`
        mu : float, array_like
            The cosine of the angle from the line of sight. If a float is provided,
            the value is used for all input `k` values. If array-like and `mu` has
            the same shape as `k`, the power at each (k,mu) pair is returned. If
            `mu` has a shape different than `k`, the returned power has shape
            ``(len(k), len(mu))``.
        flatten : bool, optional
            If `True`, flatten the return array, which will have a length of
            `len(k) * len(mu)`


The derivative with respect to `k_AP`


The derivative with respect to `mu_AP`


The `k` derivative, optionally including the SO correction


The `mu` derivative, optionally including the SO correction


The linear bias factor.


The quadratic, nonlocal tidal bias factor


Context manager to handle overriding the cache for specific attributes


Whether to correct the halo P[mu2] model, using a sim-calibrated model


Whether to correct the halo P[mu4] model, using a sim-calibrated model


Evaluate cross-spectra using the geometric mean of the biases


Redshift to evaluate power spectrum at


        Whether to use the linear velocity dispersion for halos as
        computed from simulations, which includes a slight mass
        dependence


Whether to include the tidal bias terms


If `True`, use the `HZPT` model for Phm


The linear bias factor of the first tracer.


The linear bias factor of the 2nd tracer.


Interpolator from simulation data for linear velocity dispersion of halos


The parameters for the halo P[mu2] correction


The parameters for the halo P[mu4] correction


The prediction for the auto stochasticity from a GP


The prediction for the cross stochasticity from a GP


The internally used bias of the 1st tracer


The internally used bias of the first tracer


The quadratic, nonlocal tidal bias factor for the first tracer


        The relationship between bias and velocity dispersion, using the
        Tinker et al. relation for halo mass and bias, and the virial theorem
        scaling between mass and velocity dispersion


The velocity dispersion for halos, possibly as a function of bias


        Return the velocity dispersion `sigmav` value for the specified linear
        bias value


The halo - matter cross correlation for the 1st tracer


The halo - matter cross correlation for the 2nd tracer


        The isotropic (type B) stochasticity term due to the discreteness of the
        halos, i.e., Poisson noise at 1st order.

        Notes
        -----
        *   The model for the (type B) stochasticity, interpolated as a function
            of sigma8(z), b1, and k using a Gaussian process


        The isotropic, halo-halo power spectrum, including the (possibly
        k-dependent) stochasticity term, as specified by the user.


The isotropic, halo-halo power spectrum, without any stochasticity term.


        The correlation of the halo density and halo momentum fields, which
        contributes mu^2 terms to the power expansion.


        The correlation of the halo density and halo kinetic energy, which
        contributes mu^2 and mu^4 terms to the power expansion.


        The auto-correlation of the halo momentum field, which
        contributes mu^2 and mu^4 terms to the power expansion. The mu^2 terms
        come from the vector part, while the mu^4 dependence is dominated by
        the scalar part on large scales (linear term) and the vector part
        on small scales.


        The cross-corelation of halo density with the rank three tensor field
        ((1+delta_h)v)^3, which contributes mu^4 terms.


        The correlation of halo momentum and halo kinetic energy density, which
        contributes mu^4 and mu^6 terms to the power expansion.


        The cross-correlation of halo momentum with the rank three tensor field
        ((1+delta_h)v)^3, which contributes mu^4 and mu^6 terms.


        The auto-corelation of halo kinetic energy density, which contributes
        mu^4, mu^6, mu^8 terms to the power expansion. There are no linear
        contributions here.


        The cross-correlation of halo density with the rank four tensor field
        ((1+delta_h)v)^4, which contributes mu^4 and mu^6 terms, at 2-loop order.


The mu2 correction to the model evaluated at `k`


The mu4 correction to the model evaluated at `k`


        The full halo power spectrum term with no angular dependence. Contributions
        from P00_ss.


        The full halo power spectrum term with mu^2 angular dependence. Contributions
        from P01_ss, P11_ss, and P02_ss.


        The full halo power spectrum term with mu^4 angular dependence. Contributions
        from P11_ss, P02_ss, P12_ss, P03_ss, P13_ss, P22_ss, and P04_ss.


        The full halo power spectrum term with mu^6 angular dependence. Contributions
        from P12_ss, P13_ss, P22_ss.


    The correlation of the halo density and halo momentum fields, which
    contributes mu^2 terms to the power expansion.


The 1-loop SPT halo density field auto-correlation


Initialize the underlying splines, etc of the model


        Cache repeated calls to functions defined in this class, assuming
        constant `k` and `mu` input values


        Context manager that preserves the state of the model
        upon exiting the context by first saving and then restoring it


Context manager to turn off all models


Context manager to load simulation data for certain dark matter terms


Whether we want to interpolate any underlying models


The transfer function fitting method


The cosmology filename; this is deprecated, use attr:`params` instead


The cosmology parameters by the user


The name of the file holding the cosmological parameters


        Only compute the power terms up to and including `max_mu`. Should
        be one of [0, 2, 4, 6]


Whether to include 2-loop terms in the power spectrum calculation


Wavenumber to transition to use only SPT for lower wavenumber


Minimum observed wavenumber needed for results


Maximum observed wavenumber needed for results


Number of log-spaced wavenumber bins to use in underlying splines


        The value of Sigma8(z) (mass variances within 8 Mpc/h at z) to compute
        the power spectrum at, which gives the normalization of the
        linear power spectrum


        The perpendicular Alcock-Paczynski effect scaling parameter, where
        :math: `k_{perp, true} = k_{perp, true} / alpha_{perp}`


        The parallel Alcock-Paczynski effect scaling parameter, where
        :math: `k_{par, true} = k_{par, true} / alpha_{par}`


        The ratio of the sound horizon in the fiducial cosmology
        to the true cosmology


        The velocity dispersion at `z`. If not provided, defaults to the
        linear theory prediction (as given by `self.sigma_lin`) [units: Mpc/h]


        The additional, small-scale velocity dispersion, evaluated using the
        halo model and weighted by the velocity squared. [units: km/s]

        .. math:: (sigma_{v2})^2 = (1/\bar{rho}) * \int dM M \frac{dn}{dM} v_{\parallel}^2


        The additional, small-scale velocity dispersion, evaluated using the
        halo model and weighted by the bias times velocity squared. [units: km/s]

        .. math:: (sigma_{bv2})^2 = (1/\bar{rho}) * \int dM M \frac{dn}{dM} b(M) v_{\parallel}^2


        The additional, small-scale velocity dispersion, evaluated using the
        halo model and weighted by bias times the velocity squared. [units: km/s]

        .. math:: (sigma_{bv4})^4 = (1/\bar{rho}) * \int dM M \frac{dn}{dM} b(M) v_{\parallel}^4


The sound horizon at the drag redshift in the cosmology of ``cosmo``


The integer value representing the transfer function fitting method


A `pygcl.Cosmology` object holding the cosmological parameters


        Return a range in wavenumbers, set by the minimum/maximum
        allowed values, given the desired `kmin` and `kmax` and the
        current values of the AP effect parameters, `alpha_perp` and `alpha_par`


The growth function at z


The conformal Hubble parameter, defined as `H(z) / (1 + z)`


A 'pygcl.LinearPS' object holding the linear power spectrum at z = 0


        A 'pygcl.LinearPS' object holding the linear power spectrum at z = 0,
        using the Eisenstein-Hu no-wiggle transfer function


        The factor needed to normalize the linear power spectrum
        in `power_lin` to the desired sigma_8, as specified by `sigma8_z`,
        and the desired redshift `z`


        The dark matter velocity dispersion at z, as evaluated in
        linear theory [units: Mpc/h]. Normalized to `sigma8_z`


        The dark matter velocity dispersion at z = 0, as evaluated in
        linear theory [units: Mpc/h]. This is not properly normalized


If `True`, use the `HZPT` model for P00


If `True`, use the `HZPT` model for P01


If `True`, use the `HZPT` model for P11


Whether to use interpolated sim results for Pdv


Whether to use Jennings model for Pvv or SPT


Either `jennings` or `sims` to describe the Pdv model


A list of parameter names to be scaled with redshift


The class holding the (possibly interpolated) HZPT models


        The class holding the model for the P11 dark matter term, based
        on interpolating simulations


        The class holding the model for the Pdv dark matter term, based
        on interpolating simulations


        Return the density-divergence cross spectrum using the fitting
        formula from Jennings et al 2012 (arxiv: 1207.1439)


        Return the divergence auto spectrum using the fitting
        formula from Jennings et al 2012 (arxiv: 1207.1439)


Save to a ``.npy`` file by calling :func:`numpy.save`


Load a model from a ``.npy`` file


        Update the attributes. Checks that the current value is not equal to
        the new value before setting.


        Return a :class:`ParameterSet` object holding the default
        model configuration parameters, updated with any values passed on
        as keywords

        Parameters
        ----------
        **params :
            parameter values specified as key/value pairs


        Return a dictionary holding the model configuration

        This holds the value of all attributes in the
        :attr:`allowable_kwargs` list


Update the specified attribute for the models given


        The linear power evaluated at the specified `k` and at `z`,
        normalized to `sigma8_z`


        The Eisenstein-Hu no-wiggle, linear power evaluated at the specified
        `k` and at `self.z`, normalized to `sigma8_z`


        The full power spectrum term with no angular dependence. Contributions
        from P00.


        The full power spectrum term with mu^2 angular dependence. Contributions
        from P01, P11, and P02.


        The full power spectrum term with mu^4 angular dependence. Contributions
        from P11, P02, P12, P22, P03, P13 (2-loop), and P04 (2-loop).


        The full power spectrum term with mu^6 angular dependence. Contributions
        from P12, P22, P13, and P04 (2-loop).


The 1-loop auto-correlation of density.


        The 1-loop cross-correlation between dark matter density and velocity
        divergence.


The 1-loop auto-correlation of velocity divergence.


        The isotropic, zero-order term in the power expansion, corresponding
        to the density field auto-correlation. No angular dependence.


        The correlation of density and momentum density, which contributes
        mu^2 terms to the power expansion.


        The auto-correlation of momentum density, which has a scalar portion
        which contributes mu^4 terms and a vector term which contributes
        mu^2*(1-mu^2) terms to the power expansion. This is the last term to
        contain a linear contribution.


        The correlation of density and energy density, which contributes
        mu^2 and mu^4 terms to the power expansion. There are no
        linear contributions here.


        The correlation of momentum density and energy density, which contributes
        mu^4 and mu^6 terms to the power expansion. There are no linear
        contributions here. Two-loop contribution uses the mu^2 contribution
        from the P01 term.


        The autocorelation of energy density, which contributes
        mu^4, mu^6, mu^8 terms to the power expansion. There are no linear
        contributions here.


        The cross-corelation of density with the rank three tensor field
        ((1+delta)v)^3, which contributes mu^4 terms.


        The cross-correlation of momentum density with the rank three tensor field
        ((1+delta)v)^3, which contributes mu^6 terms at 1-loop order and
        mu^4 terms at 2-loop order.


        The cross-correlation of density with the rank four tensor field
        ((1+delta)v)^4, which contributes mu^4 and mu^6 terms, at 2-loop order.


        The redshift space power spectrum as a function of ``k`` and ``mu``

        This includes terms up to ``mu**self.max_mu``.

        Parameters
        ----------
        k : float or array_like
            The wavenumbers in `h/Mpc` to evaluate the model at
        mu : float, array_like
            The mu values to evaluate the power at.

        Returns
        -------
        pkmu : float, array_like
            The power model P(k, mu). If `mu` is a scalar, return dimensions
            are `(len(self.k), )`. If `mu` has dimensions (N, ), the return
            dimensions are `(len(k), N)`, i.e., each column corresponds is the
            model evaluated at different `mu` values. If `flatten = True`, then
            the returned array is raveled, with dimensions of `(N*len(self.k), )`


        The multipole moments of the redshift-space power spectrum

        Parameters
        ----------
        k : float, array_like
            The wavenumbers to evaluate the power spectrum at, in `h/Mpc`
        ells : int, array_like
            The `ell` values of the multipole moments
        Nmu : int, optional
            the number of ``mu`` bins to use when performing the multipole
            integration

        Returns
        -------
        poles : array_like
            returns tuples of arrays for each ell value in ``poles``


        Return the power spectrum with the specified transfer functions
        applied, e.g., grid binning, multipole integration, etc.

        Parameters
        ----------
        transfer : subclass of :class:`pyRSD.rsd.transfers.TransferBase`
            the transfer class


Return the AP-distorted P[mu^0]


Return the AP-distorted mu^2 P[mu^2]


Return the AP-distorted mu^4 P[mu^4]


Return the AP-distorted mu^6 P[mu^6]


        Return the derivative of :func:`power` with
        respect to `k`


        Return the derivative of :func:`power` with
        respect to `mu`


Return the power as sum of mu powers


        The monopole moment of the power spectrum. Include mu terms up to
        mu**max_mu.


        The quadrupole moment of the power spectrum. Include mu terms up to
        mu**max_mu.


        The hexadecapole moment of the power spectrum. Include mu terms up to
        mu**max_mu.


The tetrahexadecapole (ell=6) moment of the power spectrum


        Return a QuasarPowerParameters instance holding the default
        model parameters configuration

        The model associated with the parameter is ``self``


The bias type for PNG; either 1.6 or 1 usually


The FOG velocity dispersion in Mpc/h


        The value encoding the type of tracer; must be between 1 and 1.6,
        with p=1 suitable for LRGs and p=1.6 suitable for quasars

        The scale-dependent bias is proportional to: ``b1 - p``


The amplitude of the local-type non-Gaussianity


The usual critical overdensity value for collapse from Press-Schechter


        The primordial non-Gaussianity alpha value

        see e.g., equation 2 of Mueller et al 2017


The scale-dependent bias introduced by primordial non-Gaussianity


        The total bias, accounting for scale-dependent bias introduced by
        primordial non-Gaussianity


The isotropic part of the Kaiser formula


The mu^2 term of the Kaiser formula


The mu^4 term of the Kaiser formula


The mu^6 term is zero in the Kaiser formula


        Return the redshift space power spectrum at the specified value of mu,
        including terms up to ``mu**self.max_mu``.

        Parameters
        ----------
        k : float or array_like
            The wavenumbers in `h/Mpc` to evaluate the model at
        mu : float, array_like
            The mu values to evaluate the power at.

        Returns
        -------
        pkmu : float, array_like
            The power model P(k, mu). If `mu` is a scalar, return dimensions
            are `(len(self.k), )`. If `mu` has dimensions (N, ), the return
            dimensions are `(len(k), N)`, i.e., each column corresponds is the
            model evaluated at different `mu` values. If `flatten = True`, then
            the returned array is raveled, with dimensions of `(N*len(self.k), )`


Make a cache key from optionally typed positional and keyword arguments


Least-recently-used cache decorator.

    If *maxsize* is set to None, the LRU features are disabled and the cache
    can grow without bound.

    If *typed* is True, arguments of different types will be cached separately.
    For example, f(3.0) and f(3) will be treated as distinct calls with
    distinct results.

    Arguments to the cached function must be hashable.

    View the cache statistics named tuple (hits, misses, maxsize, currsize) with
    f.cache_info().  Clear the cache and statistics with f.cache_clear().
    Access the underlying function with f.__wrapped__.

    See:  http://en.wikipedia.org/wiki/Cache_algorithms#Least_Recently_Used


Clear the cache and cache statistics


Internal function to validate x, set N and y, and compute
        coefficients :math:`u_m`


rough sanity checks on the input function


    Updates the git revision string if and only if the path is being imported
    directly from a git working copy.  This ensures that the revision number in
    the version string is accurate.


    Given a file or directory name, determine the root of the git repository
    this path is under.  If given, this won't look any higher than ``levels``
    (that is, if ``levels=0`` then the given path must be the root of the git
    repository and is returned if so.

    Returns `None` if the given path could not be determined to belong to a git
    repo.


Given a value, wrap it in a 0-D numpy.ndarray with dtype=object.


    Convert values into a numpy array of at most 1-dimension, while preserving
    tuples.

    Adapted from pandas.core.common._asarray_tuplesafe


Given a pandas.Index and labels (e.g., from __getitem__) for one
    dimension, return an indexer suitable for indexing an ndarray along that
    dimension. If `index` is a pandas.MultiIndex and depending on `label`,
    return a new pandas.Index or pandas.MultiIndex (otherwise return None).


    Download the pyRSD-data github tarball to the specified directory

    Parameters
    ----------
    dirname : str
        the output directory
    example : str
        the path of the example to download


    Return the enhanced BAO wiggles power using the Hy1 model
    from arXiv:1509.02120, which enhances the wiggles of pure HZPT


    Load the power spectrum data file located in the data directory.

    Parameters
    ----------
    f : string
        File name.

    Returns
    -------
    data : ndarray, shape (N, 2)
        Data loaded from pyRSD.data_dir. Columns are k, P(k)


    The central-central auto spectrum at z = 0.509. It has 13 columns, as
    follows:

    1st: k
    2nd: P_cc^s(k,\mu=0.1)
    3rd: its error
    4th: P_cc^s(k,\mu=0.3)
    5th: its error
    ...
    10th: P_cc^s(k,\mu=0.9)
    11th: its error
    12th: P_cc^r(k)
    13th: its error


    The cross spectrum of centrals with no sats and satellites at z = 0.509.
    It has 13 columns, as follows:

    1st: k
    2nd: P_cAs^s(k,\mu=0.1)
    3rd: its error
    4th: P_cAs^s(k,\mu=0.3)
    5th: its error
    ...
    10th: P_cAs^s(k,\mu=0.9)
    11th: its error
    12th: P_cAs^r(k)
    13th: its error


    The auto spectrum of satellites with no sats in the same halo at z = 0.509.
    It has 13 columns, as follows:

    1st: k
    2nd: P_sAsA^s(k,\mu=0.1)
    3rd: its error
    4th: P_sAsA^s(k,\mu=0.3)
    5th: its error
    ...
    10th: P_sAsA^s(k,\mu=0.9)
    11th: its error
    12th: P_sAsA^r(k)
    13th: its error


    The cross spectrum of satellites with and without sats in the same halo
    at z = 0.509. It has 13 columns, as follows:

    1st: k
    2nd: P_sAsB^s(k,\mu=0.1)
    3rd: its error
    4th: P_sAsB^s(k,\mu=0.3)
    5th: its error
    ...
    10th: P_sAsB^s(k,\mu=0.9)
    11th: its error
    12th: P_sAsB^r(k)
    13th: its error


    The cross spectrum of centrals with no sats and satellites at z = 0.509,
    with satellite positions/velocities replaced by those of the halo.
    It has 11 columns, as follows:

    1st: k
    2nd: P_cAs^s(k,\mu=0.1)
    3rd: its error
    4th: P_cAs^s(k,\mu=0.3)
    5th: its error
    ...
    10th: P_cAs^s(k,\mu=0.9)
    11th: its error


    The auto spectrum of satellites with no sats in the same halo at z = 0.509,
    with satellite positions/velocities replaced by those of the halo.
    It has 11 columns, as follows:

    1st: k
    2nd: P_sAsA^s(k,\mu=0.1)
    3rd: its error
    4th: P_sAsA^s(k,\mu=0.3)
    5th: its error
    ...
    10th: P_sAsA^s(k,\mu=0.9)
    11th: its error


    The cross spectrum of satellites with and without sats in the same halo
    at z = 0.509, with satellite positions/velocities replaced by those of
    the halo.  It has 11 columns, as follows:

    1st: k
    2nd: P_sAsB^s(k,\mu=0.1)
    3rd: its error
    4th: P_sAsB^s(k,\mu=0.3)
    5th: its error
    ...
    10th: P_sAsB^s(k,\mu=0.9)
    11th: its error


    The full galaxy power spectrum in redshift space at z = 0.509.
    It has 11 columns, as follows:

    1st: k
    2nd: P_gg^s(k,\mu=0.1)
    3rd: its error
    4th: P_gg^s(k,\mu=0.3)
    5th: its error
    ...
    10th: P_gg^s(k,\mu=0.9)
    11th: its error


    The full galaxy power spectrum monopole in redshift space at z = 0.509.
    It has 3 columns, as follows:

    1st: k
    2nd: P_0
    3rd: its error


    The full galaxy power spectrum quadrupole in redshift space at z = 0.509.
    It has 3 columns, as follows:

    1st: k
    2nd: P_0
    3rd: its error


The P00 dark matter term with mu^0 angular dependence at z = 0.000


The P00 dark matter term with mu^0 angular dependence at z = 0.509


The P00 dark matter term with mu^0 angular dependence at z = 0.989


The P01 dark matter term with mu^2 angular dependence at z = 0.000


The P01 dark matter term with mu^2 angular dependence at z = 0.509


The P01 dark matter term with mu^2 angular dependence at z = 0.989


The Pdv dark matter term with mu^0 angular dependence at z = 0.000


The Pdv dark matter term with mu^0 angular dependence at z = 0.509


The Pdv dark matter term with mu^0 angular dependence at z = 0.989


The P11 dark matter term with mu^4 angular dependence at z = 0.000


The P11 dark matter term with mu^4 angular dependence at z = 0.509


The P11 dark matter term with mu^4 angular dependence at z = 0.989


The P11 dark matter term with mu^2 angular dependence at z = 0.000


The P11 dark matter term with mu^2 angular dependence at z = 0.509


The P11 dark matter term with mu^2 angular dependence at z = 0.989


    Return a pandas DataFrame holding the training data used to
    calibrate the Gaussian process for the `P_mu2` correction model,
    as measured from the runPB simulations


    Return a pandas DataFrame holding the training data used to
    calibrate the Gaussian process for the `P_mu4` correction model,
    as measured from the runPB simulations


Return the polynomial coefficients for the different nonlinear bias fits


Return the fits for the the Vlah et al. nonlinear biasing


    Return a pandas DataFrame holding the training data used to
    calibrate the Gaussian process for the bias dependence of the halo
    velocity dispersion, as measured from the runPB simulations


    Return a pandas DataFrame holding the training data used to
    calibrate the Gaussian process for the auto stochasiticity,
    as measured from the runPB simulations


    Return a pandas DataFrame holding the training data used to
    calibrate the Gaussian process for the cross stochasiticity,
    as measured from the runPB simulations


Return P00(k,z) in SPT


Return P01(k,z) in SPT


Return Pdv(k,z) in SPT


    Fit a smooth function to the measured P00 from simulations, extrapolating
    using SPT at low-k


    Fit a smooth function to the measured P01 from simulations, extrapolating
    using SPT at low-k


    Fit a smooth function to the measured P11 from simulations, extrapolating
    using SPT at low-k


    Fit a smooth function to the measured Pdv from simulations, extrapolating
    using SPT at low-k


The main function


Update the redshift-dependent quantities


Return a new, formatted axes


r"""

    This function is copied from:
    https://github.com/pypa/pip/blob/master/pip/utils/appdirs.py

    Return full path to the user-specific cache dir for this application.

    Parameters
    ----------
    appname : str
        the name of application

    Notes
    -----
    Typical user cache directories are:

        - Mac OS X: ~/Library/Caches/<AppName>
        - Unix: ~/.cache/<AppName> (XDG default)


Load a result from file


Print out the help information for the necessary initialization parameters


The type of tracer, either 'galaxy' or 'quasar'


        A decorator to wrap the default theory output.

        Users can use this to compute linear combinations of multipoles, for
        example.


        An integer specifying the number of MCMC steps to consider as part
        of the "burn-in" period when saving the results

        This doesn't affect the parameter estimation at all; it simply
        changes what best-fit parameters are printed to the screen when
        the fitting is over. All iterations are saved to file regardless of
        the value of this parameter.


The Gelman-Rubin convergence criterion


        The percentage of additional scatter to add to the initial fitting
        parameters; default is 0


        The step-size for derivatives in LBFGS; default is 1e-4

        A dictionary can supplied where keys specify the value to use
        for specific free parameters


Configuration options to pass to the LBFGS solver


        Whether to use priors when solving with the LBFGS algorithm; default
        is ``True``


If `True`, evaluate gradients of P(k,mu) numerically using finite difference


        If `True`, evaluate the gradient by taking the numerical derivative
        of :func:`minus_lnlike`


The name of a result file to initialize the optimization from


        Model parameters to be updated for each statistic; keys of this
        dict should be the names of a statistic


        Load a :class:`FittingDriver` from a results directory

        This reads ``params.dat`` file, optionally loading a pickled model and
        a results object from file

        Parameters
        ----------
        dirname : str
            the name of the directory holding the results
        results_file : str, optional
            the name of the file holding the results. Default is ``None``
        model_file : str, optional
            the name of the file holding the model to load. Default is ``None``
        init_model : bool, optional
            whether to initialize the RSD model upon loading. If a model
            file exists in the specified directory, the model is loaded and
            no new model is initialized


        Return a :class:`ParameterSet` object using a mix of the default
        parameters and the parameters specified as keywords

        .. note::
            All required parameters (see :attr:`required_params`) must be
            specified as keywords or an exception will be raised

        Parameters
        ----------
        **params :
            parameter values specified as key/value pairs


        Given the data, theory, and input parameters generate the
        callable function that returns the theory measurements.

        The hard part here is determining how many P(k,mu) calls
        we need to make.


        Apply a function for several results files

        Parameters
        ----------
        func : callable
            the function
        pattern : str
            the pattern to match result files on

        Returns
        -------
        k, result : array_like
            the stacked results file


        Write the parameters of this driver to a file

        Parameters
        ----------
        filename : str
            the name of the file to write out
        mode : {'a', 'w'}
            the mode to use when writing to file


        Run the whole fitting analysis, from start to finish

        Parameters
        ----------
        solver_type : {'mcmc', 'nlopt'}
            either run a MCMC fit with emcee or a nonlinear optimization using LBFGS
        pool : MPIPool, optional
            a MPI pool object to distribute tasks too
        chains_comm : MPI communicator, optional
            a communicator for communicating between multiple MCMC chains


Finalize the fit, saving the results file


        Find the peak of the probability distribution

        This uses either the maximum likelihood (ML) (excluding log priors) or
        maximum a posteriori probability (MAP) (including log priors) estimation


Setup the model callables for this set of data


The `results` object storing the fitting results


        Set the results, checking to make sure we re-order the fitted params
        into the right order


The `model` object which returns the P(k,mu) or multipoles theory


Set the theoretical model


        The model values for each measurement, flattened column-wise
        into a single array.

        Optionally, ``theory_decorator`` is applied.

        Notes
        -----
        The model callable should already returned the flattened `combined` values


        Return the log-likelihood value for a null model, to be used
        when the model parameters are in an invalid state


        The number of degrees of freedom

        This is equal to the number of data points minus the number of free parameters


The number of data points


The number of free parameters


Return the log of the prior, based on the current values of the free parameters


r"""
        The chi-squared for the specified model function

        This returns

        .. math::

            \chi^2 = (\mathcal{M} - \mathcal{D})^T C^{-1} (\mathcal{M} - \mathcal{D})

        Parameters
        ----------
        theta : array_like, optional
            an array of the free parameters to evaluate the statistic at; if ``None``,
            the current values of the free parameters in :attr:`theory.fit_params`
            is used


The reduced chi squared value, using the current values of the free parameters


        The log of the likelihood, equal to -0.5 * :func:`chi2`

        Parameters
        ----------
        theta : array_like, optional
            an array of the free parameters to evaluate the statistic at; if ``None``,
            the current values of the free parameters in :attr:`theory.fit_params`
            is used


        Set the theory free parameters, update the model, and return the log of the posterior probability function

        This returns -0.5 :func:`chi2` + :func:`lnprior`

        Parameters
        ----------
        theta : array_like, optional
            an array of the free parameters to evaluate the statistic at; if ``None``,
            the current values of the free parameters in :attr:`theory.fit_params`
            is used


        Return the negative log-likelihood, optionally including priors

        Parameters
        ----------
        theta : array_like, optional
            an array of the free parameters to evaluate the statistic at; if ``None``,
            the current values of the free parameters in :attr:`theory.fit_params`
            is used
        use_priors : bool, optional
            whether to include the log priors in the objective function when
            minimizing the negative log probability


        Return the vector of the gradient of the negative log likelihood, with respect to the free parameters

        This uses a central-difference finite-difference approximation to
        compute the numerical derivatives

        Parameters
        ----------
        theta : array_like, optional
            if provided, the values of the free parameters to compute the
            gradient at; if not provided, the current values of free parameters
            from :attr:`theory.fit_params` will be used
        epsilon : float or array_like, optional
            the step-size to use in the finite-difference derivative calculation;
            default is `1e-4` -- can be different for each parameter
        pool : MPIPool, optional
            a MPI Pool object to distribute the calculations of derivatives to
            multiple processes in parallel
        use_priors : bool, optional
            whether to include the log priors in the objective function when
            minimizing the negative log probability
        numerical : bool, optional
            if `True`, evaluate gradients of P(k,mu) numerically using finite difference
        numerical_from_lnlike : bool, optional
            if `True`, evaluate the gradient by taking the numerical derivative
            of :func:`minus_lnlike`


r"""
        Return the Fisher information matrix

        This is defined as the negative Hessian of the log likelihood with
        respect to the parameter vector

        .. math::

            F_{ij} = - \frac{\partial^2 \log \mathcal{L}}{\partial \theta_i \partial \theta_j}

        This uses a central-difference finite-difference approximation to
        compute the numerical derivatives

        Parameters
        ----------
        theta : array_like, optional
            if provided, the values of the free parameters to compute the
            gradient at; if not provided, the current values of free parameters
            from `theory.fit_params` will be used
        epsilon : float or array_like, optional
            the step-size to use in the finite-difference derivative calculation;
            default is `1e-4` -- can be different for each parameter
        pool : MPIPool, optional
            a MPI Pool object to distribute the calculations of derivatives to
            multiple processes in parallel
        use_priors : bool, optional
            whether to include the log priors in the objective function when
            minimizing the negative log probability
        numerical : bool, optional
            if `True`, evaluate gradients of P(k,mu) numerically using finite difference
        numerical_from_lnlike : bool, optional
            if `True`, evaluate the gradient by taking the numerical derivative
            of :func:`minus_lnlike`


        Return the Jacobian between the input (constrained) parameters and the
        free parameters, holding dp' / dp where p' is the set of constrained
        ``params`` and p is the set of free parameters

        Parameters
        ----------
        params : list
            list of the constrained parameters
        theta : array_like, optional
            free parameter values to evaluate Jacobian of transformation at

        Returns
        -------
        J : array_like (self.Np, len(params))
            the Jacobian


        Return the marginalized errors on the specified parameters, as computed from the Fisher matrix

        This is given by: :math:`(\mathcal{F}^{-1}))^(1/2)`

        Optionally, we can fix certain parameters, specified in ``fixed``

        Parameters
        ----------
        params : list, optional
            return errors for this parameters; default is all free parameters
        theta : array_like, optional
            the array of free parameters to evaluate the best-fit model at
        fixed : list, optional
            list of free parameters to fix when evaluating marginalized errors
        **kws :
            additional keywords passed to :func:`fisher`

        Returns
        -------
        errors : array_like
            the marginalized errors as computed from the inverse of the
            Fisher matrix


        Return the data - model pairs for each measurement

        Returns
        -------
        toret : list
            A list of (k_data, data, err, model) for each measurement
            in ``data.measurements``


Plot the residuals of the best-fit theory and data


        Make an interactive plot of the best-fit theory and data points using
        :mod:`plotly`.


Plot the best-fit theory and data points


    Return the name of the file holding the maximum probability
    from a directory


        Parse the command-line options and return an
        initialized `RSDFitDriver`.


        Parse the command-line arguments from the
        parser returned by `rsdfit_parser()`


Initialize the driver that runs the desired algorithm.


Do some preprocessing


Return the name of the output file


        Run the full `rsdfit` pipeline

        This uses `MPIManager` to enforce the pool behavior when calling
        the `run` function of the desired algorithm


    Return P(k,mu) normalization, using the current
    values of `f` and `b1`, and the properly normalized
    no-wiggle linear power spectrum

    Returns
    -------
    callable :
        the P(k,mu) function callable


    Return P(k,ell=0) monopole normalization, using the current
    values of `f` and `b1`, and the properly normalized
    no-wiggle linear power spectrum

    Returns
    -------
    callable :
        the P(k,ell=0) function callable


    Plot the normalized data from the input `FittingDriver`

    Parameters
    ----------
    driver : FittingDriver
        the driver instances used to run the fitting procedure
    offset : float, optional
        whether to offset the individual data statistics
    use_labels : bool, optional
        whether to label the individual statistics
    **kwargs :
        additional keywords to pass to the ``errorbar()`` function


    Plot the normalized theory from the input `FittingDriver`

    Parameters
    ----------
    driver : FittingDriver
        the driver instances used to run the fitting procedure
    offset : float, optional
        whether to offset the individual data statistics
    **kwargs :
        additional keywords to pass to the ``plot()`` function


Plot the model and data points for any P(k,mu) measurements


Divide the ranks into N chunks


    Load an instance, i.e., `FittingDriver`, `EmceeResults` that has been
    pickled


Pickle an instance using `pickle`


Load a model from file


    Automatically create a new name for the results file.

    This routine takes care of organizing the folder for you. It will
    automatically generate names for the new chains according to the date,
    number of points chosen.


Store the covariance matrix to a file


Store the bestfit parameters to a file


Store the posterior distribution to a file


Recover a stored 1d posterior


Store the histogram information to a file, to plot it later


    Read the histogram information that was stored in a file.
    To use it, call something like this:
    .. code::
        x_centers, y_centers, extent, hist = read_histogram_2d_from_file(path)
        fig, ax = plt.subplots()
        ax.contourf(
            y_centers, x_centers, hist, extent=extent,
            levels=ctr_level(hist, [0.68, 0.95]),
            zorder=5, cma=plt.cm.autumn_r)
        plt.show()


    Check if the file exists. If not raise an error

    Parameters
    ----------
    fname: str
        the name of the file to read

    Returns
    -------
    fname : string


    Check if the input is integer positive

    Parameters
    ----------
    string: str
        string to parse
    output: int
        return the integer


    Initialize the parser of command-line arguments.

    The main parser has three subparsers, `run`, `restart`, and `analyze`.
    If you run :code:`rsdfit -h`, this information will be printed to
    the console. Further help information can be found by including the name
    of a specific subcommand, i.e., run code:`rsdfit run -h`.


Run a few quick verification tests on the supplied arguments


Copy the contents of the log from the temporary log file


Add a logger that logs to the console at level `INFO`.


Report the current status of the sampler.


    Perform MCMC sampling of the parameter space of a system using `emcee`

    Parameters
    ----------
    params : ParameterSet
        This holds the parameters needed to run the `emcee` fitter
    fit_params : ParameterSet
        the theoretical parameters
    pool : emcee.MPIPool, optional
        Pool object if we are using MPI to run emcee
    init_values : array_like, `EmceeResults`
        Initial positions; if not `None`, initialize the emcee walkers
        in a small, random ball around these positions

    Notes
    -----

    *   Have a look at the `acortime`, it is good practice to let the sampler
        run at least 10 times the `acortime`. If ``acortime = np.nan``, you
        probably need to take more iterations!
    *   Use as many walkers as possible (hundreds for a handful of parameters)
        Number of walkers must be even and at least twice the number of
        parameters
    *   Beware of a burn-in period. The most conservative you can get is making
        a histogram of only the final states of all walkers.


        Update the `State`, copying the elements of the
        input `X` and `G` arrays into memory owned by
        this object


Return a full copy of the current `State`


        Update the inverse Hessian, by iterating the `s`, `y`,
        and `rho` arrays and updating the value of `H0k`


        Return a dictionary of the default options for the LBFGS
        optimization algorithm

        Stopping criteria based on tolerance of objective function
        and its gradient:

        1) ``(f^k - f^{k+1})/max{|f^k|,|f^{k+1}|,1} <= factr * eps``
            where ``eps`` is the machine precision
        2) ``max(abs(G_k)) <= gtol``

        Parameters
        ----------
        factr : float
            The iteration stops when ``(f^k -
            f^{k+1})/max{|f^k|,|f^{k+1}|,1} <= factr * eps``, where ``eps``
            is the machine precision, which is automatically generated by
            the code. Typical values for `factr` are: 1e12 for low
            accuracy; 1e7 for moderate accuracy; 10.0 for extremely high
            accuracy. Default is 1e5
        gtol : float
            the absolute tolerance of the gradient norm required for
            convergence; default is 1e-5
        max_iter : int
            the maximum number of steps to run; default is `500`
        display : int
            the level of logging desired; default is second to highest, `2`
        record : list of str
            the names of variables to track per iteration; default
            is `F` and `Gnorm`


        Record the progress of each iteration for all variables
        specified in `options['record']`


Test the convergence of the current state


Information about the parameters for the current iteration


Information about the gradient vector for the current iteration


The current convergence status


        Compute the parameter step direction, using the LBFGS algorithm

        This closely follows the notation here:
        https://en.wikipedia.org/wiki/Limited-memory_BFGS

        Parameters
        ----------
        it : int
            the current iteration step
        a : array_like, (M,)
            this is a scratch workspace to compute `alpha`,
            and is passed in so we don't have to allocate for every step

        Returns
        -------
        z : array_like, (M,)
            the LBFGS step direction


        Run the full nonlinear optimization, stopping only when
        convergence is reached or the maximum number of iterations
        has been exceeded

        See `LBFGS.default_options()` for default keyword options


        Use scipy's backtracking Armijo line search to find the
        new search parameters

        Parameters
        ----------
        state : State
            the current state object
        pk : array_like
            the search direction

        Returns
        -------
        newX : array_like
            the new parameters satisfying the Armijo condition
        newF : float
            the value of the objective function at ``newX``

        Raises
        ------
        LineSearchError :
            cannot find suitable parameters that minimizes objective in
            this direction


        Advance the minimization algorithm ``max_iter`` steps as a generator

        See `LBFGS.default_options()` for default keyword options


Initialize by drawing from the prior


    Perform nonlinear fitting of a system using `scipy.optimize`.

    Any kwargs passed will not be used


    Initialize variables from univariate prior

    Parameters
    ----------
    fit_params : ParameterSet
        the theoretical parameters
    nwalkers : int
        the number of walkers used in fitting with `emcee`
    draw_from : str, {'prior', 'posterior'}, optional
        either draw from the prior or the posterior to initialize
    logger : logging.Logger, optional
        Log output to this logger


    Initialize parameters with multivariate normals

    Parameters
    ----------
    fit_params : ParameterSet
        the theoretical parameters
    nwalkers : int
        the number of walkers used in fitting with `emcee`
    draw_from : str, {'prior', 'posterior'}
        either draw from the prior or the posterior to initialize
    logger : logging.Logger, optional
        Log output to this logger


Wrapper for the negative log-likelihood


Wrapper for the negative log-probability (including priors)


Wrapper for the log-probability (including priors)


    Wrapper for ``FittingDriver.gradient`` which explictly
    grabs the pickeable ``nlopt_lnlike``


The fiducial value of the parameter


The number of iterations to exclude as part of the "burn-in" phase


Rescale errors by this factor


        Returns the flattened chain, excluding steps that occured during the
        "burnin" period


Return the median of the trace, i.e., the 50th percentile of the trace


Return the average value of the chain


        Return the value of the parameter that gives the peak of the
        posterior PDF, as determined through Gaussian kernel density estimation


        Return the lower and upper one-sigma error intervals

        These are computed from the percentiles, ``50 - 15.86555`` and ``84.13445 - 50``

        Returns
        -------
        lower, upper
            The lower and upper 1-sigma error intervals


        Return the lower and upper two-sigma error intervals.

        These are computed from the percentiles, ``50 - 2.2775`` and ``97.7225 - 50``

        Returns
        -------
        lower, upper
            The lower and upper 2-sigma error intervals


        Return the lower and upper three-sigma error intervals

        There are computed from the percentiles, ``50 - 0.135`` and ``99.865 - 50``

        Returns
        -------
        lower, upper
            The lower and upper 3-sigma error intervals


        Return the sample values at a specific iteration number.

        shape: (nwalkers, niters)


The one-sigma standard error, averaging the lower and upper bounds


Save the relevant information of the class to a numpy ``npz`` file


Load a numpy ``npz`` file and return the corresponding ``EmceeResults`` object


        Verify the ordering of `EmceeResults.chain`, making sure that the
        chains have the ordering specified by `free_params` and
        `constrained_params`


Return a deep copy of the `EmceeResults` object


Make the chain for the constrained parameters


Make the dictionary of `EmceeParameters`


The number of iterations performed, as computed from the chain


The number of walkers, as computed from the chain


        The number of iterations to treat as part of the "burnin" period, where
        the chain hasn't stabilized yet


Rescale error on parameters due to covariance matrix from mocks


The value of the maximum log probability


        Return the value of the free parameters at the iteration with the maximum
        probability


        Return the value of the constrained parameters at the iteration
        with the maximum probability


        Convenience function to return the median values for the free parameters
        as an array


        Convenience function to return the median values for the constrained
        parameters as an array


        Convenience function to return the peak values for the free parameters
        as an array


        Convenience function to return the peak values for the
        constrained parameters
        as an array


        Plot the chain timeline for as many parameters as specified in the
        `names` tuple.

        This plots the value of each walker as a function
        of iteration.

        Notes
        ------
        Any iterations during the "burnin" period are excluded

        Parameters
        ----------
        names : tuple
            The string names of the parameters to plot
        outfile : str, optional
            If not `None`, save the resulting figure with the specified name

        Returns
        -------
        fig : matplotlib.Figure
            The figure object


        Make a triange plot for the desired parameters using the
        :func:`corner.corner` function.

        Notes
        -----
        Any iterations during the "burnin" period are excluded

        Parameters
        ----------
        names : tuple
            The string names of the parameters to plot
        thin : int, optional
            The factor to thin the number of samples plotted by. Default is
            1 (plot all samples)
        outfile : str, optional
            If not `None`, save the resulting figure with the specified name

        Returns
        -------
        fig : matplotlib.Figure
            The figure object


        Plot the 2D traces of the given parameters, using KDE via the :func:`seaborn.jointplot` function.

        Notes
        -----
        Any iterations during the "burnin" period are excluded

        Parameters
        ----------
        param1 : str
            the name of the first parameter
        param2 : str
            the name of the second parameter
        thin : int, optional
            thin the plotted array randomly by this amount
        rename : dict, optional
            dictionary giving a string to rename each variable; default
            will try to use any latex names stored
        crosshairs : dict, optional
            values to show as horizontal or vertical lines
        **kwargs :
            additional keyword arguments to pass to ``seaborn``


        Plot the 2D traces of the given parameters, using KDE via :func:`seaborn.kdeplot`

        Notes
        -----
        Any iterations during the "burnin" period are excluded

        Parameters
        ----------
        param1 : str
            the name of the first parameter
        param2 : str
            the name of the second parameter
        thin : int, optional
            thin the plotted array randomly by this amount
        rename : dict, optional
            dictionary giving a string to rename each variable; default
            will try to use any latex names stored
        crosshairs : dict, optional
            values to show as horizontal or vertical lines
        **kwargs :
            additional keyword arguments to pass to ``seaborn``


        Summarize the fit, by plotting figures and outputing the relevant
        information


        Return a dictionary of the values, either the `median`,
        `peak`, or `max_lnprob`


        Return a pandas DataFrame holding the chains (flat traces) as
        columns for both the free and constrained parameters

        Note that any burnin is removed from the chains.

        Parameters
        ----------
        params : list, {'free', 'constrained'}, optional
            return only a subset of the parameters
        use_latex : bool, optional
            If `True`, try to use any available latex names for the tick
            labels; default is `False`

        Returns
        -------
        DataFrame :
            the DataFrame holding the flat traces for all parameters


        Return a pandas DataFrame holding the correlation matrix,
        as computed from the ``chains`` DataFrame, for all
        parameters

        Parameters
        ----------
        params : list, {'free', 'constrained'}, optional
            return only a subset of the parameters
        use_latex : bool, optional
            If `True`, try to use any available latex names for the tick
            labels; default is `False`

        Returns
        -------
        DataFrame (Np, Np) :
            the DataFrame holding the correlation between parameters


        Plot the diagonal correlation matrix, using ``seaborn.heatmap``

        Parameters
        ----------
        params : list, {'free', 'constrained'}, optional
            return only a subset of the parameters
        use_latex : bool, optional
            If `True`, try to use any available latex names for the tick
            labels; default is `True`. You might want to set this to `False`
            if you are trying to use mpld3


The total number of iterations ran


        Verify the ordering of of parameters, making sure that the
        ordering specified by `free_params` and  `constrained_params` is
        respected in the results


Load a numpy ``npz`` file and return the corresponding :class:`LBFGSResults` object


Get the values for the constrained parameters at min chi2


Return a deep copy of the :class:`LBFGSResults` object


Summarize the fit by printing self


Return optimal number of bins.


        Return the minimum and maximum of the normal distribution.

        For a normal distribution, we define the upper and lower limit as

        ..math: \pm 3*factor*self.sigma


        Draw random value(s) from the normal distribution.

        Parameters
        ----------
        size : int
            the number of values to generate

        Returns
        -------
        values : float, array_like
            random value(s) from the distribution


        Draw regularly sampled values from the distribution, spaced
        according to the probability density.

        We grid uniformly in the cumulative probability density function.


        Return the probability distribution function

        Parameters
        ----------
        domain : array_like
            The values to compute the pdf at. If `None`, sample equidistantly
            between the limits of the distrbution
        factor : float
            The factor by which to scale the distribution limits


        Return the derivative of the normal PDF at the
        specified domain values


        Return the natural log of the normal PDF at the
        specified domain values


        Return the derivative of the natural log of the
        normal PDF at the specified domain values


        Return the cumulative distribution function

        Parameters
        ----------
        domain : array_like
            The values to compute the cdf at. If `None`, sample equidistantly
            between the limits of the distrbution
        factor : float
            The factor by which to scale the distribution limits


Plot a normal prior to the current axes.


Return the `loc` parameter used by `numpy`, equal here to `self.mu`


Return the `scale` parameter used by `numpy`, equal here to `self.sigma`


Make this a property in case the supplied `lower` is actually a function


Make this a property in case the supplied `upper` is actually a function


        Use an analytic approximation to the Heaviside step function,
        returning the `Rectangular` function, aka step function


Derivative of the analytic uniform pdf


The log of the analytic approximation of the pdf


Derivative of the log of the analytic uniform pdf


Return the minimum and maximum of the uniform distribution.


        Draw random value(s) from the uniform distribution.

        Parameters
        ----------
        size : int
            the number of values to generate

        Returns
        -------
        values : float, array_like
            random value(s) from the distribution


Draw a (set of) likely value(s) from the uniform distribution.


        Return the derivative of the uniform PDF at the
        specified domain values


        Return the natural log of the uniform PDF at the
        specified domain values, optionally using an analytic
        approximation


        Return the derivative of the natural log of the uniform PDF
        at the specified domain values


Plot a uniform prior to the current axes.


Return the `loc` parameter used by `numpy`, equal here to `self.lower`


        Return the `scale` parameter used by `numpy`, equal here to
        `self.upper` - `self.lower`


Return the minimum and maximum of the trace distribution.


        Draw a (set of) random value(s) from the trace.

        Parameters
        ----------
        size : int, optional
            the number of random_variates to return; default = 1


Draw a (set of) likely value(s) from the trace


        Returns a random variate from the discrete distribution using the
        inverse transform sampling method

        Parameters
        ----------
        size : int, optional
            the number of random_variates to return; default = 1
        cum_sampling : array_like
            values between 0 and 1 to sample the cumulative distribution at. If
            `None`, draw random cumulative samples


        Return the (binned) probability distribution function

        Parameters
        ----------
        domain : array_like
            The values to compute the pdf at. If `None`, sample equidistantly
            between the limits of the distrbution
        factor : float
            The factor by which to scale the distribution limits


        Return the (binned) cumulative distribution function

        Parameters
        ----------
        domain : array_like
            The values to compute the cdf at. If `None`, sample equidistantly
            between the limits of the distrbution
        factor : float
            The factor by which to scale the distribution limits


        Return the `loc` parameter used by `numpy`, equal here to the
        median of `self.trace`


        Return the `scale` parameter used by `numpy`, equal here to the standard
        deviation of `self.trace`


Plot the trace distribution to the current axes.


Context manager to handle delaying asteval evaluation


        Read a file and return a `collections.defaultdict` with the keys given
        by `tags` and the values given by a `lmfit.Parameters` object

        Parameters
        ----------
        filename : str
            the name of the file to read parameters from
        tags : list, optional
            list of any parameter tags to specifically seach for


        Output the `ParameterSet` to a file, using the mode specified.
        Optionally, add a header and/or footer to make it look nice.

        If `as_dict = True`, output the parameter as a dictionary, otherwise
        just output the value

        Parameters
        ----------
        filename : str
            the name of the file to write
        prefix : str, optional
            include a prefix when writing out parameter keys
        mode : str, optional
            the file mode, i.e., 'w' to write, 'a' to append
        header_name : str, optional
            write out a comment header first
        footer : bool, optional
            whether to write out a footer comment
        as_dict : bool, optional
            write out Parameter objects as a dictionary, instead of just the value


Register a function in the ``symtable`` of the ``asteval`` attribute


        Prepare the parameters by parsing the dependencies. We initialize the
        ``ast`` classes in order to evaluate any constrained parameters


Update the fiducial values of the constrained parameters


        Update the values of all parameters, checking that dependencies are
        evaluated as needed.

        Parameters
        ----------
        *args : tuple of str
            the parameter names for which we want to update the parameter constraints
        **kwargs :
            update the values of these parameters, and then update the constraints
            then depend on these parameters, only if the value of the parameters
            changed


        Add a `Parameter` with `name` to the ParameterSet with the specified
        `value`.


        Convert the parameter set to a dictionary using (`name`, `value`)
        as the (key, value) pairs


        Update the `Parameter` specified by `name` with the keyword arguments
        provided


The list of 'free' data types for the structured array


        Return the free parameter names. `Free` means that
        `Parameter.vary = True` and `Parameter.constrained = False`


        Return the free parameter values. `Free` means that
        `Parameter.vary = True` and `Parameter.constrained = False`


        Return a list of the free `Parameter` objects. `Free` means that
        `Parameter.vary = True` and `Parameter.constrained = False`


        Return the constrained parameter names. `Constrained` means that
        `Parameter.constrained = True`


The list of 'constrained' data types for the structured array


Return the constrained parameter values.


Return a list of the constrained `Parameter` objects.


The scales of the free parameters


The locs of the free parameters


        Return the constraint derivative at the specified values of free
        parameters. If `theta` is not specified, the current values are used.

        This returns d`name` / d`wrt`

        Parameters
        ----------
        name : str
            the name of the constrained derivative to take the derivative of
        wrt : str
            the name of the free parameter to the derivative with respect to
        theta : array_like, optional
            the array of free parameters to evaluate the derivative at

        Returns
        -------
        grad : float
            the value of the gradient


Custom version that does not set max/min to +/-inf by default


Update the attributes of the Parameter


get value, with bounds applied


The data type of the parameter


Explicit value for output -- defaults to `value`


        If `True`, use an analytic approximation for `Uniform` priors and the
        min/max bounds


The minimum allowed value (inclusive)


The maximum allowed value (exclusive)


Custom setter to handle $ in values and store :attr:`user_data`


A fiducial value associated with this parameter


The parameter description


The lower limit of the uniform prior


The upper limit of the uniform prior


The mean value of the normal prior


The standard deviation of the normal prior


The name of the prior distribution


The prior distribution


Whether the parameter has a prior defined


Whether the parameter has a fiducial value defined


The distribution representing the minimum bound


Parameter is bounded if either `min` or `max` is defined


Parameter is constrained if the `Parameter.expr == None`


Set the constrained value


        Return log of the prior, which is either a uniform or normal prior.
        If the current value is outside `Parameter.min` or `Parameter.max`,
        return `numpy.inf`


        Return the derivative of the log of the prior, which is either a
        uniform or normal prior. If the current value is outside
        `Parameter.min` or `Parameter.max`, return `numpy.inf`


        Returns `True` if the specified value is within the (min, max)
        bounds and if the prior is uniform, within the lower/upper values
        of the prior


Convert the `Parameter` object to a dictionary


        The `scale` of the parameter as determined from the
        prior


        The `loc` of the parameter as determined from the
        prior


    Given a string containing the name of a function, convert it to a function

    Parameters
    ----------
    astr : str
        the string to convert to a function name


    Given a string s and a dictionary of variables D, replace all variable
    names with the value from the dict D

    variable names in s are denoted by '$(' at the beginning and ')' at
    the end, or '$' at the beginning and a non-variable character at the
    end.  Variables must be valid python variable names, that is they
    consist of only alphanumeric characters (A-Z,a-z,0-9) and underscores,
    and cannot start with a number.

    example:
    >> D = {'my_var1' : 'abc',
            'my_var2' : '123' }
    >> s = "I know my $(my_var1)s and $my_var2's"
    >> print replace_vars(s,D)

    I know my abcs and 123's


    Find any function calls in the string specified by `line`, import the
    necessary modules, and return a dict of the imported modules


Verify the line read makes sense


Thin the chains


Format the latex name of a parameter that has been scaled


    Create an array with all the points from the chains, after burnin

    Returns
    -------
    chains : list of arrays
        A list of chains, where each chain contains
        the free + constrained params and 'burn-in' iterations have
        been removed
    combined_result : EmceeResults
        a EmceeResults object holding the combined chains


    Scan the whole input folder, and include all chains in it.
    Since you can decide to analyze some file(s), or a complete folder, this
    function first needs to separate between the two cases.

    Parameters
    ----------
    info : AnalysisDriver instance
        Used to store the result
    files : list
        list of potentially only one element, containing the files to analyze.
        This can be only one file, or the encompassing folder, files


    Distinguish the cases when analyze is called with files or folder
    Note that this takes place chronologically after the function
    `separate_files`


Extract parameter names from the results files


Extract the contours for the 2d plots (Karim Benabed)


Small routine to accomodate the absence of the interpolate module


    Compute the marginalized 1D and 2D posterior distributions,
    and optionally plot them


Plot the 1D posteriors for the specified parameters on one figure


Plot the 2D posteriors for the specified parameters on one figure


Return the Gelman-Rubin convergence parameter


    Compute convergence for the desired chains, using Gelman-Rubin diagnostic
    Chains have been stored in the info instance of :class:`Information`. Note
    that the G-R diagnostic can be computed for a single chain, albeit it will
    most probably give absurd results. To do so, it separates the chain into
    three subchains.


Extract minimum credible intervals (method from Jan Haman)


    Function to apply to a `pandas.DataFrame` to transform the `median`,
    `upper_1sigma`, and `lower_1sigma` into a median +/- errors formatted
    string


    Transform the input `DataFrame` (or subclass) to a `DataFrame` with columns
    appropriate for being output as a latex table

    Parameters
    ----------
    df : DataFrame, or subclass
        the frame holding the data which will be formatted

    Returns
    -------
    toret : DataFrame
        the frame holding the formatted data


    Transform the input `DataFrame` (or subclass) to a `DataFrame` with columns
    appropriate for being output as an html table

    Parameters
    ----------
    df : DataFrame, or subclass
        the frame holding the data which will be formatted

    Returns
    -------
    toret : DataFrame
        the frame holding the formatted data


Write out a comparison table from multiple BestfitParameterSet instances


        Attach the keyword arguments to the `BestfitParameterSet` as attributes
        and keep track of names in `_user_metadata`


        Initialize the `BestfitParameterSet` class from a plaintext ``info`` file

        Parameters
        ----------
        filename : str
            the name of the `info` file to load


        Initialize the `BestfitParameterSet` class from an `LBFGSResults`
        instance from a nonlinear optimization fit using LBFGS

        Parameters
        ----------
        r : LBFGSResults
            an instance holding the best-fit parameters from an nlopt LBFGS fit
        **meta : kwargs
            any additional keywords to attach as meta-data


        Initialize the `BestfitParameterSet` class from an `EmceeResults`
        instance from an MCMC fit using `emcee`

        Parameters
        ----------
        r : EmceeResults
            an instance holding the best-fit parameters from an emcee mcmc fit
        **meta : kwargs
            any additional keywords to attach as meta-data


        Write out the parameter set as a plaintext ``info`` file

        Parameters
        ----------
        filename : str
            the name of the file to write to


Internal function to format the default latex table and output


        Write out the bestfit parameters as a latex table

        Parameters
        ----------
        filename : str or None, optional (`None`)
            the name of the file to write to, or if `None`, simply return
            the output string
        caption : str, optional (`""`)
            an optional string which is intepreted as the caption for the table
        include_fit_info : bool, optional (`True`)
            if `True`, include information about the best log-likelihood, number
            of parameters, number of data points, and reduced chi2 as a footer
            of the table


        Return a table representation in html format, suitable for nice
        viewing in `ipython notebook`

        Parameters
        ----------
        params : list of str, optional (`None`)
            restrict the output table to only include the specified parameters


Run the full analysis of the input mcmc files


Scale the error on parameters due to covariance matrix from mocks


        The global minimum of the minus log likelihood, across all chains
        that we are analyzing


The covariance matrix of free + constrained parameters


The 1, 2, and 3-sigma bounds


Bestfit parameter set


Define the min and max x-range values and set the axis ticks accordingly


Write out the covariance matrix


Write out the best-fit info file and the latex tables


The mass variance at r = 8 Mpc/h at `z`


The growth rate, f = dlnD/dlna at `z`


The Alcock-Paczynski effect parameter for perpendicular to the line-of-sight


The Alcock-Paczynski effect parameter for parallel to the line-of-sight


The ratio of the sound horizon at `z_drag` in the fiducial and true cosmologies


The linear bias of type A centrals (no satellites in the same halo)


The linear bias of type B centrals (1 or more satellite(s) in the same halo)


The linear bias of type A satellites (no other satellites in the same halo)


The linear bias of type B satellites (1 or more other satellites in the same halo)


The satellite fraction


The fraction of centrals that are classified as type B


The fraction of satellites that are classified as type B


The mean number of satellites in halos with >1 sat


The centrals Finger-of-God velocity disperion in Mpc/h


The type A satellites Finger-of-God velocity disperion in Mpc/h


The type B satellites Finger-of-God velocity disperion in Mpc/h


The amplitude of the 1-halo power for type B centrals and satellites in (Mpc/h)^3


The amplitude of the 1-halo power for type B satellites in (Mpc/h)^3


The number density of the sample in (Mpc/h)^(-3)


A constant shot noise offset to the model, in (Mpc/h)^3


The extra satellite fraction accounting for differences between SO and FoF halos


The velocity dispersion in Mpc/h accounting for differences between SO and FoF halos


The relative fraction of ``b1_sA`` to ``b1_cA``


The relative fraction of ``b1_sB`` to ``b1_cA``


The relative fraction of ``b1_cB`` to ``b1_cA``


The relative fraction of ``sigma_sB`` to ``sigma_s``


The relative fraction of ``sigma_sA`` to ``sigma_s``


An order unity amplitude value multiplying the 1-halo term, ``NcBs``


An order unity amplitude value multiplying the 1-halo term, ``NsBsB``


The linear bias of centrals


The linear bias of satellites


The total linear bias


The value of f(z)*sigma8(z) at z of measurement


The value of b1(z)*sigma8(z) at z of measurement


The AP parameter: ``alpha_par/alpha_perp``


The isotropic AP dilation


The anisotropic AP warping


The linear bias of the quasar


The Finger-of-God velocity disperion in Mpc/h


The primordial non-Gaussianity amplitude


    This is a decorator which can be used to mark parameters
    as deprecated


Decorator to represent a freely varying model parameter


    Decorator to represent a model parameter, either fixed
    or free


        Output the theory `ParameterSet` to a file, using the mode specified.

        Parameters
        ----------
        filename : str
            the name of the file to write
        mode : str, optional
            the file mode, i.e., 'w' to write, 'a' to append


        Initialize from a default set of parameters

        Parameters
        ----------
        model : GalaxySpectrum, optional
            the model instance; if not provided, a new model
            will be initialized
        extra_params : list, optional
            list of names of extra parameters to be treated as valid


        Parameters
        ----------
        filename : str
            the name of the file to read the parameters from
        tag : str, optional
            only read the parameters with this label tag
        extra_params : list, optional
            a list of any additional parameters to treat as valid


        A list of the valid parameters names that can be passed
        to the ``GalaxySpectrum`` model instance


Check if the parameter name is valid


        Return a dictionary of (name, value) for each name that is in
        :attr:`model_params`


        Check the values of all parameters. Here, `check` means that
        each parameter is within its bounds and the prior is not infinity

        If `return_errors = True`, return the error messages as well


        Scale the (unscaled) free parameters, using the priors to
        define the scaling transformation


        Inverse scale the free parameters, using the priors to
        define the scaling transformation


        Scale the gradient with respect to the unscaled free parameters,
        using the priors to define the scaling transformation

        This returns df / dxprime where xprime is the scaled param vector


Set the model, possibly from a file, or initialize a new one


Save the parameters of this theory in a file


        Returns the number of free parameters, i.e., the `dimension` of the
        theory


        Return the log prior for free parameters as the sum of the priors
        of each individual parameter


        Return the log prior for constrained parameters as the sum of the priors
        of each individual parameter


        Return the log prior for all "free" parameters as the sum of the priors
        of each individual parameter


Return the derivative of the log prior for all "free" parameters


Return an array of the fiducial free parameters


Return the P(k,mu) gradient class


    Apply one (or more) transfer functions to the input P(k,mu) values.

    Parameters
    ----------
    P : xarray.DataArray
        the power values calculated on the (k,mu) grid
    data : PowerData
        the data object
    transfers : list
        the list of transfer objects to apply
    stat_ids : dict
        dictionary with keys of the relevant statistics and values are
        identifers, e.g., ell or center mu values
    slices : list
        the list of slices to slice the power result
    theory_decorator : dict
        decorator to run after the transfer function is applied


    Slice the input data according to the integer
    indexing specified by the dictionary ``indexers``

    Parameters
    ----------
    data : np.ndarray
        the data that will be sliced
    indexers : dict
        a dictionary specifiying the slicing, where keys
        are dimension names and values are the desired indexing
    indexes : list
        list of GridIndex objects, which define the coordinates
        and dimension names
    return_indices : list of array_like
        If `True`, also return the indices used to slice each dimension


Map the specified index values from label-based to integer-based


        Length of coordinate grid for this index (if multiple coords, all
        should be the same)


The number of coordinate dimensions associated with this index


Do all dimensions associated with this index have unique coordinates


        If `key` is specified, convert the coordinate values to a `pandas.Index`.
        If `ndim` is greater than one, return a `pandas.MultiIndex` for all
        dimensions of the index


A flattened list of dimensions, for convenience


The number of dimensions


        Return a new numpy.ndarray that has been sliced by the integer indexing
        along the specified dimension(s).


        Return a new numpy.ndarray that has been sliced by the label indexing
        along the specified dimension(s).


        Return the nearest match along the specified dimension for the
        input coordinate value

        Parameters
        ----------
        dim : str
            string specifying the dimension name
        coord : float
            value to find the nearest match to

        Returns
        -------
        idx : int
            the integer index specifying the nearest element
        nearest : float
            the nearest element value


    Return the factor needed to convert between the units, dealing with
    the pesky dimensionless Hubble factor, `h`.

    Parameters
    ----------
    variable_type : str
        The name of the variable type, must be one of the keys defined
        in ``units.variables``.
    input_units : str, {`absolute`, `relative`}
        The type of the units for the input variable
    output_units : str, {`absolute`, `relative`}
        The type of the units for the output variable
    h : float
        The dimensionless Hubble factor to use to convert


    Compute the average of the columns of `frame`. This is designed to be
    used with the `groupby` and `apply` functions, where the frame is
    the `DataFrame of a given group.


Write out the data from the power measurements to a plaintext file


        Create a PowerMeasurement from the input structured array of data

        Parameters
        ----------
        names : list of str
            the list of names for each measurement to load; each name must
            begin with ``pkmu_`` or ``pole_`` depending on the type of data.
            Examples of names include ``pkmu_0.1`` for a :math:`\mu=0.1`
            :math:`P(k,\mu)` bin, or ``pole_0`` for the monopole, ``pole_2``
            for the quadrupole, etc
        data : array_like
            a structured array holding the data fields; this have `k`, `mu`,
            `power` fields for :math:`P(k,\mu)` data or `k`, `power` fields
            for multipole data


        Load a set of power measurements from a plaintex file

        Parameters
        ----------
        names : list of str
            the list of names for each measurement to load; each name must
            begin with ``pkmu_`` or ``pole_`` depending on the type of data.
            Examples of names include ``pkmu_0.1`` for a :math:`\mu=0.1`
            :math:`P(k,\mu)` bin, or ``pole_0`` for the monopole, ``pole_2``
            for the quadrupole, etc
        filename : str
            the name of the file to load to load a structured array of data
            from


The type of measurement, either `pkmu` or `pole`


Internal variable to store input `k` values


Internal variable to store input `power` values


Internal variable to store input `error` values


Internal variable to store input `mu` values


Minimum k value to trim the results to in units of `h/Mpc`


Maximum k value to trim the results to in units of `h/Mpc`


Returns the multipole number for this P(k,ell) measurement


The valid columns for this measurement


The indices of the data points following between k_min and k_max


The wavenumbers of the measurement in units of `h/Mpc`


        Returns either a single or array of `mu` values associated with
        this P(k,mu) measurement


The power measurement in units of `(Mpc/h)^3`


The error on the power measurement in units of `(Mpc/h)^3`


The `ell` or average `mu` value for this measurement


Return the label associated with this kind of measurement


The type of data, either ``pkmu`` or ``poles``


        A list of the string names for each statistic that will be read from file

        These strings should be of the form:

        >> ['pole_0', 'pole_2', ...]
        >> ['pkmu_0.1', 'pkmu_0.3', ...]


        The :math:`k` fitting range for each statistics.

        This can either be a tuple of (kmin, kmax), which will be
        used for each statistic or a list of tuples of (kmin, kmax)


The string specifying the name of the file holding the data measurements.


        A string specifying the name of the file holding a
        :class:`pyRSD.rsd.transfers.PkmuGrid` to read.


        A string specifying the name of the file holding the correlation
        function multipoles of the window function.

        The file should contain columns of data, with the first column
        specifying the separation array :math:`s`, and the other columns
        giving the even-numbered correlation function multipoles of the window


Default kmin value to use on the grid when convolving the model.


Default kmax value to use on the grid when convolving the model.


The string specifying the name of the file holding the covariance matrix.


        A list of the statistic numbers that will be included in the final
        analysis.

        This allows the user to exclude certain statistics read from file. By
        default (``None``), all statistics are included


Rescale the covariance matrix read from file by this amount.


        The number of mocks that was used to measure the covariance matrix.

        If this is non-zero, then the inverse covariance matrix will
        be rescaled to account for noise due to the finite number of mocks


        A list of integers specifying multipole numbers for each statistic
        in the final analysis.

        This must be supplied when the :attr:`mode` is ``poles``


        A list of tuples specifying the edges of the :math:`\mu` bins.

        This should have (mu_min, mu_max), corresponding
        to the edges of the bins for each statistic in the final analysis

        This must be supplied when the :attr:`mode` is ``pkmu``


        When convolving a multipole of order ``ell``, include contributions
        up to and including this number.


Do the initialization steps after reading the params


List of `PowerMeasurement` objects


The minimum allowed wavenumbers


The maximum allowed wavenumbers


        Set up the transfer function required by the data which will be used
        to compute the specified statistics.

        Parameters
        ----------
        statistics : list of str
            the name of the statistics for which the transfer function
            will apply

        Returns
        -------
        transfers : list of transfer function objects
            the transfer function objects


        Slice the data measurements + covariance to only include
        certain statistics, corresponding to the column numbers in
        `usedata`

        Notes
        -----
        *   the values in `usedata` are interpreted as the column
            numbers of `data` to use
        *   trims `measurements` and `covariance` accordingly


        Rescale the inverse of the covariance matrix in order to get an
        unbiased estimate