diff --git a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/Stitch1D.py b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/Stitch1D.py index 6b0a4887227e16600af023cd0c583cf2288d6eee..d7a2c3beaf1d1d10e6665f3a5b05948a3b5eefa2 100644 --- a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/Stitch1D.py +++ b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/Stitch1D.py @@ -41,6 +41,34 @@ class Stitch1D(PythonAlgorithm): count = len(errors.nonzero()[0]) return count > 0 + + def __run_as_child(self, name, **kwargs): + """Run a named algorithm and return the + algorithm handle + + Parameters: + name - The name of the algorithm + kwargs - A dictionary of property name:value pairs + """ + alg = AlgorithmManager.createUnmanaged(name) + alg.initialize() + alg.setChild(True) + + if 'OutputWorkspace' in alg: + alg.setPropertyValue("OutputWorkspace","UNUSED_NAME_FOR_CHILD") + + alg.setRethrows(True) + for key, value in kwargs.iteritems(): + alg.setProperty(key, value) + + alg.execute() + return alg.getProperty("OutputWorkspace").value + + def __to_single_value_ws(self, value): + value_ws = self.__run_as_child("CreateSingleValuedWorkspace", DataValue=value) + return value_ws + + def __find_indexes_start_end(self, startOverlap, endOverlap, workspace): a1=workspace.binIndexOf(startOverlap) a2=workspace.binIndexOf(endOverlap) @@ -104,8 +132,8 @@ class Stitch1D(PythonAlgorithm): params = self.__create_rebin_parameters() print params - lhs_rebinned = Rebin(InputWorkspace=self.getProperty("LHSWorkspace").value, Params=params) - rhs_rebinned = Rebin(InputWorkspace=self.getProperty("RHSWorkspace").value, Params=params) + lhs_rebinned = self.__run_as_child("Rebin", InputWorkspace=self.getProperty("LHSWorkspace").value, Params=params) + rhs_rebinned = self.__run_as_child("Rebin", InputWorkspace=self.getProperty("RHSWorkspace").value, Params=params) xRange = lhs_rebinned.readX(0) minX = xRange[0] @@ -121,56 +149,58 @@ class Stitch1D(PythonAlgorithm): a1, a2 = self.__find_indexes_start_end(startOverlap, endOverlap, lhs_rebinned) if not useManualScaleFactor: - lhsOverlapIntegrated = Integration(InputWorkspace=lhs_rebinned, RangeLower=startOverlap, RangeUpper=endOverlap) - rhsOverlapIntegrated = Integration(InputWorkspace=rhs_rebinned, RangeLower=startOverlap, RangeUpper=endOverlap) + + lhsOverlapIntegrated = self.__run_as_child("Integration", InputWorkspace=lhs_rebinned, RangeLower=startOverlap, RangeUpper=endOverlap) + rhsOverlapIntegrated = self.__run_as_child("Integration", InputWorkspace=rhs_rebinned, RangeLower=startOverlap, RangeUpper=endOverlap) + y1=lhsOverlapIntegrated.readY(0) y2=rhsOverlapIntegrated.readY(0) if scaleRHSWorkspace: - rhs_rebinned *= (lhsOverlapIntegrated/rhsOverlapIntegrated) + ratio = self.__run_as_child("Divide", LHSWorkspace=lhsOverlapIntegrated, RHSWorkspace=rhsOverlapIntegrated) + rhs_rebinned = self.__run_as_child("Multiply", LHSWorkspace=rhs_rebinned, RHSWorkspace=ratio) scalefactor = y1[0]/y2[0] else: - lhs_rebinned *= (rhsOverlapIntegrated/lhsOverlapIntegrated) + + ratio = self.__run_as_child("Divide", RHSWorkspace=lhsOverlapIntegrated, LHSWorkspace=rhsOverlapIntegrated) + lhs_rebinned = self.__run_as_child("Multiply", LHSWorkspace=lhs_rebinned, RHSWorkspace=ratio) scalefactor = y2[0]/y1[0] - DeleteWorkspace(lhsOverlapIntegrated) - DeleteWorkspace(rhsOverlapIntegrated) else: + manualScaleFactorWS = self.__to_single_value_ws(manualScaleFactor) if scaleRHSWorkspace: - rhs_rebinned *= manualScaleFactor + rhs_rebinned = self.__run_as_child("Multiply", LHSWorkspace=rhs_rebinned, RHSWorkspace=manualScaleFactorWS) else: - lhs_rebinned *= manualScaleFactor + lhs_rebinned = self.__run_as_child("Multiply", LHSWorkspace=lhs_rebinned, RHSWorkspace=manualScaleFactorWS) scalefactor = manualScaleFactor # Mask out everything BUT the overlap region as a new workspace. - overlap1 = MultiplyRange(InputWorkspace=lhs_rebinned, StartBin=0,EndBin=a1,Factor=0) - overlap1 = MultiplyRange(InputWorkspace=overlap1,StartBin=a2,Factor=0) - + overlap1 = self.__run_as_child("MultiplyRange", InputWorkspace=lhs_rebinned, StartBin=0,EndBin=a1,Factor=0) + overlap1 = self.__run_as_child("MultiplyRange", InputWorkspace=overlap1,StartBin=a2,Factor=0) + # Mask out everything BUT the overlap region as a new workspace. - overlap2 = MultiplyRange(InputWorkspace=rhs_rebinned,StartBin=0,EndBin=a1,Factor=0)#-1 - overlap2 = MultiplyRange(InputWorkspace=overlap2,StartBin=a2,Factor=0) + overlap2 = self.__run_as_child("MultiplyRange", InputWorkspace=rhs_rebinned,StartBin=0,EndBin=a1,Factor=0) + overlap2 = self.__run_as_child("MultiplyRange", InputWorkspace=overlap2,StartBin=a2,Factor=0) # Mask out everything AFTER the start of the overlap region - lhs_rebinned=MultiplyRange(InputWorkspace=lhs_rebinned, StartBin=a1+1, Factor=0) + lhs_rebinned = self.__run_as_child("MultiplyRange", InputWorkspace=lhs_rebinned, StartBin=a1+1, Factor=0) + # Mask out everything BEFORE the end of the overlap region - rhs_rebinned=MultiplyRange(InputWorkspace=rhs_rebinned,StartBin=0,EndBin=a2-1,Factor=0) + rhs_rebinned = self.__run_as_child("MultiplyRange",InputWorkspace=rhs_rebinned,StartBin=0,EndBin=a2-1,Factor=0) # Calculate a weighted mean for the overlap region overlapave = None if self.has_non_zero_errors(overlap1) and self.has_non_zero_errors(overlap2): - overlapave = WeightedMean(InputWorkspace1=overlap1,InputWorkspace2=overlap2) + overlapave = self.__run_as_child("WeightedMean", InputWorkspace1=overlap1,InputWorkspace2=overlap2) else: self.log().information("Using un-weighted mean for Stitch1D overlap mean") - overlapave = (overlap1 + overlap2)/2 + # Calculate the mean. + sum = self.__run_as_child("Plus", LHSWorkspace=overlap1, RHSWorkspace=overlap2) + denominator = self.__to_single_value_ws(2.0) + overlapave = self.__run_as_child("Divide", LHSWorkspace=sum, RHSWorkspace=denominator) # Add the Three masked workspaces together to create a complete x-range - result = lhs_rebinned + overlapave + rhs_rebinned - RenameWorkspace(InputWorkspace=result, OutputWorkspace=self.getPropertyValue("OutputWorkspace")) - - # Cleanup - DeleteWorkspace(lhs_rebinned) - DeleteWorkspace(rhs_rebinned) - DeleteWorkspace(overlap1) - DeleteWorkspace(overlap2) - DeleteWorkspace(overlapave) + result = self.__run_as_child("Plus", LHSWorkspace=lhs_rebinned, RHSWorkspace=overlapave) + result = self.__run_as_child("Plus", LHSWorkspace=rhs_rebinned, RHSWorkspace=result) + #RenameWorkspace(InputWorkspace=result, OutputWorkspace=self.getPropertyValue("OutputWorkspace")) self.setProperty('OutputWorkspace', result) self.setProperty('OutScaleFactor', scalefactor) diff --git a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/Stitch1DMany.py b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/Stitch1DMany.py index 1e4244aaa2d6f1316faeec5a86788f46b46605af..4c2d466c383b2cacaff83437ca96202463afc669 100644 --- a/Code/Mantid/Framework/PythonInterface/plugins/algorithms/Stitch1DMany.py +++ b/Code/Mantid/Framework/PythonInterface/plugins/algorithms/Stitch1DMany.py @@ -21,25 +21,31 @@ class Stitch1DMany(PythonAlgorithm): return "Reflectometry\\ISIS;PythonAlgorithms" def name(self): - return "Stitch1D" + return "Stitch1D" def PyInit(self): input_validator = StringMandatoryValidator() self.declareProperty(name="InputWorkspaces", defaultValue="", direction=Direction.Input, validator=input_validator, doc="Input workspaces") - self.declareProperty(MatrixWorkspaceProperty("OutputWorkspace", "", Direction.Output), "Output stitched workspace") + self.declareProperty(WorkspaceProperty("OutputWorkspace", "", Direction.Output), "Output stitched workspace") self.declareProperty(FloatArrayProperty(name="StartOverlaps", values=[]), doc="Overlap in Q.") self.declareProperty(FloatArrayProperty(name="EndOverlaps", values=[]), doc="End overlap in Q.") - self.declareProperty(FloatArrayProperty(name="Params", values=[0.1]), doc="Rebinning Parameters. See Rebin for format.") + self.declareProperty(FloatArrayProperty(name="Params", validator=FloatArrayMandatoryValidator()), doc="Rebinning Parameters. See Rebin for format.") self.declareProperty(name="ScaleRHSWorkspace", defaultValue=True, doc="Scaling either with respect to workspace 1 or workspace 2.") self.declareProperty(name="UseManualScaleFactor", defaultValue=False, doc="True to use a provided value for the scale factor.") self.declareProperty(name="ManualScaleFactor", defaultValue=1.0, doc="Provided value for the scale factor.") self.declareProperty(name="OutScaleFactor", defaultValue=-2.0, direction = Direction.Output, doc="The actual used value for the scaling factor.") def __workspace_from_split_name(self, list_of_names, index): - return mtd[list_of_names[index].strip()] + return mtd[list_of_names[index].strip()] + + def __workspaces_from_split_name(self, list_of_names): + workspaces = list() + for name in list_of_names: + workspaces.append(mtd[name.strip()]) + return workspaces ''' If the property value has been provided, use that. If default, then create an array of Nones so that Stitch1D can still be correctly looped over. @@ -53,7 +59,47 @@ class Stitch1DMany(PythonAlgorithm): property_value.append(None) return property_value - + + def __do_stitch_workspace(self, lhs_ws, rhs_ws, start_overlap, end_overlap, params, scale_rhs_ws, use_manual_scale_factor, manual_scale_factor): + out_name = lhs_ws.name() + rhs_ws.name() + + alg = self.createChildAlgorithm("Stitch1D") + alg.initialize() + alg.setProperty("LHSWorkspace", lhs_ws) + alg.setProperty("RHSWorkspace", rhs_ws) + if start_overlap: + alg.setProperty("StartOverlap", start_overlap) + if end_overlap: + alg.setProperty("EndOverlap", end_overlap) + alg.setProperty("Params", params) + alg.setProperty("ScaleRHSWorkspace", scale_rhs_ws) + alg.setProperty("UseManualScaleFactor", use_manual_scale_factor) + if manual_scale_factor: + alg.setProperty("ManualScaleFactor", manual_scale_factor) + alg.setProperty("OutputWorkspace", "from_sub_alg" + out_name) + alg.execute() + out_ws = alg.getProperty("OutputWorkspace").value + scale_factor = alg.getProperty("OutScaleFactor").value + + + #out_ws, scale_factor = Stitch1D(LHSWorkspace=lhs_ws, RHSWorkspace=rhs_ws, StartOverlap=start_overlap, EndOverlap=end_overlap, + # Params=params, ScaleRHSWorkspace=scale_rhs_ws, UseManualScaleFactor=use_manual_scale_factor, ManualScaleFactor=manual_scale_factor, OutputWorkspace=out_name) + return (out_ws, scale_factor) + + def __check_workspaces_are_common(self, input_workspace_names): + workspaces = self.__workspaces_from_split_name(input_workspace_names) + exemplar = workspaces[0] + for i in range(1, len(workspaces)): + test_ws = workspaces[i] + if type(exemplar) != type(test_ws): + raise RuntimeError("Input Workspaces must all be of the same type.") + if isinstance(test_ws, WorkspaceGroup): + if test_ws.size() != exemplar.size(): + raise RuntimeError("Group Workspaces as InputWorkspaces must have the same number of sub-workspaces.") + + def __are_processing_groups(self, input_workspace_names): + test_ws = self.__workspace_from_split_name(input_workspace_names, 0) + return isinstance(test_ws, WorkspaceGroup) def PyExec(self): @@ -77,25 +123,64 @@ class Stitch1DMany(PythonAlgorithm): raise ValueError("StartOverlaps and EndOverlaps are different lengths") if not (len(startOverlaps) == (numberOfWorkspaces- 1)): raise ValueError("Wrong number of StartOverlaps, should be %i not %i" % (numberOfWorkspaces - 1, startOverlaps)) + self.__check_workspaces_are_common(inputWorkspaces) scaleFactor = None + comma_separator = "," + no_separator = str() - # Iterate forward through the workspaces - if scaleRHSWorkspace: - lhsWS = self.__workspace_from_split_name(inputWorkspaces, 0) - for i in range(1, numberOfWorkspaces, 1): - rhsWS = self.__workspace_from_split_name(inputWorkspaces, i) - lhsWS, scaleFactor = Stitch1D(LHSWorkspace=lhsWS, RHSWorkspace=rhsWS, StartOverlap=startOverlaps[i-1], EndOverlap=endOverlaps[i-1], Params=params, ScaleRHSWorkspace=scaleRHSWorkspace, UseManualScaleFactor=useManualScaleFactor, ManualScaleFactor=manualScaleFactor) - self.setProperty('OutputWorkspace', lhsWS) - DeleteWorkspace(lhsWS) - # Iterate backwards through the workspaces. + # Identify and process as group workspaces + if self.__are_processing_groups(inputWorkspaces): + workspace_groups = self.__workspaces_from_split_name(inputWorkspaces) + + out_group_separator = no_separator + out_group_workspaces = str() + + n_sub_workspaces = workspace_groups[0].size() + for i in range(n_sub_workspaces): + + to_process = str() + out_name = str() + separator = no_separator + + for j in range(0, numberOfWorkspaces, 1): + + to_process += separator + workspace_groups[j][i].name() + out_name += workspace_groups[j][i].name() + separator=comma_separator + + startOverlaps = self.getProperty("StartOverlaps").value + endOverlaps = self.getProperty("EndOverlaps").value + + stitched, scaleFactor = Stitch1DMany(InputWorkspaces=to_process, OutputWorkspace=out_name, StartOverlaps=startOverlaps, EndOverlaps=endOverlaps, + Params=params, ScaleRHSWorkspace=scaleRHSWorkspace, UseManualScaleFactor=useManualScaleFactor, + ManualScaleFactor=manualScaleFactor) + + out_group_workspaces += out_group_separator + out_name + out_group_separator = comma_separator + + out_workspace_name = self.getPropertyValue("OutputWorkspace") + out_group = GroupWorkspaces(InputWorkspaces=out_group_workspaces, OutputWorkspace=out_workspace_name) + self.setProperty("OutputWorkspace", out_group) + else: - rhsWS = self.__workspace_from_split_name(inputWorkspaces, -1) - for i in range(0, numberOfWorkspaces-1, 1): - lhsWS = self.__workspace_from_split_name(inputWorkspaces, i) - rhsWS, scaleFactor = Stitch1D(LHSWorkspace=lhsWS, RHSWorkspace=rhsWS, StartOverlap=startOverlaps[i-1], EndOverlap=endOverlaps[i-1], Params=params, ScaleRHSWorkspace=scaleRHSWorkspace, UseManualScaleFactor=useManualScaleFactor, ManualScaleFactor=manualScaleFactor) - self.setProperty('OutputWorkspace', rhsWS) - DeleteWorkspace(rhsWS) + + # Iterate forward through the workspaces + if scaleRHSWorkspace: + lhsWS = self.__workspace_from_split_name(inputWorkspaces, 0) + + for i in range(1, numberOfWorkspaces, 1): + rhsWS = self.__workspace_from_split_name(inputWorkspaces, i) + lhsWS, scaleFactor = self.__do_stitch_workspace(lhsWS, rhsWS, startOverlaps[i-1], endOverlaps[i-1], params, scaleRHSWorkspace, useManualScaleFactor, manualScaleFactor) + self.setProperty('OutputWorkspace', lhsWS) + + # Iterate backwards through the workspaces. + else: + rhsWS = self.__workspace_from_split_name(inputWorkspaces, -1) + for i in range(0, numberOfWorkspaces-1, 1): + lhsWS = self.__workspace_from_split_name(inputWorkspaces, i) + rhsWS, scaleFactor = Stitch1D(LHSWorkspace=lhsWS, RHSWorkspace=rhsWS, StartOverlap=startOverlaps[i-1], EndOverlap=endOverlaps[i-1], Params=params, ScaleRHSWorkspace=scaleRHSWorkspace, UseManualScaleFactor=useManualScaleFactor, ManualScaleFactor=manualScaleFactor) + self.setProperty('OutputWorkspace', rhsWS) self.setProperty('OutScaleFactor', scaleFactor) return None diff --git a/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/Stitch1DManyTest.py b/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/Stitch1DManyTest.py index 1356582fcc9af198303a3599803652a42e616bb3..d76ebabd375ca4931a4d4a5c5d1aa138aee46070 100644 --- a/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/Stitch1DManyTest.py +++ b/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/Stitch1DManyTest.py @@ -58,7 +58,39 @@ class Stitch1DManyTest(unittest.TestCase): self.fail("Two end overlaps, but only two workspaces. Should have thrown.") except RuntimeError: pass + + def test_stich_throws_if_no_params(self): + try: + stitched = Stitch1DMany(InputWorkspaces='a, b') + self.fail("No Params given. Should have thrown.") + except RuntimeError: + pass + def test_workspace_types_differ_throws(self): + tbl = CreateEmptyTableWorkspace() + input_workspaces = "%s, %s" % (self.a.name(), tbl.name()) # One table workspace, one matrix workspace + try: + stitchedViaStitchMany, scaleFactorMany = Stitch1DMany(InputWorkspaces=input_workspaces, Params=0.2) + self.fail("Input workspace type mis-match. Should have thrown.") + except RuntimeError: + pass + finally: + DeleteWorkspace(tbl) + + def test_workspace_group_size_differ_throws(self): + ws1 = CreateWorkspace(UnitX="1/q", DataX=self.x, DataY=[3.0, 3.0, 3.0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], NSpec=1, DataE=self.e) + ws2 = CreateWorkspace(UnitX="1/q", DataX=self.x, DataY=[0.0, 0.0, 0.0, 2.0, 2.0, 2.0, 2.0, 0.0, 0.0, 0.0], NSpec=1, DataE=self.e) + ws3 = CreateWorkspace(UnitX="1/q", DataX=self.x, DataY=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0], NSpec=1, DataE=self.e) + input_group_1 = GroupWorkspaces(InputWorkspaces="%s,%s, %s" % (ws1.name(), ws2.name(), ws3.name())) + input_group_2 = GroupWorkspaces(InputWorkspaces="%s,%s" % (ws1.name(), ws2.name())) + try: + stitched, sf = Stitch1DMany(InputWorkspaces='%s,%s' % (input_group_1.name(), input_group_2.name()), Params=0.2) + self.fail("Differing number of sub-workspaces in workspace group. Should have thrown.") + except RuntimeError: + pass + finally: + DeleteWorkspace(input_group_1) + #Cross-check that the result of using Stitch1DMany with two workspaces is the same as using Stitch1D. def test_stitches_two(self): @@ -105,6 +137,19 @@ class Stitch1DManyTest(unittest.TestCase): self.assertEquals(2.0, round(sf, 6)) DeleteWorkspace(stitchedViaStitchMany) + def test_process_group_workspaces(self): + ws1 = CreateWorkspace(UnitX="1/q", DataX=self.x, DataY=[3.0, 3.0, 3.0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], NSpec=1, DataE=self.e) + ws2 = CreateWorkspace(UnitX="1/q", DataX=self.x, DataY=[0.0, 0.0, 0.0, 2.0, 2.0, 2.0, 2.0, 0.0, 0.0, 0.0], NSpec=1, DataE=self.e) + ws3 = CreateWorkspace(UnitX="1/q", DataX=self.x, DataY=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0], NSpec=1, DataE=self.e) + input_group_1 = GroupWorkspaces(InputWorkspaces="%s,%s,%s" % (ws1.name(), ws2.name(), ws3.name())) + input_group_2 = GroupWorkspaces(InputWorkspaces="%s,%s,%s" % (ws1.name(), ws2.name(), ws3.name())) + stitched, sf = Stitch1DMany(InputWorkspaces='%s,%s' % (input_group_1.name(), input_group_2.name()), Params=0.2) + self.assertTrue(isinstance(stitched, WorkspaceGroup), "Output should be a group workspace") + self.assertEqual(stitched.size(), 3, "Output should contain 3 workspaces") + self.assertEqual(stitched.name(), "stitched", "Output not named correctly") + DeleteWorkspace(input_group_1) + + if __name__ == '__main__': unittest.main() \ No newline at end of file diff --git a/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/Stitch1DTest.py b/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/Stitch1DTest.py index 32b42c22c78b074272439a706a3ffb46419e9c4d..6d1568301cfdfc191e8f2db57edd0b7e7b881023 100644 --- a/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/Stitch1DTest.py +++ b/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/Stitch1DTest.py @@ -26,7 +26,7 @@ class Stitch1DTest(unittest.TestCase): # Cleanup DeleteWorkspace(self.a) DeleteWorkspace(self.b) - ''' + def test_endoverap_outside_range_throws(self): try: stitched = Stitch1D(LHSWorkspace=self.b, RHSWorkspace=self.a, StartOverlap=self.x[0], EndOverlap=self.x[-1] + 0.001, Params='0.2') @@ -104,8 +104,8 @@ class Stitch1DTest(unittest.TestCase): step_size = out_x_values[1] - out_x_values[0] self.assertEqual(x_min, -1) - self.assertAlmostEqual(x_max-demanded_step_size, 1.4, delta=1e-6) - self.assertAlmostEqual(step_size, demanded_step_size, delta=1e-6) + self.assertAlmostEqual(x_max-demanded_step_size, 1.4, places=6) + self.assertAlmostEqual(step_size, demanded_step_size, places=6) DeleteWorkspace(stitched) DeleteWorkspace(ws1) @@ -130,8 +130,8 @@ class Stitch1DTest(unittest.TestCase): print start_overlap_determined, end_overlap_determined - self.assertAlmostEqual(start_overlap_determined, -0.4, delta=1e-9) - self.assertAlmostEqual(end_overlap_determined, 0.2, delta=1e-9) + self.assertAlmostEqual(start_overlap_determined, -0.4, places=9) + self.assertAlmostEqual(end_overlap_determined, 0.2, places=9) def test_stitching_scale_right(self): stitched = Stitch1D(LHSWorkspace=self.b, RHSWorkspace=self.a, StartOverlap=-0.4, EndOverlap=0.4, Params='0.2') @@ -190,7 +190,7 @@ class Stitch1DTest(unittest.TestCase): # Check that the output X-Values are correct. self.assertEquals(set(numpy.around(self.x, decimals=6)), set(xValues)) DeleteWorkspace(stitched[0]) - ''' + def test_stitching_manual_scale_factor_scale_left(self): stitched = Stitch1D(LHSWorkspace=self.b, RHSWorkspace=self.a, StartOverlap=-0.4, EndOverlap=0.4, Params='0.2', ScaleRHSWorkspace=False, UseManualScaleFactor=True, ManualScaleFactor=3.0/2.0) self.assertAlmostEquals(stitched[1], 3.0/2.0, places=9)