Пример #1
0
def xi_einasto_at_r(r, M, conc, alpha, om, delta=200, rhos=-1.):
    """Einasto halo profile.

    Args:
        r (float or array like): 3d distances from halo center in Mpc/h comoving
        M (float): Mass in Msun/h; not used if rhos is specified
        conc (float): Concentration
        alpha (float): Profile exponent
        om (float): Omega_matter, matter fraction of the density
        delta (int): Overdensity, default is 200
        rhos (float): Scale density in Msun h^2/Mpc^3 comoving; optional

    Returns:
        float or array like: Einasto halo profile.

    """
    r = np.asarray(r)
    scalar_input = False
    if r.ndim == 0:
        r = r[None]  #makes r 1D
        scalar_input = True
    if r.ndim > 1:
        raise Exception("r cannot be a >1D array.")

    xi = np.zeros_like(r)
    cluster_toolkit._lib.calc_xi_einasto(_dcast(r), len(r), M, rhos, conc,
                                         alpha, delta, om, _dcast(xi))

    if scalar_input:
        return np.squeeze(xi)
    return xi
Пример #2
0
def rho_nfw_at_r(r, M, c, Omega_m, delta=200):
    """NFW halo density profile.

    Args:
        r (float or array like): 3d distances from halo center in Mpc/h comoving.
        M (float): Mass in Msun/h.
        c (float): Concentration.
        Omega_m (float): Omega_matter, matter fraction of the density.
        delta (int; optional): Overdensity, default is 200.

    Returns:
        float or array like: NFW halo density profile in Msun h^2/Mpc^3 comoving.

    """
    r = np.asarray(r)
    scalar_input = False
    if r.ndim == 0:
        r = r[None] #makes r 1D
        scalar_input = True
    if r.ndim > 1:
        raise Exception("r cannot be a >1D array.")

    rho = np.zeros_like(r)
    cluster_toolkit._lib.calc_rho_nfw(_dcast(r), len(r), M, c, delta,
                                      Omega_m, _dcast(rho))
    if scalar_input:
        return np.squeeze(rho)
    return rho
Пример #3
0
def xi_hm(xi_1halo, xi_2halo, combination="max"):
    """Halo-matter correlation function

    Note: at the moment you can combine the 1-halo and 2-halo terms by either taking the max of the two or the sum of the two. The 'combination' field must be set to either 'max' (default) or 'sum'.

    Args:
        xi_1halo (float or array like): 1-halo term
        xi_2halo (float or array like, same size as xi_1halo): 2-halo term
        combination (string; optional): specifies how the 1-halo and 2-halo terms are combined, default is 'max' which takes the max of the two

    Returns:
        float or array like: Halo-matter correlation function

    """
    if combination == "max":
        switch = 0
    elif combination == 'sum':
        switch = 1
    else:
        raise Exception("Combinations other than maximum not implemented yet")

    xi = np.zeros_like(xi_1halo)
    cluster_toolkit._lib.calc_xi_hm(len(xi_1halo), _dcast(xi_1halo),
                                    _dcast(xi_2halo), _dcast(xi), switch)
    return xi
Пример #4
0
def G_at_sigma(sigma, d=1.97, e=1.0, f=0.51, g=1.228):
    """Tinker et al. 2008 appendix C multiplicity funciton G(sigma) as 
    a function of sigma.

    NOTE: by default, this function is only valid at :math:`z=0`. For use
    at higher redshifts either recompute the parameters yourself, or
    wait for this behavior to be patched.

    Args:
        sigma (float or array like): RMS variance of the matter density field.
        d (float; optional): First Tinker parameter. Default is 1.97.
        e (float; optional): Second Tinker parameter. Default is 1.
        f (float; optional): Third Tinker parameter. Default is 0.51.
        g (float; optional): Fourth Tinker parameter. Default is 1.228.

    Returns:
        float or array like: Halo multiplicity G(sigma).
    """
    sigma = np.asarray(sigma)
    scalar_input = False
    if sigma.ndim == 0:
        sigma = sigma[None]
        scalar_input = True
    if sigma.ndim > 1:
        raise Exception("sigma cannot be a >1D array.")

    G = np.zeros_like(sigma)
    cluster_toolkit._lib.G_at_sigma_arr(_dcast(sigma), len(sigma), d, e, f, g,
                                        _dcast(G))
    if scalar_input:
        return np.squeeze(G)
    return G
