First draft of SHTs in Python wrapper
This commit is contained in:
parent
c680bbb2e5
commit
48e213151a
7 changed files with 397 additions and 17 deletions
33
python/libsharp/tests/test_sht.py
Normal file
33
python/libsharp/tests/test_sht.py
Normal 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()
|
Loading…
Add table
Add a link
Reference in a new issue