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
10
Issues
10
List
Boards
Labels
Service Desk
Milestones
Merge Requests
9
Merge Requests
9
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
6d39eb28
Commit
6d39eb28
authored
Jul 19, 2019
by
Lukas Platz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test
parent
2bdb2562
Pipeline
#52190
passed with stages
in 7 minutes and 55 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
test/test_operators/test_convolution_operators.py
test/test_operators/test_convolution_operators.py
+20
-3
No files found.
test/test_operators/test_convolution_operators.py
View file @
6d39eb28
...
@@ -20,17 +20,34 @@ from numpy.testing import assert_allclose, assert_equal
...
@@ -20,17 +20,34 @@ from numpy.testing import assert_allclose, assert_equal
import
nifty5
as
ift
import
nifty5
as
ift
import
numpy
as
np
import
numpy
as
np
from
..common
import
list2fixture
space
=
list2fixture
([
ift
.
RGSpace
(
4
),
ift
.
HPSpace
(
4
),
ift
.
GLSpace
(
4
)
])
def
test_const_func
(
space
):
ones
=
lambda
x
:
np
.
ones
(
x
.
shape
)
sig
=
ift
.
Field
.
from_random
(
'normal'
,
domain
=
space
)
fco_op
=
ift
.
FuncConvolutionOperator
(
space
,
ones
)
vals
=
fco_op
(
sig
).
to_global_data
()
vals
=
np
.
round
(
vals
,
decimals
=
5
)
assert
len
(
np
.
unique
(
vals
))
==
1
def
gauss
(
x
,
sigma
):
def
gauss
(
x
,
sigma
):
normalization
=
np
.
sqrt
(
2.
*
np
.
pi
)
*
sigma
normalization
=
np
.
sqrt
(
2.
*
np
.
pi
)
*
sigma
return
np
.
exp
(
-
0.5
*
x
*
x
/
sigma
**
2
)
/
normalization
return
np
.
exp
(
-
0.5
*
x
*
x
/
sigma
**
2
)
/
normalization
def
test_
rgspace
():
def
test_
gaussian_smoothing
():
N
=
128
N
=
128
sigma
=
N
/
10
**
4
sigma
=
N
/
10
**
4
dom
=
ift
.
RGSpace
(
N
)
dom
=
ift
.
RGSpace
(
N
)
sig
=
ift
.
exp
(
ift
.
from_random
(
'normal'
,
dom
))
sig
=
ift
.
exp
(
ift
.
Field
.
from_random
(
'normal'
,
dom
))
fco_op
=
ift
.
FuncConvolutionOperator
(
dom
,
lambda
x
:
gauss
(
x
,
sigma
))
fco_op
=
ift
.
FuncConvolutionOperator
(
dom
,
lambda
x
:
gauss
(
x
,
sigma
))
sm_op
=
ift
.
HarmonicSmoothingOperator
(
dom
,
sigma
)
sm_op
=
ift
.
HarmonicSmoothingOperator
(
dom
,
sigma
)
assert_allclose
(
fco_op
(
sig
).
to_global_data
(),
assert_allclose
(
fco_op
(
sig
).
to_global_data
(),
...
...
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