diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/CalculateSelfScatteringCorrection.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/CalculateSelfScatteringCorrection.py index 739a9629bfa605e0179085bfc7aa83a30067d0f2..a5a109e09bf9ea2110f5f92b41663676b31a688b 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/CalculateSelfScatteringCorrection.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/CalculateSelfScatteringCorrection.py @@ -31,7 +31,7 @@ class CalculateSelfScatteringCorrection(DataProcessorAlgorithm): def PyInit(self): self.declareProperty(WorkspaceProperty('RawWorkspace', '', direction=Direction.Input), doc='Raw workspace') - self.declareProperty(WorkspaceProperty('CorrectionsWorkspace', '', direction=Direction.Output), + self.declareProperty(WorkspaceProperty('CorrectionWorkspace', '', direction=Direction.Output), doc='Focused corrected workspace') self.declareProperty(name='CalFileName', defaultValue='', doc='Chemical formula for the sample material') @@ -96,7 +96,7 @@ class CalculateSelfScatteringCorrection(DataProcessorAlgorithm): DeleteWorkspace(fit_spectra) DeleteWorkspace(monitor) DeleteWorkspace(raw_ws) - self.setProperty('CorrectionsWorkspace', self_scattering_correction) + self.setProperty('CorrectionWorkspace', self_scattering_correction) # Register algorithm with Mantid diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/MergeWorkspacesWithLimits.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/MergeWorkspacesWithLimits.py index 796200fb5f75ff844139426795e6152a2d6655ea..d7dc72a3e09341688c7f52501dfa94f27a6e6cdf 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/MergeWorkspacesWithLimits.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/MergeWorkspacesWithLimits.py @@ -12,20 +12,30 @@ from mantid.kernel import (Direction, FloatArrayProperty) import numpy as np -class MergeWorkspaceWithLimits(DataProcessorAlgorithm): +class MergeWorkspacesWithLimits(DataProcessorAlgorithm): + + def __init__(self): + """Initialize an instance of the algorithm.""" + DataProcessorAlgorithm.__init__(self) + + def name(self): + return 'MergeWorkspacesWithLimits' def category(self): - return "Workflow\\Diffraction" + return 'Workflow\\Diffraction' def seeAlso(self): - return [""] + return [] def summary(self): - return "Merges a group workspace using weighting from a set of range limits for each workspace." + return 'Merges a group workspace using weighting from a set of range limits for each workspace.' def checkGroups(self): return False + def version(self): + return 1 + def PyInit(self): self.declareProperty(WorkspaceProperty('WorkspaceGroup', '', direction=Direction.Input), doc='Workspace group for merging') @@ -78,4 +88,4 @@ class MergeWorkspaceWithLimits(DataProcessorAlgorithm): # Register algorithm with Mantid -AlgorithmFactory.subscribe(MergeWorkspaceWithLimits) +AlgorithmFactory.subscribe(MergeWorkspacesWithLimits) diff --git a/docs/source/algorithms/MergeWorkspacesWithLimits-v1.rst b/docs/source/algorithms/MergeWorkspacesWithLimits-v1.rst new file mode 100644 index 0000000000000000000000000000000000000000..091a34f48ccba742e79edbc19780ee996d070dcd --- /dev/null +++ b/docs/source/algorithms/MergeWorkspacesWithLimits-v1.rst @@ -0,0 +1,27 @@ +.. algorithm:: + +.. summary:: + +.. relatedalgorithms:: + +.. properties:: + +Description +----------- + +This is a workflow algorithm that merges down a workspace group +and sums the spectra using weighted mean and Ranges for each +spectra. This is done by executing several sub-algorithms as +listed below. + +#. :ref:`algm-Rebin` To rebin all spectra to have common bins +#. :ref:`algm-ConjoinWorkspaces` repeated for every workspaces in the workspace group +#. :ref:`algm-MatchSpectra` Matched against the spectra with the largest original x range +#. :ref:`algm-CropWorkspaceRagged` to cut spectra to match the X limits given +#. :ref:`algm-Rebin` To rebin all spectra to have common bins +#. :ref:`algm-SumSpectra` using `WeightedSum=True` and `MultiplyBySpectra=False` + +Workflow +######## + +.. diagram:: MergeWorkspacesWithLimits-v1_wkflw.dot diff --git a/docs/source/diagrams/CalculateSelfScatteringCorrection-v1_wkflw.dot b/docs/source/diagrams/CalculateSelfScatteringCorrection-v1_wkflw.dot new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/docs/source/diagrams/MergeWorkspacesWithLimits-v1_wkflw.dot b/docs/source/diagrams/MergeWorkspacesWithLimits-v1_wkflw.dot new file mode 100644 index 0000000000000000000000000000000000000000..50983a36a53a74edf3d4ff7e397b0dc193adf2f2 --- /dev/null +++ b/docs/source/diagrams/MergeWorkspacesWithLimits-v1_wkflw.dot @@ -0,0 +1,48 @@ +digraph MergeWorkspacesWithLimits { +label = "MergeWorkspacesWithLimits Workflow Diagram" +$global_style + +subgraph params { + $param_style + inputWorkspace [label="WorkspaceGroup"] + outputWorkspace [label="OutputWorkspace"] + xMin [label="XMin"] + xMax [label="XMax"] + matchSpectraIndex [label="Index of spectra with largest X range"] +} + +subgraph decisions { + $decision_style + isGroupWsNotConjoined [label="Are there\n un-conjoined workspaces\n in the WorkspaceGroup"] +} + +subgraph algorithms { + $algorithm_style + Rebin1 [label="Rebin v1"] + ConjoinWorkspaces [label="ConjoinWorkspaces v1"] + MatchSpectra [label="MatchSpectra v1"] + CropWorkspaceRagged [label="CropWorkspaceRagged v1"] + Rebin2 [label="Rebin v1"] + SumSpectra [label="SumSpectra v1"] +} + +subgraph process { + $process_style + findLargestRange [label="Find detector data with the largest X range"] +} + +inputWorkspace -> findLargestRange +findLargestRange -> Rebin1 +findLargestRange -> matchSpectraIndex +Rebin1 -> isGroupWsNotConjoined +isGroupWsNotConjoined -> ConjoinWorkspaces [label="Yes"] +isGroupWsNotConjoined -> MatchSpectra [label="No"] +ConjoinWorkspaces -> isGroupWsNotConjoined +matchSpectraIndex -> MatchSpectra +MatchSpectra -> CropWorkspaceRagged +xMin -> CropWorkspaceRagged +xMax -> CropWorkspaceRagged +CropWorkspaceRagged -> Rebin2 +Rebin2 -> SumSpectra +SumSpectra -> outputWorkspace +} \ No newline at end of file diff --git a/scripts/Diffraction/isis_powder/polaris_routines/polaris_algs.py b/scripts/Diffraction/isis_powder/polaris_routines/polaris_algs.py index a1c4e1aa75bb4d00104476004db06bd378b668bf..cceead5ea2a9d4b8df2cab1186a0266afcbf6801 100644 --- a/scripts/Diffraction/isis_powder/polaris_routines/polaris_algs.py +++ b/scripts/Diffraction/isis_powder/polaris_routines/polaris_algs.py @@ -105,8 +105,7 @@ def generate_ts_pdf(run_number, focus_file_path, merge_banks=False, q_lims=None, if merge_banks: q_min, q_max = _load_qlims(q_lims) - merged_ws = mantid.MergeWorkspaceWithLimits(focused_ws, q_min, q_max) - #merged_ws = _merge_workspace_with_limits(focused_ws, q_min, q_max) + merged_ws = mantid.MergeWorkspacesWithLimits(focused_ws, q_min, q_max) pdf_output = mantid.PDFFourierTransform(Inputworkspace=merged_ws, InputSofQType="S(Q)-1", PDFType="G(r)", Filter=True) else: