Skip to content
GitLab
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
09506858
Commit
09506858
authored
Sep 23, 2021
by
Martin Reinecke
Browse files
Merge branch 'fixup_assertion_nifty8' into 'NIFTy_8'
Test for domain equality Nifty8 See merge request
!691
parents
5cf30018
80b846e6
Pipeline
#111643
passed with stages
in 31 minutes and 31 seconds
Changes
1
Pipelines
12
Hide whitespace changes
Inline
Side-by-side
src/extra.py
View file @
09506858
...
...
@@ -136,6 +136,8 @@ def check_operator(op, loc, tol=1e-12, ntries=100, perf_check=True,
def
assert_allclose
(
f1
,
f2
,
atol
=
0
,
rtol
=
1e-7
):
if
isinstance
(
f1
,
Field
):
return
np
.
testing
.
assert_allclose
(
f1
.
val
,
f2
.
val
,
atol
=
atol
,
rtol
=
rtol
)
if
f1
.
domain
is
not
f2
.
domain
:
raise
AssertionError
for
key
,
val
in
f1
.
items
():
assert_allclose
(
val
,
f2
[
key
],
atol
=
atol
,
rtol
=
rtol
)
...
...
@@ -143,6 +145,8 @@ def assert_allclose(f1, f2, atol=0, rtol=1e-7):
def
assert_equal
(
f1
,
f2
):
if
isinstance
(
f1
,
Field
):
return
np
.
testing
.
assert_equal
(
f1
.
val
,
f2
.
val
)
if
f1
.
domain
is
not
f2
.
domain
:
raise
AssertionError
for
key
,
val
in
f1
.
items
():
assert_equal
(
val
,
f2
[
key
])
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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