Esempio n. 1
0
def virial_temp(mass, z, mu=None, **cosmology):
    r"""The Virial temperature for a halo of a given mass.

    Calculates the Virial temperature in Kelvin for a halo of a given
    mass using equation 26 of Barkana & Loeb.

    The transition from neutral to ionized is assumed to occur at temp
    = 1e4K. At temp >= 10^4 k, the mean partical mass drops from 1.22
    to 0.59 to very roughly account for collisional ionization.

    Parameters
    ----------

    mass: array
       Mass in Solar Mass units.

    z: array
       Redshift.

    mu: array, optional
       Mean mass per particle.

    """

    omega_M_0 = cosmology["omega_M_0"]
    omega = cden.omega_M_z(z, **cosmology)
    d = omega - 1
    deltac = 18.0 * math.pi ** 2.0 + 82.0 * d - 39.0 * d ** 2.0

    if mu is None:
        mu_t = 1.22
    else:
        mu_t = mu
    temp = (
        1.98e4
        * (mass * cosmology["h"] / 1.0e8) ** (2.0 / 3.0)
        * (omega_M_0 * deltac / (omega * 18.0 * math.pi ** 2.0)) ** (1.0 / 3.0)
        * ((1 + z) / 10.0)
        * (mu_t / 0.6)
    )

    if mu is None:
        # Below is some magic to consistently use mu = 1.22 at temp < 1e4K
        # and mu = 0.59 at temp >= 1e4K.
        t_crit = 1e4
        t_crit_large = 1.22 * t_crit / 0.6
        t_crit_small = t_crit
        mu = (
            (temp < t_crit_small) * 1.22
            + (temp > t_crit_large) * 0.59
            + (1e4 * 1.22 / temp) * (temp >= t_crit_small) * (temp <= t_crit_large)
        )
        temp = temp * mu / 1.22

    return temp
Esempio n. 2
0
def virial_temp(mass, z, mu=None, **cosmology):
    r"""The Virial temperature for a halo of a given mass.

    Calculates the Virial temperature in Kelvin for a halo of a given
    mass using equation 26 of Barkana & Loeb.

    The transition from neutral to ionized is assumed to occur at temp
    = 1e4K. At temp >= 10^4 k, the mean partical mass drops from 1.22
    to 0.59 to very roughly account for collisional ionization.

    Parameters
    ----------

    mass: array
       Mass in Solar Mass units.

    z: array
       Redshift.

    mu: array, optional
       Mean mass per particle.

    """

    omega_M_0 = cosmology['omega_M_0']
    omega = cden.omega_M_z(z, **cosmology)
    d = omega - 1
    deltac = 18. * math.pi**2. + 82. * d - 39. * d**2.

    if mu is None:
        mu_t = 1.22
    else:
        mu_t = mu
    temp = (1.98e4 * (mass * cosmology['h'] / 1.0e8)**(2.0 / 3.0) *
            (omega_M_0 * deltac / (omega * 18. * math.pi**2.))**(1.0 / 3.0) *
            ((1 + z) / 10.0) * (mu_t / 0.6))

    if mu is None:
        # Below is some magic to consistently use mu = 1.22 at temp < 1e4K
        # and mu = 0.59 at temp >= 1e4K.
        t_crit = 1e4
        t_crit_large = 1.22 * t_crit / 0.6
        t_crit_small = t_crit
        mu = ((temp < t_crit_small) * 1.22 + (temp > t_crit_large) * 0.59 +
              (1e4 * 1.22 / temp) * (temp >= t_crit_small) *
              (temp <= t_crit_large))
        temp = temp * mu / 1.22

    return temp
Esempio n. 3
0
def fgrowth(z, omega_M_0, unnormed=False):
    r"""Cosmological perturbation growth factor, normalized to 1 at z = 0.
    
    Approximate forumla from Carol, Press, & Turner (1992, ARA&A, 30,
    499), "good to a few percent in regions of plausible Omega_M,
    Omega_Lambda".

    This is proportional to D_1(z) from Eisenstein & Hu (1999 ApJ 511
    5) equation 10, but the normalization is different: fgrowth = 1 at
    z = 0 and ``D_1(z) = \frac{1+z_\mathrm{eq}}{1+z}`` as z goes
    to infinity.
    
    To get D_1 one would just use 
    
    ::
    
        D_1(z) = (1+z_\mathrm{eq}) \mathtt{fgrowth}(z,\Omega_{M0}, 1)

    (see \EH\ equation 1 for z_eq).

    ::
    
        \mathtt{fgrowth} = \frac{D_1(z)}{D_1(0)}

    Setting unnormed to true turns off normalization.

    Note: assumes Omega_lambda_0 = 1 - Omega_M_0!
    
    """
    #if cden.get_omega_k_0(**) != 0:
    #    raise ValueError, "Not valid for non-flat (omega_k_0 !=0) cosmology."

    omega = cden.omega_M_z(z,
                           omega_M_0=omega_M_0,
                           omega_lambda_0=1. - omega_M_0)
    lamb = 1 - omega
    a = 1 / (1 + z)

    if unnormed:
        norm = 1.0
    else:
        norm = 1.0 / fgrowth(0.0, omega_M_0, unnormed=True)
    return (norm * (5. / 2.) * a * omega /
            (omega**(4. / 7.) - lamb + (1. + omega / 2.) * (1. + lamb / 70.)))
def fgrowth(z, omega_M_0, unnormed=False):
    r"""Cosmological perturbation growth factor, normalized to 1 at z = 0.
    
    Approximate forumla from Carol, Press, & Turner (1992, ARA&A, 30,
    499), "good to a few percent in regions of plausible Omega_M,
    Omega_Lambda".

    This is proportional to D_1(z) from Eisenstein & Hu (1999 ApJ 511
    5) equation 10, but the normalization is different: fgrowth = 1 at
    z = 0 and ``D_1(z) = \frac{1+z_\mathrm{eq}}{1+z}`` as z goes
    to infinity.
    
    To get D_1 one would just use 
    
    ::
    
        D_1(z) = (1+z_\mathrm{eq}) \mathtt{fgrowth}(z,\Omega_{M0}, 1)

    (see \EH\ equation 1 for z_eq).

    ::
    
        \mathtt{fgrowth} = \frac{D_1(z)}{D_1(0)}

    Setting unnormed to true turns off normalization.

    Note: assumes Omega_lambda_0 = 1 - Omega_M_0!
    
    """
    #if cden.get_omega_k_0(**) != 0:
    #    raise ValueError, "Not valid for non-flat (omega_k_0 !=0) cosmology."

    omega = cden.omega_M_z(z, omega_M_0=omega_M_0, omega_lambda_0=1.-omega_M_0)
    lamb = 1 - omega
    a = 1/(1 + z)

    if unnormed:
        norm = 1.0
    else:
        norm = 1.0 / fgrowth(0.0, omega_M_0, unnormed=True) 
    return (norm * (5./2.) * a * omega / 
            (omega**(4./7.) - lamb + (1. + omega/2.) * (1. + lamb/70.))
            )
Esempio n. 5
0
def f(z):
    f = (den.omega_M_z(z, **cosmo))**(cc.gamma)
    return f