Пример #5
0
def DeltaSigma_mis_at_R(R, Rsigma, Sigma_mis):
    """Miscentered excess surface mass density profile at R. Units are Msun h/pc^2 comoving.

    Args:
        R (float or array like): Projected radii to evaluate profile.
        Rsigma (array like): Projected radii of miscentered Sigma profile.
        Sigma_mis (array like): Miscentered Sigma profile.

    Returns:
        float array like: Miscentered excess surface mass density profile.

    """
    R = np.asarray(R)
    scalar_input = False
    if R.ndim == 0:
        R = R[None]  #makes R 1D
        scalar_input = True
    if R.ndim > 1:
        raise Exception("R cannot be a >1D array.")
    if np.min(R) < np.min(Rsigma):
        raise Exception("Minimum R must be >= min(R_Sigma)")
    if np.max(R) > np.max(Rsigma):
        raise Exception("Maximum R must be <= max(R_Sigma)")

    DeltaSigma_mis = np.zeros_like(R)
    cluster_toolkit._lib.DeltaSigma_mis_at_R_arr(_dcast(R), len(R),
                                                 _dcast(Rsigma),
                                                 _dcast(Sigma_mis),
                                                 len(Rsigma),
                                                 _dcast(DeltaSigma_mis))
    if scalar_input:
        return np.squeeze(DeltaSigma_mis)
    return DeltaSigma_mis
Пример #6
0
def _calc_nu_at_M(M, k, P, Omega_m, nu):
    """Direct call to vectorized version of peak height of M.

    """
    cluster_toolkit._lib.nu_at_M_arr(_dcast(M), len(M), _dcast(k), _dcast(P),
                                     len(k), Omega_m, _dcast(nu))
    return
Пример #7
0
def rho_einasto_at_r(r, M, rs, alpha, Omega_m, delta=200, rhos=-1.):
    """Einasto halo density profile. Distances are Mpc/h comoving.

    Args:
        r (float or array like): 3d distances from halo center.
        M (float): Mass in Msun/h; not used if rhos is specified.
        rhos (float): Scale density in Msun h^2/Mpc^3 comoving; optional.
        rs (float): Scale radius.
        alpha (float): Profile exponent.
        Omega_m (float): Omega_matter, matter fraction of the density.
        delta (int): Overdensity, default is 200.

    Returns:
        float or array like: Einasto halo density profile in Msun h^2/Mpc^3 comoving.

    """
    r = np.asarray(r)
    scalar_input = False
    if r.ndim == 0:
        r = r[None] #makes r 1D
        scalar_input = True
    if r.ndim > 1:
        raise Exception("r cannot be a >1D array.")

    rho = np.zeros_like(r)
    cluster_toolkit._lib.calc_rho_einasto(_dcast(r), len(r), M, rhos, rs,
                                          alpha, delta, Omega_m, _dcast(rho))
    if scalar_input:
        return np.squeeze(rho)
    return rho
Пример #8
0
def _calc_Sigma_nfw_at_R(R, mass, concentration, Omega_m, Sigma, delta=200):
    """Direct call to vectorized surface mass density of NFW.

    """
    return cluster_toolkit._lib.Sigma_nfw_at_R_arr(_dcast(R), len(R), mass,
                                                   concentration, delta,
                                                   Omega_m, _dcast(Sigma))
