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
51b5d33d
Commit
51b5d33d
authored
9 years ago
by
Doucet, Mathieu
Browse files
Options
Downloads
Patches
Plain Diff
Re #11096 Backward compatibility issue
parent
f3eed89f
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
Code/Mantid/Framework/PythonInterface/plugins/algorithms/LiquidsReflectometryReduction.py
+22
-3
22 additions, 3 deletions
...rface/plugins/algorithms/LiquidsReflectometryReduction.py
with
22 additions
and
3 deletions
Code/Mantid/Framework/PythonInterface/plugins/algorithms/LiquidsReflectometryReduction.py
+
22
−
3
View file @
51b5d33d
...
...
@@ -146,6 +146,7 @@ class LiquidsReflectometryReduction(PythonAlgorithm):
normalized_data
=
data_cropped
/
norm_summed
# Avoid leaving trash behind
AnalysisDataService
.
remove
(
str
(
data_cropped
))
AnalysisDataService
.
remove
(
str
(
norm_cropped
))
AnalysisDataService
.
remove
(
str
(
norm_summed
))
normalized_data
=
ConvertToPointData
(
InputWorkspace
=
normalized_data
,
...
...
@@ -234,6 +235,11 @@ class LiquidsReflectometryReduction(PythonAlgorithm):
#TODO: remove this, which we use during development to make sure we don't leave trash
logger
.
information
(
str
(
AnalysisDataService
.
getObjectNames
()))
# Avoid leaving trash behind
for
ws
in
[
'
ws_event_data
'
,
'
normalized_data
'
,
'
q_workspace
'
]:
if
AnalysisDataService
.
doesExist
(
ws
):
AnalysisDataService
.
remove
(
ws
)
self
.
setProperty
(
'
OutputWorkspace
'
,
mtd
[
name_output_ws
])
...
...
@@ -478,7 +484,6 @@ class LiquidsReflectometryReduction(PythonAlgorithm):
def
_value_check
(
key
,
data
,
reference
):
"""
Check an entry against a reference value
#TODO: get rid of sfCalculator reference
"""
if
key
in
data
:
return
abs
(
abs
(
float
(
data
[
key
]))
-
abs
(
float
(
reference
)))
<=
self
.
TOLERANCE
...
...
@@ -496,12 +501,26 @@ class LiquidsReflectometryReduction(PythonAlgorithm):
# Parse the line of data and produce a dict
toks
=
line
.
split
()
data_dict
=
reduce
(
_reduce
,
toks
,
{})
# Get ordered list of keys
keys
=
[]
for
token
in
toks
:
key_value
=
token
.
split
(
'
=
'
)
if
len
(
key_value
)
==
2
:
keys
.
append
(
key_value
[
0
].
strip
())
# Sanity check
if
keys
[
0
]
!=
'
IncidentMedium
'
and
keys
[
1
]
!=
'
LambdaRequested
'
\
and
keys
[
2
]
!=
'
S1H
'
:
logger
.
error
(
"
The scaling factor file isn
'
t standard: bad keywords
"
)
# The S2H key has been changing in the earlier version of REFL reduction.
# Get the key from the data to make sure we are backward compatible.
s2h_key
=
keys
[
3
]
if
'
IncidentMedium
'
in
data_dict
\
and
data_dict
[
'
IncidentMedium
'
]
==
incident_medium
.
strip
()
\
and
_value_check
(
'
LambdaRequested
'
,
data_dict
,
lr_value
)
\
and
_value_check
(
'
S1H
'
,
data_dict
,
s1h
)
\
and
_value_check
(
'
S2H
'
,
data_dict
,
s2h
):
and
_value_check
(
s2h_key
,
data_dict
,
s2h
):
if
not
match_slit_width
or
(
_value_check
(
'
S1W
'
,
data_dict
,
s1w
)
\
and
_value_check
(
'
S2W
'
,
data_dict
,
s2w
)):
...
...
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