Exemple #1
0
def test_reduced_shear_transform_mw():

    L = 20
    Cl = np.ones(L) * 1E-4
    seed = 1
    Method = "MW"

    kappa_lm = mm.generate_kappa_lm_mw(Cl, L, seed=seed)

    k_mw = ssht.inverse(kappa_lm, L, Reality=True, Method=Method)

    gamma_lm = mm.kappa_lm_to_gamma_lm_mw(kappa_lm, L)

    gamma = ssht.inverse(gamma_lm, L, Method=Method, Spin=2)

    shear = gamma / (1.0 - k_mw)

    k_rec_mw = mm.reduced_shear_to_kappa_mw(shear,
                                            L,
                                            Iterate=True,
                                            Method=Method,
                                            tol_error=1E-10)

    np.testing.assert_almost_equal(
        k_rec_mw,
        k_mw,
        decimal=7,
        err_msg="reduced shear and kappa transoforms are not invereses")
Exemple #2
0
def test_lm_transform_mw():

    L = 20
    Cl = np.ones(L)
    seed = 1

    kappa_lm = mm.generate_kappa_lm_mw(Cl, L, seed=seed)

    gamma_lm = mm.kappa_lm_to_gamma_lm_mw(kappa_lm, L)

    kappa_lm_rec = mm.gamma_lm_to_kappa_lm_mw(gamma_lm, L)

    np.testing.assert_almost_equal(
        kappa_lm_rec,
        kappa_lm,
        decimal=7,
        err_msg="lm gamma and kappa MW transoforms are not invereses")
Exemple #3
0
def test_generate_kappa_lm_mw():

    L = 3
    Cl = np.array([1E2, 1E4, 1E6])
    seed = 1

    kappa_gen = mm.generate_kappa_lm_mw(Cl, L, seed=seed)

    kappa_prep = np.array([0.0+0j, 0.0+0j, 0.0+0j, 0.0+0j,\
          -1072.96862216-865.40762932j,   611.75641365-528.17175226j,\
           1624.34536366  +0j,  -611.75641365-528.17175226j,\
          -1072.96862216+865.40762932j])

    np.testing.assert_almost_equal(
        kappa_gen,
        kappa_prep,
        decimal=7,
        err_msg='mm.generate_kappa_lm_hp failed to generate standard output',
        verbose=True)
Exemple #4
0
def test_gamma_transform_mw():

    L = 20
    Cl = np.ones(L)
    seed = 1
    Method = "MW"

    kappa_lm = mm.generate_kappa_lm_mw(Cl, L, seed=seed)

    k_mw = ssht.inverse(kappa_lm, L, Reality=True, Method=Method)

    gamma_lm = mm.kappa_lm_to_gamma_lm_mw(kappa_lm, L)

    gamma = ssht.inverse(gamma_lm, L, Method=Method, Spin=2)

    k_rec_mw = mm.gamma_to_kappa_mw(gamma, L, Method=Method)

    np.testing.assert_almost_equal(
        k_rec_mw,
        k_mw,
        decimal=7,
        err_msg="gamma and kappa transoforms are not invereses")
error_orthographic_E = np.zeros((N_angle, N_real))
error_steriographic_E = np.zeros((N_angle, N_real))
error_gnomic_E = np.zeros((N_angle, N_real))

error_cylindrical_B = np.zeros((N_angle, N_real))
error_mercator_B = np.zeros((N_angle, N_real))
error_sine_B = np.zeros((N_angle, N_real))
error_orthographic_B = np.zeros((N_angle, N_real))
error_steriographic_B = np.zeros((N_angle, N_real))
error_gnomic_B = np.zeros((N_angle, N_real))

Cls = np.loadtxt("data/cls_ap.txt")

for i_real in range(N_real):
    print i_real
    k_lm_mw = mm.generate_kappa_lm_mw(np.array(Cls[:, 1]), L)

    ks_lm_mw = ssht.guassian_smoothing(k_lm_mw, L, sigma_in=np.pi / 256)

    k_mw = ssht.inverse(ks_lm_mw, L, Reality=True, Method=Method)

    gamma_lm = mm.kappa_lm_to_gamma_lm_mw(ks_lm_mw, L)

    gamma = ssht.inverse(gamma_lm, L, Method=Method, Spin=2)
    if do_cylindrical:
        print "Doing Projection Cylindrical"

        gamma_plane = -gamma
        kappa_orig_plane = k_mw
        kappa_plane = mm.gamma_to_kappa_plane(gamma_plane, np.pi / L,
                                              2 * np.pi / (2 * L - 1))