Пример #9
0
def bias_at_R(R, k, P, delta=200):
    """Tinker 2010 bais at mass M [Msun/h] corresponding to radius R [Mpc/h comoving].

    Args:
        R (float or array like): Lagrangian radius in Mpc/h comoving.
        k (array like): Wavenumbers of power spectrum in h/Mpc comoving.
        P (array like): Power spectrum in (Mpc/h)^3 comoving.
        delta (int; optional): Overdensity, default is 200.

    Returns:
        float or array like: Halo bias.

    """
    R = np.asarray(R)
    scalar_input = False
    if R.ndim == 0:
        R = R[None] #makes r 1D
        scalar_input = True
    if R.ndim > 1:
        raise Exception("R cannot be a >1D array.")
    R = np.require(R, dtype=np.float64, requirements=["C"])
    k = np.require(k, dtype=np.float64, requirements=["C"])
    P = np.require(P, dtype=np.float64, requirements=["C"])
    bias = np.zeros_like(R)
    cluster_toolkit._lib.bias_at_R_arr(_dcast(R), len(R), delta, _dcast(k), _dcast(P), len(k), _dcast(bias))
    if scalar_input:
        return np.squeeze(bias)
    return bias
Пример #10
0
def G_at_M(M, k, P, Omega_m, d=1.97, e=1.0, f=0.51, g=1.228):
    """Tinker et al. 2008 appendix C multiplicity funciton G(M) as 
    a function of mass. Default behavior is for :math:`M_{200m}` mass 
    definition.

    Args:
        M (float or array like): Mass in Msun/h.
        k (array like): Wavenumbers of the matter power spectrum in h/Mpc comoving.
        P_lin (array like): Linear matter power spectrum in (Mpc/h)^3 comoving.
        Omega_m (float): Matter density fraction.
        d (float; optional): First Tinker parameter. Default is 1.97.
        e (float; optional): Second Tinker parameter. Default is 1.
        f (float; optional): Third Tinker parameter. Default is 0.51.
        g (float; optional): Fourth Tinker parameter. Default is 1.228.

    Returns:
        float or array like: Halo multiplicity :math:`G(M)`.
    """
    M = np.asarray(M)
    scalar_input = False
    if M.ndim == 0:
        M = M[None]  #makes M 1D
        scalar_input = True
    if M.ndim > 1:
        raise Exception("M cannot be a >1D array.")
    M = np.require(M, dtype=np.float64, requirements=["C"])
    k = np.require(k, dtype=np.float64, requirements=["C"])
    P = np.require(P, dtype=np.float64, requirements=["C"])

    G = np.zeros_like(M)
    cluster_toolkit._lib.G_at_M_arr(_dcast(M), len(M), _dcast(k), _dcast(P),
                                    len(k), Omega_m, d, e, f, g, _dcast(G))
    if scalar_input:
        return np.squeeze(G)
    return G
Пример #11
0
def xi_mm_at_R(R, k, P, N=500, step=0.005, exact=False):
    """Matter-matter correlation function.

    Args:
        R (float or array like): 3d distances from halo center in Mpc/h comoving
        k (array like): Wavenumbers of power spectrum in h/Mpc comoving
        P (array like): Matter power spectrum in (Mpc/h)^3 comoving
        N (int; optional): Quadrature step count, default is 500
        step (float; optional): Quadrature step size, default is 5e-3
        exact (boolean): Use the slow, exact calculation; default is False

    Returns:
        float or array like: Matter-matter correlation function

    """
    if type(R) is list or type(R) is np.ndarray:
        xi = np.zeros_like(R)
        if not exact:
            cluster_toolkit._lib.calc_xi_mm(_dcast(R), len(R), _dcast(k), _dcast(P), len(k), _dcast(xi), N, step)
        else:
            cluster_toolkit._lib.calc_xi_mm_exact(_dcast(R), len(R), _dcast(k), _dcast(P), len(k), _dcast(xi))
        return xi
    if not exact:
        return cluster_toolkit._lib.xi_mm_at_R(R, _dcast(k), _dcast(P), len(k), N, step)
    else:
        return cluster_toolkit._lib.xi_mm_at_R_exact(R, _dcast(k), _dcast(P), len(k))
