예제 #1
0
def volume_radius_dmdr(mass, **cosmology):
    """The volume, radius, and dm/dr for a sphere of the given mass.

    Uses the mean density of the universe.

    Parameters
    ----------

    mass: array
       mass of the sphere in Solar Masses, M_sun. 

    Returns
    -------

    volume in Mpc^3
    radius in Mpc
    dmdr in Msun / Mpc

    """
    rho_crit, rho_0 = cden.cosmo_densities(**cosmology)

    volume = mass / rho_0
    r = (volume / ((4. / 3.) * math.pi))**(1. / 3.)

    dmdr = 4. * math.pi * r**2. * rho_0

    return volume, r, dmdr
예제 #2
0
def volume_radius_dmdr(mass, **cosmology):
    """The volume, radius, and dm/dr for a sphere of the given mass.

    Uses the mean density of the universe.

    Parameters
    ----------

    mass: array
       mass of the sphere in Solar Masses, M_sun. 

    Returns
    -------

    volume in Mpc^3
    radius in Mpc
    dmdr in Msun / Mpc

    """
    rho_crit, rho_0 = cden.cosmo_densities(**cosmology)

    volume  = mass / rho_0
    r  = (volume / ((4. / 3.) * math.pi))**(1./3.)
    
    dmdr = 4. * math.pi * r**2. * rho_0

    return volume, r, dmdr
예제 #3
0
def radius_to_mass(r, **cosmology):
    """The mass of a sphere of radius r in Mpc.
    Uses the mean density of the universe.
    """
    volume = (4./3.) * math.pi * r**3.
    
    if 'rho_0' in cosmology:
        rho_0 = cosmology['rho_0']
    else:
        rho_crit, rho_0 = cden.cosmo_densities(**cosmology)

    mass = volume * rho_0
    return mass
예제 #4
0
def radius_to_mass(r, **cosmology):
    """The mass of a sphere of radius r in Mpc.

    Uses the mean density of the universe.

    """
    volume = (4./3.) * math.pi * r**3.
    
    if 'rho_0' in cosmology:
        rho_0 = cosmology['rho_0']
    else:
        rho_crit, rho_0 = cden.cosmo_densities(**cosmology)

    mass = volume * rho_0
    return mass
예제 #5
0
import useful_functions as uf
import distance as cd
import density as den
import constants as cc
import reionization as cr
from decimal import Decimal

cosmo=uf.cosmo
Mps_interpf=uf.Mps_interpf

n_points=uf.n_points
z_r=10.
x_e=1.
G=cc.G_const_Mpc_Msun_s/cc.M_sun_g
#rho_c=3*H0**2/(8.*np.pi*G)
rho_c=den.cosmo_densities(**cosmo)[0]*cc.M_sun_g #in units of g/Mpc^3
sigma_T=cc.sigma_T_Mpc
tau_r=0.055
T_rad=2.73 #In Kelvin

chi_r = uf.chi(z_r)
chi_m = uf.chi(1100)
chi_min=0.0001
k_min=1e-3
k_max=0.1
chi_array=np.linspace(chi_min,chi_m,n_points)
#tau_r=0.046*omega_b_0*h*x_e[np.sqrt(omega_M_0(1+z_r)**3+(1-omega_M_0))-1]
#get matter power spec data
mu_e=1.44
m_p=cc.m_p_g #in grams
rho_g0=cosmo['omega_b_0']*rho_c
예제 #6
0
import numpy as np
import matplotlib.pyplot as plt
import density as den
import constants as cc
import reionization as cr
import useful_functions as uf
#print (chi_m)

cosmo=uf.cosmo
zed=uf.zed
n_points=2000
H0=cc.H100_s*cosmo['h']
x_e=1.
G=cc.G_const_Mpc_Msun_s/cc.M_sun_g
#rho_c=3*H0**2/(8.*np.pi*G)
rho_c=den.cosmo_densities(**cosmo)[0]*cc.M_sun_g
gamma=0.53
sigma_T=cc.sigma_T_Mpc
z_r=6.
chi_r=uf.chi(z_r)
chi_m = uf.chi(1100)
k_min=0.0001
k_max=10.
chi=np.linspace(0.0001,chi_r,n_points)
#chi = np.logspace(np.log(0.0001),np.log(chi_m),n_points)
kpar = np.logspace(-4.,1.,n_points)
Mps_interpf=uf.Mps_interpf
#print (omega_b_0)
#tau_r=0.046*omega_b_0*h*x_e[np.sqrt(omega_M_0(1+z_r)**3+(1-omega_M_0))-1]

#get matter power spec data