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
b84c1829
Commit
b84c1829
authored
Jun 21, 2018
by
Martin Reinecke
Browse files
improve energy tests
parent
9b6f6ff8
Pipeline
#31516
failed with stages
in 5 minutes and 32 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty5/extra/energy_tests.py
View file @
b84c1829
...
...
@@ -54,7 +54,9 @@ def check_value_gradient_consistency(E, tol=1e-6, ntries=100):
for
i
in
range
(
50
):
Emid
=
E
.
at
(
E
.
position
+
0.5
*
dir
)
dirder
=
Emid
.
gradient
.
vdot
(
dir
)
/
dirnorm
if
abs
((
E2
.
value
-
val
)
/
dirnorm
-
dirder
)
<
tol
:
t1
=
(
E2
.
value
-
val
)
/
dirnorm
xtol
=
tol
*
max
(
abs
(
t1
),
abs
(
dirder
))
if
abs
(
t1
-
dirder
)
<
xtol
:
break
dir
*=
0.5
dirnorm
*=
0.5
...
...
test/test_energies/test_map.py
View file @
b84c1829
...
...
@@ -61,7 +61,7 @@ class Energy_Tests(unittest.TestCase):
energy
=
ift
.
library
.
WienerFilterEnergy
(
position
=
s0
,
d
=
d
,
R
=
R
,
N
=
N
,
S
=
S
,
iteration_controller
=
IC
)
ift
.
extra
.
check_value_gradient_curvature_consistency
(
energy
,
tol
=
1e-
4
,
ntries
=
10
)
energy
,
tol
=
1e-
6
,
ntries
=
10
)
@
expand
(
product
([
ift
.
GLSpace
(
15
),
ift
.
RGSpace
(
64
,
distances
=
.
789
),
...
...
@@ -95,7 +95,7 @@ class Energy_Tests(unittest.TestCase):
N
=
N
,
S
=
S
)
if
isinstance
(
nonlinearity
,
ift
.
library
.
Linear
):
ift
.
extra
.
check_value_gradient_curvature_consistency
(
energy
,
tol
=
1e-
4
,
ntries
=
10
)
energy
,
tol
=
1e-
6
,
ntries
=
10
)
else
:
ift
.
extra
.
check_value_gradient_consistency
(
energy
,
tol
=
1e-
4
,
ntries
=
10
)
energy
,
tol
=
1e-
6
,
ntries
=
10
)
test/test_energies/test_power.py
View file @
b84c1829
...
...
@@ -81,4 +81,4 @@ class Energy_Tests(unittest.TestCase):
ht
=
ht
,
N
=
N
,
samples
=
10
)
ift
.
extra
.
check_value_gradient_consistency
(
energy
,
tol
=
1e-
5
,
ntries
=
10
)
ift
.
extra
.
check_value_gradient_consistency
(
energy
,
tol
=
1e-
6
,
ntries
=
10
)
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