Пример #12
0
def _calc_sigma2_at_R(R, k, P, s2):
    """Direct call to vectorized version of RMS variance in top hat sphere of radius R [Mpc/h comoving] of linear power spectrum.

    """
    cluster_toolkit._lib.sigma2_at_R_arr(_dcast(R), len(R), _dcast(k),
                                         _dcast(P), len(k), _dcast(s2))
    return
Пример #13
0
def _calc_bias_at_R(R, k, P, bias, delta=200):
    """Direct call to vectorized version of Tinker 2008 bias at R.

    """
    cluster_toolkit._lib.bias_at_R_arr(_dcast(R), len(R), delta, _dcast(k),
                                       _dcast(P), len(k), _dcast(bias))
    return
Пример #14
0
def Sigma_nfw_at_R(R, mass, concentration, Omega_m, delta=200):
    """Surface mass density of an NFW profile [Msun h/pc^2 comoving].

    Args:
        R (float or array like): Projected radii Mpc/h comoving.
        mass (float): Halo mass Msun/h.
        concentration (float): concentration.
        Omega_m (float): Matter density fraction.
        delta (int; optional): Overdensity, default is 200.

    Returns:
        float or array like: Surface mass density Msun h/pc^2 comoving.

    """
    R = np.asarray(R)
    scalar_input = False
    if R.ndim == 0:
        R = R[None]  #makes R 1D
        scalar_input = True
    if R.ndim > 1:
        raise Exception("R cannot be a >1D array.")

    Sigma = np.zeros_like(R)
    cluster_toolkit._lib.Sigma_nfw_at_R_arr(_dcast(R), len(R), mass,
                                            concentration, delta, Omega_m,
                                            _dcast(Sigma))
    if scalar_input:
        return np.squeeze(Sigma)
    return Sigma
Пример #15
0
def _calc_nu_at_R(R, k, P, nu):
    """Direct call to vectorized version of peak height of R.

    """
    cluster_toolkit._lib.nu_at_R_arr(_dcast(R), len(R), _dcast(k), _dcast(P),
                                     len(k), _dcast(nu))
    return
Пример #16
0
def dbiasdM_at_M(M, k, P, Omega_m, delta=200):
    """d/dM of Tinker et al. 2010 bais at mass M [Msun/h].

    Args:
        M (float or array like): Mass in Msun/h.
        k (array like): Wavenumbers of power spectrum in h/Mpc comoving.
        P (array like): Power spectrum in (Mpc/h)^3 comoving.
        Omega_m (float): Matter density fraction.
        delta (int; optional): Overdensity, default is 200.

    Returns:
        float or array like: Derivative of the halo bias.
    
    """
    M = np.asarray(M)
    scalar_input = False
    if M.ndim == 0:
        M = M[None] #makes M 1D
        scalar_input = True
    if M.ndim > 1:
        raise Exception("M cannot be a >1D array.")
    M = np.require(M, dtype=np.float64, requirements=["C"])
    k = np.require(k, dtype=np.float64, requirements=["C"])
    P = np.require(P, dtype=np.float64, requirements=["C"])
    deriv = np.zeros_like(M)
    cluster_toolkit._lib.dbiasdM_at_M_arr(_dcast(M), len(M), delta, _dcast(k),
                                          _dcast(P), len(k), Omega_m,
                                          _dcast(deriv))
    if scalar_input:
        return np.squeeze(deriv)
    return deriv
Пример #17
0
def boost_nfw_at_R(R, B0, R_scale):
    """NFW boost factor model.

    Args:
        R (float or array like): Distances on the sky in the same units as R_scale. Mpc/h comoving suggested for consistency with other modules.
        B0 (float): NFW profile amplitude.
        R_scale (float): NFW profile scale radius.

    Returns:
        float or array like: NFW boost factor profile; B = (1-fcl)^-1.

    """
    R = np.asarray(R)
    scalar_input = False
    if R.ndim == 0:
        R = R[None] #makes R 1D
        scalar_input = True
    if R.ndim > 1:
        raise Exception("R cannot be a >1D array.")

    boost = np.zeros_like(R)
    cluster_toolkit._lib.boost_nfw_at_R_arr(_dcast(R), len(R), B0, R_scale,
                                            _dcast(boost))
    if scalar_input:
        return np.squeeze(boost)
    return boost
