def alm2map(m, a_l, Nside): theta = get_ring_thetas(Nside) g = al2gmtheta(m, a_l, theta) Npix = 12 * Nside**2 map = np.zeros(Npix) g_m_theta = np.zeros((4 * Nside - 1, lmax + 1), dtype=np.complex) print g_m_theta.shape, g.shape # plt.clf() # plt.plot(g.real) g_m_theta[:, m] = g from wavemoth.fastsht import ShtPlan fake_input = np.zeros(1, dtype=np.cdouble) plan = ShtPlan(Nside, lmax, lmax, fake_input, map, 'mmajor') plan.perform_backward_ffts(0, 4 * Nside - 1) return map
from cmb.maps import pixel_sphere_map pixel_sphere_map(m[0, :]).plot(title=title) Nside = 256 lmax = 2 * Nside nmaps = 1 ring_counts = get_ring_pixel_counts(Nside) ring_offsets = np.cumsum(np.r_[0, ring_counts])[2 * Nside - 1:] input = np.zeros(((lmax + 1) * (lmax + 2) // 2, nmaps), dtype=np.complex128) sht_output = np.zeros((12 * Nside**2, nmaps)) psht_output = np.zeros((12 * Nside**2, nmaps), order='F') sht_plan = ShtPlan(Nside, lmax, lmax, input, sht_output, 'mmajor') psht_plan = PshtMmajorHealpix(lmax=lmax, Nside=Nside, nmaps=nmaps) def hash_array(x): h = hashlib.sha1() h.update(x) return h.hexdigest() def do_comparison(): psht_plan.alm2map(input, psht_output) sht_plan.execute() d = norm(sht_output - psht_output) f = norm(psht_output) # print d