コード例 #1
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)
コード例 #2
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)
    #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)