Пример #18
0
def G_at_sigma(sigma, d=1.97, e=1.0, f=0.51, g=1.228):
    """Tinker et al. 2008 appendix C multiplicity funciton G(sigma) as 
    a function of sigma.

    NOTE: by default, this function is only valid at :math:`z=0`. For use
    at higher redshifts either recompute the parameters yourself, or
    wait for this behavior to be patched.

    Args:
        sigma (float or array like): RMS variance of the matter density field.
        d (float; optional): First Tinker parameter. Default is 1.97.
        e (float; optional): Second Tinker parameter. Default is 1.
        f (float; optional): Third Tinker parameter. Default is 0.51.
        g (float; optional): Fourth Tinker parameter. Default is 1.228.

    Returns:
        float or array like: Halo multiplicity :math:`G(\sigma)`.
    """
    if type(sigma) is list or type(sigma) is np.ndarray:
        G = np.zeros_like(sigma)
        cluster_toolkit._lib.G_at_sigma_arr(_dcast(sigma), len(sigma), d, e, f,
                                            g, _dcast(G))
        return G
    else:
        return cluster_toolkit._lib.G_at_sigma(sigma, d, e, f, g)
Пример #19
0
def _calc_bias_at_M(M, k, P, Omega_m, bias, delta=200):
    """Direct call to vectorized version of Tinker 2008 bias at M.

    """
    cluster_toolkit._lib.bias_at_M_arr(_dcast(M), len(M), delta, _dcast(k),
                                       _dcast(P), len(k), Omega_m,
                                       _dcast(bias))
    return
Пример #20
0
def _bias_at_nu_FREEPARAMS(nu, A, a, B, b, C, c, delta=200):
    """A special function used only for quickly computing best fit parameters
    for the halo bias models.
    """
    bias = np.zeros_like(nu)
    cluster_toolkit._lib.bias_at_nu_arr_FREEPARAMS(_dcast(nu), len(nu), delta,
                                                   A, a, B, b, C, c, _dcast(bias))
    return bias
Пример #21
0
def _calc_sigma2_at_M(M, k, P, Omega_m, s2):
    """Direct call to vectorized version of RMS variance in top hat sphere of lagrangian radius R [Mpc/h comoving] corresponding to a mass M [Msun/h] of linear power spectrum.

    """
    cluster_toolkit._lib.sigma2_at_M_arr(_dcast(M), len(M),
                                         _dcast(k), _dcast(P), len(k), Omega_m,
                                         _dcast(s2))
    return
Пример #22
0
def Sigma_mis_at_R(R,
                   Rsigma,
                   Sigma,
                   M,
                   conc,
                   Omega_m,
                   Rmis,
                   delta=200,
                   kernel="rayleigh"):
    """Miscentered surface mass density [Msun h/pc^2 comoving] 
    convolved with a distribution for Rmis. Units are Msun h/pc^2 comoving.

    Args:
        R (float or array like): Projected radii Mpc/h comoving.
        Rsigma (array like): Projected radii of the centered surface mass density profile.
        Sigma (float or array like): Surface mass density Msun h/pc^2 comoving.
        M (float): Halo mass Msun/h.
        conc (float): concentration.
        Omega_m (float): Matter density fraction.
        Rmis (float): Miscentered distance in Mpc/h comoving.
        delta (int; optional): Overdensity, default is 200.
        kernel (string; optional): Kernal for convolution. Options: rayleigh or gamma.

    Returns:
        float or array like: Miscentered projected surface mass density.

    """
    R = np.asarray(R)
    scalar_input = False
    if R.ndim == 0:
        R = R[None]  #makes R 1D
        scalar_input = True

    #Exception checking
    if R.ndim > 1:
        raise Exception("R cannot be a >1D array.")
    if np.min(R) < np.min(Rsigma):
        raise Exception("Minimum R must be >= min(R_Sigma)")
    if np.max(R) > np.max(Rsigma):
        raise Exception("Maximum R must be <= max(R_Sigma)")
    if kernel == "rayleigh":
        integrand_switch = 0
    elif kernel == "gamma":
        integrand_switch = 1
    else:
        raise Exception("Miscentering kernel must be either " +
                        "'rayleigh' or 'gamma'")

    Sigma_mis = np.zeros_like(R)
    cluster_toolkit._lib.Sigma_mis_at_R_arr(_dcast(R), len(R), _dcast(Rsigma),
                                            _dcast(Sigma), len(Rsigma), M,
                                            conc, delta, Omega_m,
                                            Rmis, integrand_switch,
                                            _dcast(Sigma_mis))
    if scalar_input:
        return np.squeeze(Sigma_mis)
    return Sigma_mis
