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
6b2b4adb
Commit
6b2b4adb
authored
Mar 24, 2021
by
Philipp Arras
Browse files
Add test
parent
4fd8c4e8
Pipeline
#96736
passed with stages
in 11 minutes and 52 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
test/test_operators/test_ptw_pre.py
0 → 100644
View file @
6b2b4adb
# 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) 2021 Max-Planck-Society
#
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
import
pytest
import
nifty7
as
ift
from
..common
import
setup_function
,
teardown_function
pmp
=
pytest
.
mark
.
parametrize
@
pmp
(
'f'
,
[
'log'
,
'exp'
,
'sqrt'
,
'sin'
,
'cos'
,
'tan'
,
'sinc'
,
'sinh'
,
'cosh'
,
'tanh'
,
'absolute'
,
'reciprocal'
,
'sigmoid'
,
'log10'
,
'log1p'
,
'expm1'
,
'softplus'
,
(
'power'
,
2.
),
(
'exponentiate'
,
1.1
)
])
def
test_ptw_pre
(
f
):
if
not
isinstance
(
f
,
tuple
):
f
=
(
f
,)
op
=
ift
.
FFTOperator
(
ift
.
RGSpace
(
10
))
op0
=
op
@
ift
.
ScalingOperator
(
op
.
domain
,
1.
).
ptw
(
*
f
)
op1
=
op
.
ptw_pre
(
*
f
)
pos
=
ift
.
from_random
(
op0
.
domain
)
if
f
[
0
]
in
[
'log'
,
'sqrt'
,
'log10'
,
'log1p'
]:
pos
=
pos
.
exp
()
ift
.
extra
.
assert_equal
(
op0
(
pos
),
op1
(
pos
))
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