Commit 9c47a3f0 authored by Theo Steininger's avatar Theo Steininger
Browse files

Converted _distance_array_helper to static class method.

parent a7d97e19
......@@ -30,13 +30,6 @@ from d2o import arange
gl = gdi.get('libsharp_wrapper_gl')
hp = gdi.get('healpy')
def _distance_array_helper(index_array, lmax):
u=2*lmax+1
index_half=(index_array+np.minimum(lmax,index_array)+1)//2
m = (np.ceil((u - np.sqrt(u*u - 8 * (index_half - lmax))) / 2)).astype(int)
res = (index_half - m * (u - m) // 2).astype(np.float64)
return res
class LMSpace(Space):
"""
......@@ -182,11 +175,19 @@ class LMSpace(Space):
distribution_strategy=distribution_strategy)
dists = dists.apply_scalar_function(
lambda x: _distance_array_helper(x, self.lmax),
lambda x: self._distance_array_helper(x, self.lmax),
dtype=np.float)
return dists
@staticmethod
def _distance_array_helper(index_array, lmax):
u = 2*lmax + 1
index_half = (index_array+np.minimum(lmax, index_array)+1)//2
m = (np.ceil((u - np.sqrt(u*u - 8*(index_half - lmax)))/2)).astype(int)
res = (index_half - m*(u - m)//2).astype(np.float64)
return res
def get_fft_smoothing_kernel_function(self, sigma):
if sigma is None:
sigma = np.sqrt(2) * np.pi / (self.lmax + 1)
......
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