Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dumux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dumux-repositories
dumux
Commits
57ee0633
Commit
57ee0633
authored
7 years ago
by
Timo Koch
Browse files
Options
Downloads
Patches
Plain Diff
[bin][fuzzycompare] Test for NaN and inf
parent
dbc7bb01
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!617
[WIP] Next
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/testing/fuzzycomparevtu.py
+10
-0
10 additions, 0 deletions
bin/testing/fuzzycomparevtu.py
with
10 additions
and
0 deletions
bin/testing/fuzzycomparevtu.py
+
10
−
0
View file @
57ee0633
...
...
@@ -12,6 +12,7 @@ import xml.etree.ElementTree as ET
from
operator
import
attrgetter
,
itemgetter
import
json
import
sys
import
math
from
six.moves
import
range
from
six.moves
import
zip
...
...
@@ -142,6 +143,15 @@ def is_fuzzy_equal_text(text1, text2, parameter, numComp, absolute, relative, ze
floatList1
=
[
float
(
i
)
for
i
in
list1
]
floatList2
=
[
float
(
i
)
for
i
in
list2
]
# check for nan and inf
for
number1
,
number2
in
zip
(
floatList1
,
floatList2
):
if
math
.
isnan
(
number1
)
or
math
.
isnan
(
number2
):
print
(
'
Parameter {} contains NaN!
'
.
format
(
parameter
))
return
False
if
math
.
isinf
(
number1
)
or
math
.
isinf
(
number2
):
print
(
'
Parameter {} contains inf!
'
.
format
(
parameter
))
return
False
# manipulate the data set for the sake of sensible comparison
# if the parameter is listed in the zeroThreshold dictionary replace all float under threshold with zero.
# only replace them with zero if the parameters in both lists are under the threshold. Otherwise we
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment