Example #1
0
def bias_eff(k, Pk, OmegaM, Masses, z, author):

    # compute halo mass function
    if author == 'SMT01':
        dndM = MFL.MF_theory(k,
                             Pk,
                             OmegaM,
                             Masses,
                             'ST',
                             bins=10000,
                             z=z,
                             delta=200.0)

    if author == 'Tinker':
        dndM = MFL.MF_theory(k,
                             Pk,
                             OmegaM,
                             Masses,
                             'Tinker',
                             bins=10000,
                             z=z,
                             delta=200.0)

    # compute halo bias
    b = bias(k, Pk, OmegaM, Masses, author, bins=10000)

    # integration parameters
    eps, h1, hmin = 1e-10, 1e0, 0.0

    yinit = np.array([0.0], dtype=np.float64)
    numerator = IL.odeint_example2(yinit,
                                   np.min(Masses),
                                   np.max(Masses),
                                   eps,
                                   h1,
                                   hmin,
                                   Masses,
                                   dndM * b,
                                   verbose=False)[0]

    yinit = np.array([0.0], dtype=np.float64)
    denominator = IL.odeint_example2(yinit,
                                     np.min(Masses),
                                     np.max(Masses),
                                     eps,
                                     h1,
                                     hmin,
                                     Masses,
                                     dndM,
                                     verbose=False)[0]

    bias_eff = numerator / denominator

    return bias_eff
Example #2
0
    def dndM(self):
        '''
        Halo mass function, note the need to convert from 1/h units in the
        output of pylians
        
        Interpolation done in log space
        '''
        kh, P = self.Pm_for_HMF

        #mass vector for pylians
        Mvec = (ulogspace(self.Mmin.to(self.Msunh), self.Mmax.to(self.Msunh),
                          256)).to(self.Msunh)

        #Compute Halo mass function
        mf = MFL.MF_theory(kh,
                           P,
                           self.camb_pars.omegam,
                           Mvec.value,
                           self.hmf_model,
                           z=self.z)

        d = (log_interp1d(Mvec.value, mf)(self.M.to(self.Msunh).value) *
             self.Mpch**-3 * self.Msunh**-1).to(self.Mpch**-3 * self.Msunh**-1)

        return d.to(u.Mpc**-3 * u.Msun**-1)
Example #3
0
eps = 1e-15
h1 = 1e0
hmin = 0.0
##############################################################################

if os.path.exists(f_out):
    M, MF = np.loadtxt(f_out, unpack=True)
else:
    # read input Pk
    k, Pk = np.loadtxt(f_Pk, unpack=True)

    # compute the masses at which compute the halo mass function
    M = np.logspace(np.log10(M_min), np.log10(M_max), bins_MF)

    # compute the MF
    MF = MFL.MF_theory(k, Pk, Omega_m, M, author, bins_k, z, delta)

    # save results to file
    np.savetxt(f_out, np.transpose([M, MF]))

M = np.ascontiguousarray(M)
MF = np.ascontiguousarray(MF)

M_HI = M0 * (M / Mmin)**alpha * np.exp(-Mmin / M)

A = MF * M_HI**2
B = MF * M_HI

yinit = np.array([0.0], dtype=np.float64)
numerator = IL.odeint(yinit,
                      1e8,