Commit e21669e4 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

add SHT accuracy test

parent f82a8e54
......@@ -103,7 +103,7 @@ if sys.platform == 'darwin':
'-Wl,-dylib_install_name,@loader_path/{}'.format(full_name))
base_library_link_args.append('-dynamiclib')
else:
extra_compile_args += ['-fopenmp', '-march=native']
extra_compile_args += ['-fopenmp', '-march=native', '-O3', '-ffast-math']
python_module_link_args += ['-fopenmp', '-march=native']
extra_c_compile_args.append('--std=c99')
extra_cc_compile_args.append('--std=c++14')
......
......@@ -2,7 +2,7 @@ import pyHealpix as ph
import numpy as np
import math
import pytest
from numpy.testing import assert_equal
from numpy.testing import assert_equal, assert_allclose
pmp = pytest.mark.parametrize
......@@ -70,3 +70,23 @@ def test_vecangvec(vlen):
inp = random_ptg(vlen)
out = ph.vec2ang(ph.ang2vec(inp))
assert_equal(np.all(np.abs(out-inp) < 1e-14), True)
def test_sht():
lmax = 512
mmax = 512
nlat = lmax+1
nlon = 2*mmax+1
job = ph.sharpjob_d()
nalm = ((mmax+1)*(mmax+2))//2 + (mmax+1)*(lmax-mmax)
nalm_r = nalm*2-lmax-1
alm_r = np.random.uniform(-1., 1., nalm_r)
alm = np.empty(nalm, dtype=np.complex128)
alm[0:lmax+1] = alm_r[0:lmax+1]
alm[lmax+1:] = np.sqrt(0.5)*(alm_r[lmax+1::2] + 1j*alm_r[lmax+2::2])
job.set_triangular_alm_info(lmax, mmax)
job.set_Gauss_geometry(nlat, nlon)
alm2 = job.map2alm(job.alm2map(alm))
assert_allclose(alm, alm2)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment