Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review 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
mantidproject
mantid
Commits
41278540
Commit
41278540
authored
6 years ago
by
Sam Jenkins
Browse files
Options
Downloads
Patches
Plain Diff
Re #24512 attempted using compare method fron EnggCalibrationTest.py
parent
1b3a1458
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Testing/SystemTests/tests/analysis/EnginXScriptTest.py
+31
-6
31 additions, 6 deletions
Testing/SystemTests/tests/analysis/EnginXScriptTest.py
with
31 additions
and
6 deletions
Testing/SystemTests/tests/analysis/EnginXScriptTest.py
+
31
−
6
View file @
41278540
...
...
@@ -20,8 +20,8 @@ ref_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(DIRS[0]))
root_directory
=
os
.
path
.
join
(
DIRS
[
0
],
"
ENGINX
"
)
cal_directory
=
os
.
path
.
join
(
root_directory
,
"
cal
"
)
focus_directory
=
os
.
path
.
join
(
root_directory
,
"
focus
"
)
param_deltas
=
[
0
,
50
,
0
,
2
0
]
cal_deltas
=
[
0
,
2
,
20
,
1
0
,
1
0
,
50
,
5e3
,
10
,
1e6
,
1
,
2
00
,
50
,
5e2
,
5
,
20
,
2
]
param_deltas
=
[
0
.1
,
0.1
,
1
,
2
]
cal_deltas
=
[
0
.1
,
90000
,
0.8
,
5200
0
,
1
,
0.1
,
4
,
3
,
250
,
9
,
8
00
,
1.5
,
10
,
0.5
,
5
,
0.5
]
class
CreateVanadiumTest
(
systemtesting
.
MantidSystemTest
):
...
...
@@ -187,10 +187,9 @@ def _compare_tableworkspaces(workspace, ref_file, delta):
if
passed
:
for
i
in
range
(
ws
.
columnCount
()):
newcolumn
=
[
abs
(
a
-
b
)
for
a
,
b
in
zip
(
loaded
.
column
(
i
),
ws
.
column
(
i
))]
max_diff
=
max
(
newcolumn
)
mantid
.
kernel
.
logger
.
information
(
"
maximum difference =
"
+
str
(
max_diff
)
+
"
\n
delta =
"
+
str
(
delta
[
i
]))
if
not
(
max_diff
<=
delta
[
i
]):
newcolumn
=
[
rel_err_less_delta
(
a
,
b
,
delta
[
i
])
for
a
,
b
in
zip
(
loaded
.
column
(
i
),
ws
.
column
(
i
))]
mantid
.
kernel
.
logger
.
warning
(
"
newcolumn = {}
"
.
format
(
all
(
newcolumn
)))
if
not
all
(
newcolumn
):
passed
=
False
mantid
.
kernel
.
logger
.
warning
(
"
data in:
"
+
workspace
+
"
and
"
+
ref_file
+
"
did not match
"
)
...
...
@@ -199,3 +198,29 @@ def _compare_tableworkspaces(workspace, ref_file, delta):
passed
=
False
return
passed
# borrowed from EnggCalibrationTest
def
rel_err_less_delta
(
val
,
ref
,
epsilon
):
"""
Checks that a value
'
val
'
does not differ from a reference value
'
ref
'
by
'
epsilon
'
or more. This method compares the relative error. An epsilon of 0.1 means a relative
difference of 10 % = 100*0.1 %
@param val :: value obtained from a calculation or algorithm
@param ref :: (expected) reference value
@param epsilon :: acceptable relative error (error tolerance)
@returns if val differs in relative terms from ref by less than epsilon
"""
if
0
==
ref
:
return
abs
(
ref
-
val
)
<
epsilon
check
=
(
abs
((
ref
-
val
)
/
ref
)
<
epsilon
)
mantid
.
kernel
.
logger
.
warning
(
"
check value = {}
"
.
format
((
abs
((
ref
-
val
)
/
ref
))))
mantid
.
kernel
.
logger
.
warning
(
"
ref = {}
"
.
format
(
epsilon
))
if
not
check
:
mantid
.
kernel
.
logger
.
warning
(
"
Value
'
{0}
'
differs from reference
'
{1}
'
by more than required epsilon
'
{2}
'
"
"
(relative)
"
.
format
(
val
,
ref
,
epsilon
))
return
check
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