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
4bda0edb
Unverified
Commit
4bda0edb
authored
6 years ago
by
Doucet, Mathieu
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add tolerance to direct beam sorter
parent
05dc169c
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
Framework/PythonInterface/plugins/algorithms/LRDirectBeamSort.py
+16
-6
16 additions, 6 deletions
...rk/PythonInterface/plugins/algorithms/LRDirectBeamSort.py
with
16 additions
and
6 deletions
Framework/PythonInterface/plugins/algorithms/LRDirectBeamSort.py
+
16
−
6
View file @
4bda0edb
...
...
@@ -5,6 +5,9 @@ from mantid.simpleapi import *
from
mantid.kernel
import
*
THI_TOLERANCE
=
0.002
class
CompareTwoNXSDataForSFcalculator
(
object
):
"""
will return -1, 0 or 1 according to the position of the nexusToPosition in relation to the
...
...
@@ -28,7 +31,7 @@ class CompareTwoNXSDataForSFcalculator(object):
self
.
resultComparison
=
compare
return
compare
=
self
.
compareParameter
(
'
thi
'
,
'
descending
'
)
compare
=
self
.
compareParameter
(
'
thi
'
,
'
descending
'
,
tolerance
=
THI_TOLERANCE
)
if
compare
!=
0
:
self
.
resultComparison
=
compare
return
...
...
@@ -43,9 +46,12 @@ class CompareTwoNXSDataForSFcalculator(object):
self
.
resultComparison
=
-
1
if
pcharge1
<
pcharge2
else
1
def
compareParameter
(
self
,
param
,
order
):
def
compareParameter
(
self
,
param
,
order
,
tolerance
=
None
):
"""
Compare parameters for the two runs
:param string param: name of the parameter to compare
:param string order: ascending or descending
:param float tolerance: tolerance to apply to the comparison [optional]
"""
_nexusToCompareWithRun
=
self
.
nexusToCompareWithRun
_nexusToPositionRun
=
self
.
nexusToPositionRun
...
...
@@ -53,6 +59,9 @@ class CompareTwoNXSDataForSFcalculator(object):
_paramNexusToCompareWith
=
float
(
_nexusToCompareWithRun
.
getProperty
(
param
).
value
[
0
])
_paramNexusToPosition
=
float
(
_nexusToPositionRun
.
getProperty
(
param
).
value
[
0
])
if
tolerance
and
abs
(
_paramNexusToPosition
-
_paramNexusToCompareWith
)
<=
tolerance
:
return
0
if
order
==
'
ascending
'
:
resultLessThan
=
-
1
resultMoreThan
=
1
...
...
@@ -156,15 +165,16 @@ class LRDirectBeamSort(PythonAlgorithm):
"""
group_list
=
[]
current_group
=
[]
group_wl
=
None
_current_wl
=
None
_current_thi
=
None
for
r
in
lr_data_sorted
:
wl_
=
r
.
getRun
().
getProperty
(
'
LambdaRequest
'
).
value
[
0
]
thi
=
r
.
getRun
().
getProperty
(
'
thi
'
).
value
[
0
]
wl
=
"
%g%-5.2g
"
%
(
wl_
,
thi
)
if
not
group
_wl
==
wl
:
if
_current_thi
is
None
or
abs
(
thi
-
_current_thi
)
>
THI_TOLERANCE
or
not
_current
_wl
==
wl
_
:
# New group
group_wl
=
wl
_current_wl
=
wl_
_current_thi
=
thi
if
len
(
current_group
)
>
0
:
group_list
.
append
(
current_group
)
current_group
=
[]
...
...
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