Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
9c47a3f0
Commit
9c47a3f0
authored
Apr 21, 2017
by
Theo Steininger
Browse files
Converted _distance_array_helper to static class method.
parent
a7d97e19
Changes
1
Hide whitespace changes
Inline
Side-by-side
nifty/spaces/lm_space/lm_space.py
View file @
9c47a3f0
...
...
@@ -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
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment