コード例 #1
0
ファイル: test_psht.py プロジェクト: wavemoth/wavemoth
def test_basic():
    nmaps = 3
    Nside = 16
    lmax = 2 * Nside
    T = PshtMmajorHealpix(lmax=32, Nside=16, nmaps=nmaps)
    alm = np.zeros((((lmax + 1)*(lmax+2))//2, nmaps), dtype=np.complex128)
    alm[lm_to_idx_mmajor(1, 1, lmax), :] = 1 + 2j
    alm[:, 0] *= 1
    alm[:, 1] *= 1
    alm[:, 2] *= -1
    map = np.zeros((12 * Nside**2, nmaps), dtype=np.double, order='F')
    T.alm2map(alm, map, repeat=2)
    if 0:
        pixel_sphere_map(map[:, 0]).plot()
        pixel_sphere_map(map[:, 1]).plot()
        pixel_sphere_map(map[:, 2]).plot()
        plt.show()
コード例 #2
0
def test_basic():
    nmaps = 3
    Nside = 16
    lmax = 2 * Nside
    T = PshtMmajorHealpix(lmax=32, Nside=16, nmaps=nmaps)
    alm = np.zeros((((lmax + 1) * (lmax + 2)) // 2, nmaps),
                   dtype=np.complex128)
    alm[lm_to_idx_mmajor(1, 1, lmax), :] = 1 + 2j
    alm[:, 0] *= 1
    alm[:, 1] *= 1
    alm[:, 2] *= -1
    map = np.zeros((12 * Nside**2, nmaps), dtype=np.double, order='F')
    T.alm2map(alm, map, repeat=2)
    if 0:
        pixel_sphere_map(map[:, 0]).plot()
        pixel_sphere_map(map[:, 1]).plot()
        pixel_sphere_map(map[:, 2]).plot()
        plt.show()
コード例 #3
0
def plot_map(m):
    from cmb.maps import pixel_sphere_map
    pixel_sphere_map(m[0, :]).plot()
コード例 #4
0
ファイル: accuracy.py プロジェクト: wgsproul/wavemoth
def plot_map(m, title=None):
    from cmb.maps import pixel_sphere_map
    pixel_sphere_map(m[0, :]).plot(title=title)
コード例 #5
0
ファイル: prototype.py プロジェクト: wavemoth/wavemoth
#    SPeven = butterfly(P[:, ::2])
#    SPodd = butterfly(P[:, 1::2])
#    print 'Compression', SPeven.size() / DenseMatrix(P[:, ::2]).size()
#    print 'Compression', SPodd.size() / DenseMatrix(P[:, 1::2]).size()

if 0:
    x = np.cos(get_ring_thetas(Nside))
    x[np.abs(x) < 1e-10] = 0
    xneg = x[x < 0]
    xpos = x[x > 0]
    assert np.allclose(-xneg[::-1], xpos)
    X = InnerSumPerM(m, x[x >= 0], lmax)
    P_even_arr = X.P_even_arr.copy('F')
    P_even = X.P_even
    a_l_even = a_l[::2].copy()

    
if 0:
    map = alm2map(m, a_l, Nside)

    from cmb.maps import pixel_sphere_map, harmonic_sphere_map
    pixel_sphere_map(map).plot(title='fast')

    alm_fid = harmonic_sphere_map(0, lmin=0, lmax=lmax, is_complex=False)
    assert m != 0
    for l in range(m, lmax + 1):
        alm_fid[l**2 + l + m] = np.sqrt(2) * a_l[l - m] # real is repacked
    print 'Diff', np.linalg.norm(map - alm_fid.to_pixel(Nside))
    alm_fid.to_pixel(Nside).plot(title='fiducial')
    #(map - alm_fid.to_pixel(Nside)).plot(title='diff')
コード例 #6
0
def plot_map(m):
    from cmb.maps import pixel_sphere_map
    pixel_sphere_map(m[0, :]).plot()
コード例 #7
0
ファイル: prototype.py プロジェクト: wgsproul/wavemoth
#    as_matrix(np.log(np.abs(Peven))).plot()
#    SPeven = butterfly(P[:, ::2])
#    SPodd = butterfly(P[:, 1::2])
#    print 'Compression', SPeven.size() / DenseMatrix(P[:, ::2]).size()
#    print 'Compression', SPodd.size() / DenseMatrix(P[:, 1::2]).size()

if 0:
    x = np.cos(get_ring_thetas(Nside))
    x[np.abs(x) < 1e-10] = 0
    xneg = x[x < 0]
    xpos = x[x > 0]
    assert np.allclose(-xneg[::-1], xpos)
    X = InnerSumPerM(m, x[x >= 0], lmax)
    P_even_arr = X.P_even_arr.copy('F')
    P_even = X.P_even
    a_l_even = a_l[::2].copy()

if 0:
    map = alm2map(m, a_l, Nside)

    from cmb.maps import pixel_sphere_map, harmonic_sphere_map
    pixel_sphere_map(map).plot(title='fast')

    alm_fid = harmonic_sphere_map(0, lmin=0, lmax=lmax, is_complex=False)
    assert m != 0
    for l in range(m, lmax + 1):
        alm_fid[l**2 + l + m] = np.sqrt(2) * a_l[l - m]  # real is repacked
    print 'Diff', np.linalg.norm(map - alm_fid.to_pixel(Nside))
    alm_fid.to_pixel(Nside).plot(title='fiducial')
    #(map - alm_fid.to_pixel(Nside)).plot(title='diff')
コード例 #8
0
ファイル: test_wavemoth.py プロジェクト: wavemoth/wavemoth
def plot_map(m, title=None, **kw):
    from cmb.maps import pixel_sphere_map
    pixel_sphere_map(m).plot(title=title, **kw)
コード例 #9
0
def plot_map(m, title=None, **kw):
    from cmb.maps import pixel_sphere_map
    pixel_sphere_map(m).plot(title=title, **kw)