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
15
Merge Requests
15
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
2bdb2562
Commit
2bdb2562
authored
Jul 19, 2019
by
Lukas Platz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test
parent
3b36c8a3
Pipeline
#52156
passed with stages
in 7 minutes and 54 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
test/test_operators/test_convolution_operators.py
test/test_operators/test_convolution_operators.py
+41
-0
No files found.
test/test_operators/test_convolution_operators.py
0 → 100644
View file @
2bdb2562
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright(C) 2013-2019 Max-Planck-Society
#
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
from
numpy.testing
import
assert_allclose
,
assert_equal
import
nifty5
as
ift
import
numpy
as
np
def
gauss
(
x
,
sigma
):
normalization
=
np
.
sqrt
(
2.
*
np
.
pi
)
*
sigma
return
np
.
exp
(
-
0.5
*
x
*
x
/
sigma
**
2
)
/
normalization
def
test_rgspace
():
N
=
128
sigma
=
N
/
10
**
4
dom
=
ift
.
RGSpace
(
N
)
sig
=
ift
.
exp
(
ift
.
from_random
(
'normal'
,
dom
))
fco_op
=
ift
.
FuncConvolutionOperator
(
dom
,
lambda
x
:
gauss
(
x
,
sigma
))
sm_op
=
ift
.
HarmonicSmoothingOperator
(
dom
,
sigma
)
assert_allclose
(
fco_op
(
sig
).
to_global_data
(),
sm_op
(
sig
).
to_global_data
(),
rtol
=
1e-05
)
assert_allclose
(
fco_op
.
adjoint_times
(
sig
).
to_global_data
(),
sm_op
.
adjoint_times
(
sig
).
to_global_data
(),
rtol
=
1e-05
)
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