Пример #23
0
def xi_DK_appendix1(r,
                    M,
                    conc,
                    be,
                    se,
                    k,
                    P,
                    om,
                    bias,
                    xi_mm,
                    delta=200,
                    rhos=-1.,
                    alpha=-1.,
                    beta=-1.,
                    gamma=-1.):
    """Diemer-Kravtsov 2014 profile, first form from the appendix, eq. A3.

    Args:
        r (float or array like): radii in Mpc/h comoving
        M (float): mass in Msun/h
        conc (float): Einasto concentration
        be (float): DK transition parameter
        se (float): DK transition parameter
        k (array like): wavenumbers in h/Mpc
        P (array like): matter power spectrum in [Mpc/h]^3
        Omega_m (float): matter density fraction
        bias (float): halo bias
        xi_mm (float or array like): matter correlation function at r
        delta (float): overdensity of matter. Optional, default is 200
        rhos (float): Einasto density. Optional, default is compute from the mass
        alpha (float): Einasto parameter. Optional, default is computed from peak height
        beta (float): DK 2-halo parameter. Optional, default is 4
        gamma (float): DK 2-halo parameter. Optional, default is 8

    Returns:
        float or array like: DK profile evaluated at the input radii

    """
    r = np.asarray(r)
    scalar_input = False
    if r.ndim == 0:
        r = r[None]  #makes r 1D
        scalar_input = True
    if r.ndim > 1:
        raise Exception("r cannot be a >1D array.")

    xi = np.zeros_like(r)
    cluster_toolkit._lib.calc_xi_DK_app1(_dcast(r), len(r), M, rhos, conc, be,
                                         se, alpha, beta, gamma, delta,
                                         _dcast(k), _dcast(P), len(k), om,
                                         bias, _dcast(xi_mm), _dcast(xi))

    if scalar_input:
        return np.squeeze(xi)
    return xi
Пример #24
0
def _calc_Sigma_mis_single_at_R(R,
                                Rsigma,
                                Sigma,
                                M,
                                conc,
                                Omega_m,
                                Rmis,
                                Sigma_mis,
                                delta=200):
    return cluster_toolkit._lib.Sigma_mis_single_at_R_arr(
        _dcast(R), len(R), _dcast(Rsigma), _dcast(Sigma), len(Rsigma), M, conc,
        delta, Omega_m, Rmis, _dcast(Sigma_mis))
Пример #25
0
def _dndM_sigma2_precomputed(M,
                             sigma2,
                             dsigma2dM,
                             Omega_m,
                             d=1.97,
                             e=1.0,
                             f=0.51,
                             g=1.228):
    dndM = np.zeros_like(M)
    cluster_toolkit._lib.dndM_sigma2_precomputed(_dcast(M), _dcast(sigma2),
                                                 _dcast(dsigma2dM), len(M),
                                                 Omega_m, d, e, f, g,
                                                 _dcast(dndM))
    return dndM
