Esempio n. 1
0
def ionization_from_collapse(z,
                             coeff_ion,
                             temp_min,
                             passed_min_mass=False,
                             **cosmo):
    """The ionized fraction of the universe using perturbation theory.

    Parameters
    ----------

    z: 
    
       Redshift values at which to evaluate the ionized fraction.

    coeff_ion:

       Coefficient giving the ratio between collapse fraction and
       ionized fraction (neglecting recombinations and assuming all
       photons are instantly absorbed).

    temp_min: 

       Either the minimum Virial temperature (in Kelvin) or minimum
       mass of halos (in solar masses) contributing to reionization.

    passed_temp_min: Boolean

       Set this to True if you pass a minimum mass, False (default) if
       you pass a minimum Virial temperature.

    cosmo: dict

       Cosmological parameters.

    Notes
    -----

    See Furlanetto et al. (2004ApJ...613....1F).

    """
    sd = cp.sig_del(temp_min, z, passed_min_mass=passed_min_mass, **cosmo)
    cf = cp.collapse_fraction(*sd)
    w = cf * coeff_ion
    return w
def test_figure1():
    """Plot HH fig. 1: Evolution of the collapsed fraction (no quant. tests).

    "Evolution of the collapsed fraction of all baryons in halos in
    three different virial temperature ranges."

    Haiman and Holder 2003ApJ...595....1H.

    """

    dz = 1.
    z = numpy.arange(45., 0.0, -1. * dz)

    cosmo = hh_cosmo()
    
    T_min = numpy.array([[1.0e2],
                         [1.0e4],
                         [2.0e5]])
             
    linestyle = ['-', ':', '--']

    # Collapse fraction with the various minimum Virial temps.
    fc = cp.collapse_fraction(*cp.sig_del(T_min, z, **cosmo))

    # Calculate fraction of mass in halos in the ranges of min T.
    fc_diff = numpy.empty((T_min.shape[0], z.shape[0]))
    fc_diff[0:-1] = fc[0:-1] - fc[1:]
    fc_diff[-1] = fc[-1]

    pylab.figure(figsize=(6,6))    
    for i in range(len(linestyle)):
        pylab.plot(z, fc_diff[i], ls=linestyle[i])

    pylab.xlabel(r"$\mathrm{z}$")
    pylab.ylabel(r"$\mathrm{F_{coll}}$")

    pylab.yscale('log')
    pylab.ylim(1e-5, 1.0)
    pylab.xlim(45.,0.)

    pylab.title("compare to " + inspect.stack()[0][3].replace('test_', '') + 
                " H&H (2003ApJ...595....1H).")
Esempio n. 3
0
def test_figure1():
    """Plot HH fig. 1: Evolution of the collapsed fraction (no quant. tests).

    "Evolution of the collapsed fraction of all baryons in halos in
    three different virial temperature ranges."

    Haiman and Holder 2003ApJ...595....1H.

    """

    dz = 1.
    z = numpy.arange(45., 0.0, -1. * dz)

    cosmo = hh_cosmo()

    T_min = numpy.array([[1.0e2], [1.0e4], [2.0e5]])

    linestyle = ['-', ':', '--']

    # Collapse fraction with the various minimum Virial temps.
    fc = cp.collapse_fraction(*cp.sig_del(T_min, z, **cosmo))

    # Calculate fraction of mass in halos in the ranges of min T.
    fc_diff = numpy.empty((T_min.shape[0], z.shape[0]))
    fc_diff[0:-1] = fc[0:-1] - fc[1:]
    fc_diff[-1] = fc[-1]

    pylab.figure(figsize=(6, 6))
    for i in range(len(linestyle)):
        pylab.plot(z, fc_diff[i], ls=linestyle[i])

    pylab.xlabel(r"$\mathrm{z}$")
    pylab.ylabel(r"$\mathrm{F_{coll}}$")

    pylab.yscale('log')
    pylab.ylim(1e-5, 1.0)
    pylab.xlim(45., 0.)

    pylab.title("compare to " + inspect.stack()[0][3].replace('test_', '') +
                " H&H (2003ApJ...595....1H).")
Esempio n. 4
0
from __future__ import absolute_import, division, print_function

import numpy
import cosmolopy.perturbation as cp
import cosmolopy.parameters as cparam
import pylab

# Get WMAP5 cosmological parameters.
cosmo = cparam.WMAP5_BAO_SN_mean()

# Set up an array of z values.
z = numpy.arange(6.0, 20.0, 0.1)

# Calculate collapse fraction.
f_col = cp.collapse_fraction(*cp.sig_del(1e4, z, **cosmo))

pylab.figure(figsize=(8, 6))
pylab.plot(z, f_col)
pylab.xlabel('z')
pylab.ylabel(r'$f_\mathrm{col}$')
pylab.show()
import numpy
import cosmolopy.perturbation as cp
import cosmolopy.parameters as cparam
import pylab

# Get WMAP5 cosmological parameters.
cosmo = cparam.WMAP5_BAO_SN_mean() 

# Set up an array of z values.
z = numpy.arange(6.0, 20.0, 0.1) 

# Calculate collapse fraction.
f_col = cp.collapse_fraction(*cp.sig_del(1e4, z, **cosmo))

pylab.figure(figsize=(8,6))
pylab.plot(z, f_col)
pylab.xlabel('z')
pylab.ylabel(r'$f_\mathrm{col}$')
pylab.show()