def barrier_density(z, zeta=40, var_m=None, m=None, m_min=None): """ Equation 4 """ delta_c = barkana_loeb_2001.critical_overdensity_collapse(z) K_zeta = erfinv(1. - 1. / zeta) if var_m is None: var_m = barkana_loeb_2001.matter_variance(z, M=m, power_spectra=None) if m_min is None: m_min = minimum_source_mass(z, Tvir=1e4) var_min = barkana_loeb_2001.matter_variance(z, M=m_min, power_spectra=None) return delta_c - np.sqrt(2 * (var_min - var_m)) * K_zeta
def linear_fit_barrier(m, z, zeta=40, var_m=None): B0 = barrier_density(z, zeta=zeta, var_m=0) B1 = (barrier_density(z, zeta=zeta, var_m=0.1) - barrier_density(z, zeta=zeta, var_m=0)) / 0.1 if var_m is None: var_m = barkana_loeb_2001.matter_variance(z, M=m, power_spectra=None) return B0 + B1 * var_m
def mass_function(m, z, zeta=40): rho_mean_ = mean_density(z) #Solar_mass/Mpc^3 B0 = barrier_density(z, zeta=zeta, var_m=0) def f(x): m = np.exp(x) y = barkana_loeb_2001.matter_variance(z, M=m) return np.sqrt(y) if type(m) == np.float: sig2 = barkana_loeb_2001.matter_variance(z, M=m, power_spectra=None) Bm = linear_fit_barrier(m, z, zeta=zeta, var_m=None) dsigdm = derivative(f, np.log(m), order=15) else: sig2 = np.array([ barkana_loeb_2001.matter_variance(z, M=m1, power_spectra=None) for m1 in m ]) Bm = np.array( [linear_fit_barrier(m1, z, zeta=zeta, var_m=None) for m1 in m]) dsigdm = np.array([derivative(f, np.log(m1), order=15) for m1 in m]) m_dndm = np.sqrt(2 / np.pi) * rho_mean_ * np.abs(dsigdm) * B0 * np.exp( -Bm**2 / (2 * sig2)) / sig2 / m return m_dndm
def b_mz(m, z, zeta=40): Bm = functions.linear_fit_barrier(m, z, zeta=zeta) B0 = functions.barrier_density(z, zeta=zeta, var_m=0) var_m = barkana_loeb_2001.matter_variance(z, M=m, power_spectra=None) return 1 + B0**2 / var_m / Bm
def f(x): m = np.exp(x) y = barkana_loeb_2001.matter_variance(z, M=m) return np.sqrt(y)