Пример #26
0
def n_in_bin(Mlo, Mhi, Marr, dndM):
    """Tinker et al. 2008 appendix C binned mass function.

    Args:
        Mlo (float): Lower mass edge.
        Mhi (float): Upper mass edge.
        Marr (array like): Array of locations that dndM has been evaluated at.
        dndM (array like): Array of dndM.

    Returns:
       float: number density of halos in the mass bin.

    """
    return cluster_toolkit._lib.n_in_bin(Mlo, Mhi, _dcast(Marr), _dcast(dndM),
                                         len(Marr))
Пример #27
0
def xi_2halo(bias, xi_mm):
    """2-halo term in halo-matter correlation function

    Args:
        bias (float): Halo bias
        xi_mm (float or array like): Matter-matter correlation function

    Returns:
        float or array like: 2-halo term in halo-matter correlation function

    """
    NR = len(xi_mm)
    xi = np.zeros_like(xi_mm)
    cluster_toolkit._lib.calc_xi_2halo(NR, bias, _dcast(xi_mm), _dcast(xi))
    return xi
Пример #28
0
def n_in_bins(edges, Marr, dndM):
    """Tinker et al. 2008 appendix C binned mass function.

    Args:
        edges (array like): Edges of the mass bins.
        Marr (array like): Array of locations that dndM has been evaluated at.
        dndM (array like): Array of dndM.

    Returns:
       numpy.ndarray: number density of halos in the mass bins. Length is :code:`len(edges)-1`.

    """
    n = np.zeros(len(edges) - 1)
    cluster_toolkit._lib.n_in_bins(_dcast(edges), len(edges), _dcast(Marr),
                                   _dcast(dndM), len(Marr), _dcast(n))
    return n
Пример #29
0
def _calc_Sigma_at_R(R,
                     Rxi,
                     xi,
                     mass,
                     concentration,
                     Omega_m,
                     Sigma,
                     delta=200):
    """Direct call to vectorized surface mass density given xi_hm

    """
    return cluster_toolkit._lib.Sigma_at_R_full_arr(_dcast(R), len(R),
                                                    _dcast(Rxi), _dcast(xi),
                                                    len(Rxi), mass,
                                                    concentration, delta,
                                                    Omega_m, _dcast(Sigma))
Пример #30
0
def xi_DK_appendix2(R, M, conc, be, se, k, P, om, bias, xi_mm, delta=200, rhos=-1., alpha=-1., beta=-1., gamma=-1.):
    """Diemer-Kravtsov 2014 profile, second form from the appendix, eq. A4.

    Args:
        r (float or array like): radii in Mpc/h comoving
        M (float): mass in Msun/h
        conc (float): Einasto concentration
        be (float): DK transition parameter
        se (float): DK transition parameter
        k (array like): wavenumbers in h/Mpc
        P (array like): matter power spectrum in [Mpc/h]^3
        Omega_m (float): matter density fraction
        bias (float): halo bias
        xi_mm (float or array like): matter correlation function at r
        delta (float): overdensity of matter. Optional, default is 200
        rhos (float): Einasto density. Optional, default is compute from the mass
        alpha (float): Einasto parameter. Optional, default is computed from peak height
        beta (float): DK 2-halo parameter. Optional, default is 4
        gamma (float): DK 2-halo parameter. Optional, default is 8

    Returns:
        float or array like: DK profile evaluated at the input radii
    """
    Nk = len(k)
    if type(R) is list or type(R) is np.ndarray:
        NR = len(R)
        xi = np.zeros_like(R)
        cluster_toolkit._lib.calc_xi_DK_app2(_dcast(R), NR, M, rhos, conc, be, se, alpha, beta, gamma, delta, _dcast(k), _dcast(P), Nk, om, bias, _dcast(xi_mm), _dcast(xi))
        return xi
    else:
        return cluster_toolkit._lib.xi_DK_app2(R, M, rhos, conc, be, se, alpha, beta, gamma, delta, _dcast(k), _dcast(P), Nk, om, bias, _dcast(xi_mm))