Exemplo n.º 1
0
def check_corr_3d(cosmo):

    # Scale factor
    a = 0.8

    # Distances (in Mpc)
    r_int = 50
    r = 50.
    r_lst = np.linspace(50, 100, 10)

    # Make sure correlation functions work for valid inputs
    corr1 = ccl.correlation_3d(cosmo, a, r_int)
    corr2 = ccl.correlation_3d(cosmo, a, r)
    corr3 = ccl.correlation_3d(cosmo, a, r_lst)
    assert_(all_finite(corr1))
    assert_(all_finite(corr2))
    assert_(all_finite(corr3))
Exemplo n.º 2
0
def test_correlation_3d(model):
    Omega_v = [0.7, 0.7, 0.7, 0.65, 0.75]
    w_0 = [-1.0, -0.9, -0.9, -0.9, -0.9]
    w_a = [0.0, 0.0, 0.1, 0.1, 0.1]

    cosmo = ccl.Cosmology(
        Omega_c=0.25,
        Omega_b=0.05,
        h=0.7,
        sigma8=0.8,
        n_s=0.96,
        Neff=3.046,
        m_nu_type='normal',
        Omega_g=0,
        Omega_k=1.0 - 0.25 - 0.05 - Omega_v[model],
        w0=w_0[model],
        wa=w_a[model],
        transfer_function='bbks',
        matter_power_spectrum='halofit')

    data = np.loadtxt("./benchmarks/data/model%d_xi.txt" % (model+1))
    N1 = 40
    data1 = data[:N1, :]
    r1 = data1[:, 0]
    data2 = data[N1:, :]
    r2 = data2[:, 0]

    for z in np.arange(6):
        zind = int(z)
        a = 1.0 / (1 + z)

        xi1 = ccl.correlation_3d(cosmo, a, r1)
        err = np.abs(r1*r1*(xi1-data1[:, zind+1]))
        assert np.allclose(err, 0, rtol=0, atol=CORR_TOLERANCE1[zind])

        xi2 = ccl.correlation_3d(cosmo, a, data2[:, 0])
        err = np.abs(r2*r2*(xi2-data2[:, zind+1]))
        assert np.allclose(err, 0, rtol=0, atol=CORR_TOLERANCE1[zind])
Exemplo n.º 3
0
def test_correlation_3d_smoke(rval):
    a = 0.8
    corr = ccl.correlation_3d(COSMO, a, rval)
    assert np.all(np.isfinite(corr))
    assert np.shape(corr) == np.shape(rval)