Skip to content
Snippets Groups Projects
Commit 31bbc729 authored by Harriet Brown's avatar Harriet Brown
Browse files

Fix ws_max_range not updated when a longer ws range was found

This commit fixes missed line that would allow the index for the max range spectra
to be updated

Re #27444
parent ca1a3cf6
No related branches found
No related tags found
No related merge requests found
......@@ -149,12 +149,14 @@ def _merge_workspace_with_limits(focused_ws, q_lims):
ws_range = np.max(x_data)-np.min(x_data)
if ws_range > ws_max_range:
largest_range_spectrum = i + 1
ws_max_range = ws_range
focused_ws = mantid.Rebin(InputWorkspace=focused_ws, Params=[min_x, (max_x-min_x)/num_x, max_x])
while focused_ws.size() > 1:
mantid.ConjoinWorkspaces(InputWorkspace1=focused_ws[0],
InputWorkspace2=focused_ws[1])
focused_ws_conjoined = focused_ws[0]
mantid.MatchSpectra(InputWorkspace=focused_ws_conjoined, OutputWorkspace=focused_ws_conjoined,
ReferenceSpectrum=largest_range_spectrum)
q_min, q_max = _load_qlims(q_lims)
bin_width = np.inf
......@@ -165,8 +167,6 @@ def _merge_workspace_with_limits(focused_ws, q_lims):
q_min[i] = pdf_x_array[tmp2]
q_max[i] = pdf_x_array[np.amax(np.where(pdf_x_array <= q_max[i]))]
bin_width = min(pdf_x_array[1] - pdf_x_array[0], bin_width)
mantid.MatchSpectra(InputWorkspace=focused_ws_conjoined, OutputWorkspace=focused_ws_conjoined,
ReferenceSpectrum=largest_range_spectrum)
focused_data_combined = mantid.CropWorkspaceRagged(InputWorkspace=focused_ws_conjoined, XMin=q_min, XMax=q_max)
focused_data_combined = mantid.Rebin(InputWorkspace=focused_data_combined,
Params=[min(q_min), bin_width, max(q_max)])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment