Beispiel #1
0
def test_R_vs_M():
    R = 1.0 #Mpc/h
    M = 4.*np.pi/3. * Omega_m * rhomconst * R**3
    npt.assert_almost_equal(bias.bias_at_R(R, klin, plin), bias.bias_at_M(M, klin, plin, Omega_m))
    R = np.array([1.2, 1.4, 1.5])
    M = 4.*np.pi/3. * Omega_m * rhomconst * R**3
    npt.assert_array_almost_equal(bias.bias_at_R(R, klin, plin), bias.bias_at_M(M, klin, plin, Omega_m))
Beispiel #2
0
def test_single_vs_array():
    #First sigma2
    a1 = peaks.sigma2_at_M(Ma, klin, plin, Omega_m)
    a2 = np.array([peaks.sigma2_at_M(Mi, klin, plin, Omega_m) for Mi in Ma])
    npt.assert_array_equal(a1, a2)
    a1 = peaks.sigma2_at_R(Ra, klin, plin)
    a2 = np.array([peaks.sigma2_at_R(Ri, klin, plin) for Ri in Ra])
    npt.assert_array_equal(a1, a2)
    #Now the bias
    a1 = bias.bias_at_M(Ma, klin, plin, Omega_m)
    a2 = np.array([bias.bias_at_M(Mi, klin, plin, Omega_m) for Mi in Ma])
    npt.assert_array_equal(a1, a2)
    a1 = bias.bias_at_R(Ra, klin, plin)
    a2 = np.array([bias.bias_at_R(Ri, klin, plin) for Ri in Ra])
    npt.assert_array_equal(a1, a2)
Beispiel #3
0
def test_mass_dependence():
    masses = np.logspace(13, 15, num=100)
    arrout = bias.bias_at_M(masses, klin, plin, Omega_m)
    for i in range(len(masses)-1):
        assert arrout[i] < arrout[i+1]
    Rs = (masses/(4./3.*np.pi*Omega_m*rhomconst))**(1./3.)
    arrout = bias.bias_at_R(Rs, klin, plin)
    for i in range(len(masses)-1):
        assert arrout[i] < arrout[i+1]
    nus = peaks.nu_at_M(masses, klin, plin, Omega_m)
    arrout = bias.bias_at_nu(nus)
    for i in range(len(masses)-1):
        assert arrout[i] < arrout[i+1]
Beispiel #4
0
def test_s2_and_nu_functions():
    #Test the mass calls
    s2 = peaks.sigma2_at_M(Mass, klin, plin, Omega_m)
    nu = peaks.nu_at_M(Mass, klin, plin, Omega_m)
    npt.assert_equal(1.686/np.sqrt(s2), nu)
    s2 = peaks.sigma2_at_M(Ma, klin, plin, Omega_m)
    nu = peaks.nu_at_M(Ma, klin, plin, Omega_m)
    npt.assert_array_equal(1.686/np.sqrt(s2), nu)
    out = bias.bias_at_M(Ma, klin, plin, Omega_m)
    out2 = bias.bias_at_nu(nu)
    npt.assert_array_equal(out, out2)
    #Now test the R calls
    R = 1.0 #Mpc/h; arbitrary
    s2 = peaks.sigma2_at_R(R, klin, plin)
    nu = peaks.nu_at_R(R, klin, plin)
    npt.assert_equal(1.686/np.sqrt(s2), nu)
    out = bias.bias_at_R(R, klin, plin)
    out2 = bias.bias_at_nu(nu)
    npt.assert_array_equal(out, out2)