First draft of SHTs in Python wrapper

This commit is contained in:
Dag Sverre Seljebotn 2015-05-15 10:26:40 +02:00
parent c680bbb2e5
commit 48e213151a
7 changed files with 397 additions and 17 deletions

View file

@ -0,0 +1,33 @@
import numpy as np
import healpy
from scipy.special import legendre
from scipy.special import p_roots
from numpy.testing import assert_allclose
import libsharp
from mpi4py import MPI
def test_basic():
lmax = 10
nside = 8
rank = MPI.COMM_WORLD.Get_rank()
ms = np.arange(rank, lmax + 1, MPI.COMM_WORLD.Get_size(), dtype=np.int32)
order = libsharp.packed_real_order(lmax, ms=ms)
grid = libsharp.healpix_grid(nside)
alm = np.zeros(order.local_size())
if rank == 0:
alm[0] = 1
elif rank == 1:
alm[0] = 1
map = libsharp.synthesis(grid, order, alm, comm=MPI.COMM_WORLD)
if rank == 0:
healpy.mollzoom(map)
from matplotlib.pyplot import show
show()