From b4974f502d9973c6f26d244c5efe31f738f7b8ee Mon Sep 17 00:00:00 2001
From: Harriet Brown <harriet.brown@stfc.ac.uk>
Date: Fri, 6 Dec 2019 13:27:45 +0000
Subject: [PATCH] Remove _merge_workspace_with_limits function

This commit removes the _merge_workspace_with_limits function that had been
previously removed in a different commit, It was accidentally returned to the script
when the branch had to be rebased after a commit message had to be changed to
match the required level of detail and proper formatting regarding the method of
referencing git issues, that being 'Re' followed by hash then the number.

Re #27445
---
 .../polaris_routines/polaris_algs.py          | 45 -------------------
 1 file changed, 45 deletions(-)

diff --git a/scripts/Diffraction/isis_powder/polaris_routines/polaris_algs.py b/scripts/Diffraction/isis_powder/polaris_routines/polaris_algs.py
index 92b60c6fcf7..1d43ba8714e 100644
--- a/scripts/Diffraction/isis_powder/polaris_routines/polaris_algs.py
+++ b/scripts/Diffraction/isis_powder/polaris_routines/polaris_algs.py
@@ -143,51 +143,6 @@ def _obtain_focused_run(run_number, focus_file_path):
     return focused_ws
 
 
-def _merge_workspace_with_limits(focused_ws, q_min, q_max):
-    min_x = np.inf
-    max_x = -np.inf
-    num_x = -np.inf
-    ws_max_range = 0
-    largest_range_spectrum = 0
-    for i in range(focused_ws.size()):
-        x_data = focused_ws[i].dataX(0)
-        min_x = min(np.min(x_data), min_x)
-        max_x = max(np.max(x_data), max_x)
-        num_x = max(x_data.size, num_x)
-        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
-    if min_x == -np.inf or max_x == np.inf:
-        raise AttributeError("Workspace x range contains an infinite value.")
-    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)
-
-    bin_width = np.inf
-    for i in range(q_min.size):
-        pdf_x_array = focused_ws_conjoined.readX(i)
-        tmp1 = np.where(pdf_x_array >= q_min[i])
-        tmp2 = np.amin(tmp1)
-        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)
-    if min_x == -np.inf or max_x == np.inf:
-        raise AttributeError("Q lims contains an infinite value.")
-    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)])
-    focused_data_combined = mantid.SumSpectra(InputWorkspace=focused_data_combined,
-                                              WeightedSum=True,
-                                              MultiplyBySpectra=False)
-    common.remove_intermediate_workspace(focused_ws_conjoined)
-    return focused_data_combined
-
-
 def _load_qlims(q_lims):
     if type(q_lims) == str or type(q_lims) == unicode:
         q_min = []
-- 
GitLab