from deproject.piecewise_powerlaw import esd_to_rho

from matplotlib import pyplot as plt
from matplotlib.colors import LogNorm
from matplotlib import gridspec
from matplotlib import rc, rcParams
from matplotlib import gridspec

# Bahamas simulation parameters
Zlens = 0.25
O_matter = 0.2793
O_lambda = 0.7207
sigma8 = 0.821
h = 0.7
cosmo = LambdaCDM(H0=h * 100, Om0=O_matter, Ode0=O_lambda)
rho_crit = cosmo.critical_density(Zlens).to('Msun/pc3').value
print(rho_crit)

## Define projected distance bins R

# Creating the Rbins
Runit, Nbins, Rmin, Rmax = ['Mpc', 16, -999,
                            999]  # Same R-bins as r from PROFILES
Rbins, Rcenters, Rmin_pc, Rmax_pc, xvalue = utils.define_Rbins(
    Runit, Rmin, Rmax, Nbins, True)
print('R-bins: %i bins between %g and %g %s' % (Nbins, Rmin, Rmax, Runit))

## Import galaxy observables from Bahamas catalog

# Define the list of 'used' galaxies
catnum = 515
Esempio n. 2
0
Omega0 = 0.302
OmegaLambda = 0.698
OmegaBaryon = 0.04751
HubbleParam = 0.68

gadget_length_in_cm = Kpc / HubbleParam
gadget_mass_in_g = 1e10 * Msun / HubbleParam
gadget_velocity_in_cm_per_s = 1e5
gadget_time_in_s = gadget_length_in_cm / gadget_velocity_in_cm_per_s
gadget_energy_in_erg = gadget_mass_in_g * gadget_length_in_cm**2 / (
    gadget_time_in_s**2)

cosmology = LambdaCDM(H0=HubbleParam * 100, Om0=Omega0, Ode0=OmegaLambda)

D_c = lambda z: cosmology.comoving_distance(z).cgs.value
D_a = lambda z: cosmology.angular_diameter_distance(z).cgs.value
D_l = lambda z: cosmology.luminosity_distance(z).cgs.value

rho_crit = lambda z: cosmology.critical_density(z).cgs.value
rho_crit0 = cosmology.critical_density0.cgs.value

rho_bar_crit = lambda z: rho_crit(z) * OmegaBaryon
rho_bar_crit0 = rho_crit0 * OmegaBaryon

n_p_crit = lambda z: rho_bar_crit(z) / m_p * Xh
n_p_crit0 = rho_bar_crit0 / m_p * Xh

n_e_crit = lambda z: n_p_crit(z) * elec_frac
n_e_crit0 = n_p_crit0 * elec_frac