Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NIFTy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ift
NIFTy
Commits
9c47a3f0
Commit
9c47a3f0
authored
8 years ago
by
Theo Steininger
Browse files
Options
Downloads
Patches
Plain Diff
Converted _distance_array_helper to static class method.
parent
a7d97e19
No related branches found
No related tags found
2 merge requests
!69
Master
,
!65
Martin's monster merge part 2/N: partial de-cythonization
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
nifty/spaces/lm_space/lm_space.py
+9
-8
9 additions, 8 deletions
nifty/spaces/lm_space/lm_space.py
with
9 additions
and
8 deletions
nifty/spaces/lm_space/lm_space.py
+
9
−
8
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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment