Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
NIFTy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Merge Requests
13
Merge Requests
13
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ift
NIFTy
Commits
360cac16
Commit
360cac16
authored
Feb 19, 2019
by
Martin Reinecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tweaks
parent
0fadc5fd
Pipeline
#43905
passed with stages
in 8 minutes and 7 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
21 deletions
+16
-21
demos/misc/convolution_on_sphere.py
demos/misc/convolution_on_sphere.py
+2
-0
nifty5/operators/convolution_operators.py
nifty5/operators/convolution_operators.py
+14
-21
No files found.
demos/misc/convolution_on_sphere.py
View file @
360cac16
...
...
@@ -15,11 +15,13 @@ for i in range(0, npix, npix//12 + 27):
signal_vals
[
i
]
=
1.
signal
=
ift
.
from_global_data
(
dom_tuple
,
signal_vals
)
# Define kernel function
def
func
(
theta
):
ct
=
np
.
cos
(
theta
)
return
1.
*
np
.
logical_and
(
ct
>
0.7
,
ct
<=
0.8
)
# Create Convolution Operator
conv_op
=
ift
.
SphericalFuncConvolutionOperator
(
dom_tuple
,
func
)
...
...
nifty5/operators/convolution_operators.py
View file @
360cac16
...
...
@@ -26,32 +26,25 @@ from ..domain_tuple import DomainTuple
from
..field
import
Field
class
SphericalFuncConvolutionOperator
(
EndomorphicOperator
):
def
SphericalFuncConvolutionOperator
(
domain
,
func
):
"""Convolves input with a radially symmetric kernel defined by `func`
Parameters
----------
domain: domain of the operator
func: function defining the sperical convolution kernel
dependant only on theta in radians
domain: DomainTuple
Domain of the operator. Must have exactly one entry, which is
of type `HPSpace` or `GLSpace`.
func: function
This function needs to take exactly one argument, which is
colatitude in radians, and return the kernel amplitude at that
colatitude.
"""
def
__init__
(
self
,
domain
,
func
):
if
len
(
domain
)
!=
1
:
raise
ValueError
(
"need exactly one domain"
)
if
not
isinstance
(
domain
[
0
],
(
HPSpace
,
GLSpace
)):
raise
TypeError
(
"need a spherical domain"
)
self
.
_domain
=
domain
self
.
lm
=
domain
[
0
].
get_default_codomain
()
self
.
kernel
=
self
.
lm
.
get_conv_kernel_from_func
(
func
)
self
.
HT
=
HarmonicTransformOperator
(
self
.
lm
,
domain
[
0
])
self
.
_capability
=
self
.
TIMES
|
self
.
ADJOINT_TIMES
def
apply
(
self
,
x
,
mode
):
self
.
_check_input
(
x
,
mode
)
x_lm
=
self
.
HT
.
adjoint_times
(
x
.
weight
(
1
))
x_lm
=
x_lm
*
self
.
kernel
*
(
4.
*
np
.
pi
)
return
self
.
HT
(
x_lm
)
if
len
(
domain
)
!=
1
:
raise
ValueError
(
"need exactly one domain"
)
if
not
isinstance
(
domain
[
0
],
(
HPSpace
,
GLSpace
)):
raise
TypeError
(
"need a spherical domain"
)
kernel
=
domain
[
0
].
get_default_codomain
().
get_conv_kernel_from_func
(
func
)
return
SphericalConvolutionOperator
(
domain
,
kernel
)
class
SphericalConvolutionOperator
(
EndomorphicOperator
):
...
...
Write
Preview
Markdown
is supported
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