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

cleanup

parent 73edbd97
Pipeline #76448 passed with stages
in 12 minutes and 59 seconds
......@@ -57,7 +57,7 @@ blm = random_alm(lmax, kmax, ncomp)
t0 = time.time()
# build interpolator object for slm and blm
foo = totalconvolve.PyInterpolator(slm, blm, separate, lmax, kmax, epsilon=1e-4, nthreads=2)
foo = totalconvolve.Interpolator(slm, blm, separate, lmax, kmax, epsilon=1e-4, nthreads=2)
print("setup time: ", time.time()-t0)
nth = lmax+1
nph = 2*lmax+1
......
......@@ -50,7 +50,7 @@ blm = random_alm(lmax, kmax, ncomp)
t0 = time.time()
# build interpolator object for slm and blm
foo = totalconvolve.PyInterpolator(slm, blm, separate, lmax, kmax,
foo = totalconvolve.Interpolator(slm, blm, separate, lmax, kmax,
epsilon=epsilon, ofactor=ofactor,
nthreads=nthreads)
t1 = time.time()-t0
......@@ -82,7 +82,7 @@ del foo
print("Interpolating {} random angle triplets: {}s".format(nptg, time.time()-t0))
t0 = time.time()
fake = rng.uniform(0., 1., (ptg.shape[0], ncomp2))
foo2 = totalconvolve.PyInterpolator(lmax, kmax, ncomp2, epsilon=epsilon, ofactor=ofactor, nthreads=nthreads)
foo2 = totalconvolve.Interpolator(lmax, kmax, ncomp2, epsilon=epsilon, ofactor=ofactor, nthreads=nthreads)
t0 = time.time()
foo2.deinterpol(ptg.reshape((-1, 3)), fake)
print("Adjoint interpolation: {}s".format(time.time()-t0))
......@@ -96,7 +96,7 @@ print("Adjointness error: {}".format(v1/v2-1.))
# build interpolator object for slm and blm
t0 = time.time()
foo_f = totalconvolve.PyInterpolator_f(slm.astype(np.complex64), blm.astype(np.complex64), separate, lmax, kmax, epsilon=epsilon, ofactor=ofactor, nthreads=nthreads)
foo_f = totalconvolve.Interpolator_f(slm.astype(np.complex64), blm.astype(np.complex64), separate, lmax, kmax, epsilon=epsilon, ofactor=ofactor, nthreads=nthreads)
print("\nSingle precision convolution/interpolation:")
print("preparation of interpolation grid: {}s".format(time.time()-t0))
......@@ -108,7 +108,7 @@ t0 = time.time()
bar_f = foo_f.interpol(ptgf)
del foo_f
print("Interpolating {} random angle triplets: {}s".format(nptg, time.time()-t0))
foo2_f = totalconvolve.PyInterpolator_f(lmax, kmax, ncomp2, epsilon=epsilon, ofactor=ofactor, nthreads=nthreads)
foo2_f = totalconvolve.Interpolator_f(lmax, kmax, ncomp2, epsilon=epsilon, ofactor=ofactor, nthreads=nthreads)
t0 = time.time()
foo2_f.deinterpol(ptgf.reshape((-1, 3)), fake_f)
print("Adjoint interpolation: {}s".format(time.time()-t0))
......
......@@ -44,7 +44,7 @@ ptg[:, 2] *= 2*np.pi # psi
# so we set `separate` to `False`
print("classic interpolator setup...")
inter_classic = totalconvolve.PyInterpolator(
inter_classic = totalconvolve.Interpolator(
slm, blm, separate=False, lmax=lmax, kmax=kmax, epsilon=1e-4, nthreads=2)
print("...done")
......@@ -66,7 +66,7 @@ del inter_classic
separate = True
print("HWP interpolator setup...")
inter_hwp = totalconvolve.PyInterpolator(
inter_hwp = totalconvolve.Interpolator(
slm, blm, separate=True, lmax=lmax, kmax=kmax, epsilon=1e-4, nthreads=2)
print("...done")
......
......@@ -61,7 +61,7 @@ def test_against_convolution(lkmax, ncomp, separate):
slm = random_alm(rng, lmax, lmax, ncomp)
blm = random_alm(rng, lmax, kmax, ncomp)
inter = totalconvolve.PyInterpolator(slm, blm, separate, lmax, kmax,
inter = totalconvolve.Interpolator(slm, blm, separate, lmax, kmax,
epsilon=1e-8, nthreads=2)
nptg = 50
ptg = np.zeros((nptg, 3))
......@@ -98,11 +98,11 @@ def test_adjointness(lkmax, ncomp, separate):
ptg[:, 0] *= np.pi
ptg[:, 1] *= 2*np.pi
ptg[:, 2] *= 2*np.pi
foo = totalconvolve.PyInterpolator(slm, blm, separate, lmax, kmax, epsilon=1e-6, nthreads=2)
foo = totalconvolve.Interpolator(slm, blm, separate, lmax, kmax, epsilon=1e-6, nthreads=2)
inter1 = foo.interpol(ptg)
ncomp2 = inter1.shape[1]
fake = rng.uniform(0., 1., (ptg.shape[0], ncomp2))
foo2 = totalconvolve.PyInterpolator(lmax, kmax, ncomp2, epsilon=1e-6, nthreads=2)
foo2 = totalconvolve.Interpolator(lmax, kmax, ncomp2, epsilon=1e-6, nthreads=2)
foo2.deinterpol(ptg.reshape((-1, 3)), fake)
bla = foo2.getSlm(blm)
v1 = np.sum([myalmdot(slm[:, c], bla[:, c], lmax, lmax, 0) for c in range(ncomp)])
......
......@@ -227,7 +227,7 @@ void add_totalconvolve(py::module &msup)
m.doc() = totalconvolve_DS;
using inter_d = PyInterpolator<double>;
py::class_<inter_d> (m, "PyInterpolator", py::module_local(), pyinterpolator_DS)
py::class_<inter_d> (m, "Interpolator", py::module_local(), pyinterpolator_DS)
.def(py::init<const py::array &, const py::array &, bool, int64_t, int64_t, double, double, int>(),
initnormal_DS, "sky"_a, "beam"_a, "separate"_a, "lmax"_a, "kmax"_a, "epsilon"_a, "ofactor"_a=1.5,
"nthreads"_a=0)
......@@ -238,7 +238,7 @@ void add_totalconvolve(py::module &msup)
.def ("getSlm", &inter_d::pygetSlm, getSlm_DS, "beam"_a)
.def ("support", &inter_d::support);
using inter_f = PyInterpolator<float>;
py::class_<inter_f> (m, "PyInterpolator_f", py::module_local(), pyinterpolator_DS)
py::class_<inter_f> (m, "Interpolator_f", py::module_local(), pyinterpolator_DS)
.def(py::init<const py::array &, const py::array &, bool, int64_t, int64_t, float, float, int>(),
initnormal_DS, "sky"_a, "beam"_a, "separate"_a, "lmax"_a, "kmax"_a, "epsilon"_a, "ofactor"_a=1.5f,
"nthreads"_a=0)
......
......@@ -9,6 +9,7 @@ import pybind11
pkgname = 'ducc0'
version = '0.1.0'
def _get_files_by_suffix(directory, suffix):
path = directory
iterable_sources = (iglob(os.path.join(root, '*.'+suffix))
......
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