Example #1
0
def test_ring_phi0():
    counts = get_ring_pixel_counts(Nside)
    p0_arr = np.r_[0, np.cumsum(counts)[:-1]]
    from cmb.mapdatautils import array_vec2ang
    phi_fid = array_vec2ang(
        healpix.pix2vec_ring(Nside, np.arange(12 * Nside**2)))[:, 1]
    phi0 = get_ring_phi0(Nside)
    
    yield assert_almost_equal, phi0, phi_fid[p0_arr]
Example #2
0
def test_ring_thetas():
    theta = get_ring_thetas(Nside)
    eq_(theta.shape, (4 * Nside - 1,))

    hz = healpix.pix2vec_ring(Nside, np.arange(12 * Nside**2))[:, 2]
    hz = np.unique(hz)
    htheta = np.arccos(hz)[::-1]
    assert_almost_equal(theta, htheta)

    thetapos = get_ring_thetas(Nside, positive_only=True)
    eq_(thetapos[0], np.arccos(0))
    assert_almost_equal(thetapos, theta[:2 * Nside][::-1])