Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
ba418a60
Unverified
Commit
ba418a60
authored
Oct 03, 2018
by
Gagik Vardanyan
Committed by
GitHub
Oct 03, 2018
Browse files
Merge pull request #23691 from mantidproject/23690_Fix_overwriting_focus_results
Re #23690 Fixed issue with overwriting focus results
parents
0afb8979
8585f8b0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Testing/SystemTests/tests/analysis/reference/ISIS_Powder-GEM83605_FocusSempty.nxs.md5
View file @
ba418a60
7fd06e065b645d51c69c248303f76
26
5
1feccda871823814107a21de6eb9a
26
0
scripts/Diffraction/isis_powder/routines/focus.py
View file @
ba418a60
...
...
@@ -120,9 +120,8 @@ def _divide_one_spectrum_by_spline(spectrum, spline, instrument):
if
instrument
.
get_instrument_prefix
()
==
"GEM"
:
divided
=
mantid
.
Divide
(
LHSWorkspace
=
spectrum
,
RHSWorkspace
=
rebinned_spline
,
OutputWorkspace
=
spectrum
,
StoreInADS
=
False
)
output
=
_crop_spline_to_percent_of_max
(
rebinned_spline
,
divided
)
mantid
.
mtd
[
'output'
]
=
output
return
output
return
_crop_spline_to_percent_of_max
(
rebinned_spline
,
divided
,
spectrum
)
divided
=
mantid
.
Divide
(
LHSWorkspace
=
spectrum
,
RHSWorkspace
=
rebinned_spline
,
OutputWorkspace
=
spectrum
)
return
divided
...
...
@@ -167,7 +166,7 @@ def _test_splined_vanadium_exists(instrument, run_details):
"
\n
Have you run the method to create a Vanadium spline with these settings yet?
\n
"
)
def
_crop_spline_to_percent_of_max
(
spline
,
input_ws
):
def
_crop_spline_to_percent_of_max
(
spline
,
input_ws
,
output_workspace
):
spline_spectrum
=
spline
.
readY
(
0
)
y_val
=
numpy
.
amax
(
spline_spectrum
)
y_val
=
y_val
/
100
...
...
@@ -175,5 +174,5 @@ def _crop_spline_to_percent_of_max(spline, input_ws):
small_spline_indecies
=
numpy
.
nonzero
(
spline_spectrum
>
y_val
)[
0
]
x_max
=
x_list
[
small_spline_indecies
[
-
1
]]
x_min
=
x_list
[
small_spline_indecies
[
0
]]
output
=
mantid
.
CropWorkspace
(
inputWorkspace
=
input_ws
,
XMin
=
x_min
,
XMax
=
x_max
,
StoreInADS
=
Fals
e
)
output
=
mantid
.
CropWorkspace
(
inputWorkspace
=
input_ws
,
XMin
=
x_min
,
XMax
=
x_max
,
OutputWorkspace
=
output_workspac
e
)
return
output
scripts/test/isis_powder/ISISPowderFocusCropTest.py
View file @
ba418a60
...
...
@@ -9,7 +9,7 @@ class ISISPowderFocusCropTest(unittest.TestCase):
x
=
[
0
,
10
,
20
,
30
,
40
,
50
,
60
,
70
,
80
,
90
,
100
]
y
=
[
0
,
0
,
10
,
30
,
2000
,
80
,
50
,
40
,
30
,
25
,
30
]
test_ws
=
mantid
.
CreateWorkspace
(
DataX
=
x
,
DataY
=
y
)
test_ws
=
focus
.
_crop_spline_to_percent_of_max
(
test_ws
,
test_ws
)
test_ws
=
focus
.
_crop_spline_to_percent_of_max
(
test_ws
,
test_ws
,
test_ws
)
y_compare
=
[
30
,
2000
,
80
,
50
,
40
,
30
,
25
,
30
]
result
=
test_ws
.
readY
(
0
)
for
compare
,
val
in
zip
(
y_compare
,
result
):
...
...
@@ -19,7 +19,7 @@ class ISISPowderFocusCropTest(unittest.TestCase):
x
=
[
0
,
10
,
20
,
30
,
40
,
50
,
60
,
70
,
80
,
90
,
100
]
y
=
[
50
,
100
,
300
,
500
,
2000
,
80
,
50
,
0
,
0
,
0
,
0
]
test_ws
=
mantid
.
CreateWorkspace
(
DataX
=
x
,
DataY
=
y
)
test_ws
=
focus
.
_crop_spline_to_percent_of_max
(
test_ws
,
test_ws
)
test_ws
=
focus
.
_crop_spline_to_percent_of_max
(
test_ws
,
test_ws
,
test_ws
)
y_compare
=
[
50
,
100
,
300
,
500
,
2000
,
80
,
50
]
result
=
test_ws
.
readY
(
0
)
for
compare
,
val
in
zip
(
y_compare
,
result
):
...
...
@@ -29,7 +29,7 @@ class ISISPowderFocusCropTest(unittest.TestCase):
x
=
[
0
,
10
,
20
,
30
,
40
,
50
,
60
,
70
,
80
,
90
,
100
]
y
=
[
0
,
0
,
10
,
30
,
2000
,
80
,
50
,
0
,
0
,
0
,
0
]
test_ws
=
mantid
.
CreateWorkspace
(
DataX
=
x
,
DataY
=
y
)
test_ws
=
focus
.
_crop_spline_to_percent_of_max
(
test_ws
,
test_ws
)
test_ws
=
focus
.
_crop_spline_to_percent_of_max
(
test_ws
,
test_ws
,
test_ws
)
y_compare
=
[
30
,
2000
,
80
,
50
]
result
=
test_ws
.
readY
(
0
)
for
compare
,
val
in
zip
(
y_compare
,
result
):
...
...
@@ -39,7 +39,7 @@ class ISISPowderFocusCropTest(unittest.TestCase):
x
=
[
0
,
10
,
20
,
30
,
40
,
50
,
60
,
70
,
80
,
90
,
100
]
y
=
[
1
,
5
,
10
,
30
,
20
,
80
,
50
,
40
,
20
,
10
,
1
]
test_ws
=
mantid
.
CreateWorkspace
(
DataX
=
x
,
DataY
=
y
)
test_ws
=
focus
.
_crop_spline_to_percent_of_max
(
test_ws
,
test_ws
)
test_ws
=
focus
.
_crop_spline_to_percent_of_max
(
test_ws
,
test_ws
,
test_ws
)
y_compare
=
[
1
,
5
,
10
,
30
,
20
,
80
,
50
,
40
,
20
,
10
,
1
]
result
=
test_ws
.
readY
(
0
)
for
compare
,
val
in
zip
(
y_compare
,
result
):
...
...
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