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

Add Document page for MergeWorkspacesWithLimits

This commit creates a documentation rst file for MergeWorkspacesWithLimits
Along with the workflow diagram dot file. It also makes changes to the
MergeWorkspacesWithLimits algorithm to include a name and version that
is required by the documentation compiler.

This commit corrects a mistake in the property names for
CalcuateSelfScatteringCorrection.

This commit removes the commented out command to the
_merge_workspaces_with_limits function in polaris_algs in place of the workflow
algorithm.

This commit creates a blank rst file that will later contain the documentation for
CalculateSelfScatteringCorrection.

Re #27445
parent eea7fc81
No related branches found
No related tags found
No related merge requests found
...@@ -31,7 +31,7 @@ class CalculateSelfScatteringCorrection(DataProcessorAlgorithm): ...@@ -31,7 +31,7 @@ class CalculateSelfScatteringCorrection(DataProcessorAlgorithm):
def PyInit(self): def PyInit(self):
self.declareProperty(WorkspaceProperty('RawWorkspace', '', direction=Direction.Input), self.declareProperty(WorkspaceProperty('RawWorkspace', '', direction=Direction.Input),
doc='Raw workspace') doc='Raw workspace')
self.declareProperty(WorkspaceProperty('CorrectionsWorkspace', '', direction=Direction.Output), self.declareProperty(WorkspaceProperty('CorrectionWorkspace', '', direction=Direction.Output),
doc='Focused corrected workspace') doc='Focused corrected workspace')
self.declareProperty(name='CalFileName', defaultValue='', self.declareProperty(name='CalFileName', defaultValue='',
doc='Chemical formula for the sample material') doc='Chemical formula for the sample material')
...@@ -96,7 +96,7 @@ class CalculateSelfScatteringCorrection(DataProcessorAlgorithm): ...@@ -96,7 +96,7 @@ class CalculateSelfScatteringCorrection(DataProcessorAlgorithm):
DeleteWorkspace(fit_spectra) DeleteWorkspace(fit_spectra)
DeleteWorkspace(monitor) DeleteWorkspace(monitor)
DeleteWorkspace(raw_ws) DeleteWorkspace(raw_ws)
self.setProperty('CorrectionsWorkspace', self_scattering_correction) self.setProperty('CorrectionWorkspace', self_scattering_correction)
# Register algorithm with Mantid # Register algorithm with Mantid
......
...@@ -12,20 +12,30 @@ from mantid.kernel import (Direction, FloatArrayProperty) ...@@ -12,20 +12,30 @@ from mantid.kernel import (Direction, FloatArrayProperty)
import numpy as np 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): def category(self):
return "Workflow\\Diffraction" return 'Workflow\\Diffraction'
def seeAlso(self): def seeAlso(self):
return [""] return []
def summary(self): 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): def checkGroups(self):
return False return False
def version(self):
return 1
def PyInit(self): def PyInit(self):
self.declareProperty(WorkspaceProperty('WorkspaceGroup', '', direction=Direction.Input), self.declareProperty(WorkspaceProperty('WorkspaceGroup', '', direction=Direction.Input),
doc='Workspace group for merging') doc='Workspace group for merging')
...@@ -78,4 +88,4 @@ class MergeWorkspaceWithLimits(DataProcessorAlgorithm): ...@@ -78,4 +88,4 @@ class MergeWorkspaceWithLimits(DataProcessorAlgorithm):
# Register algorithm with Mantid # Register algorithm with Mantid
AlgorithmFactory.subscribe(MergeWorkspaceWithLimits) AlgorithmFactory.subscribe(MergeWorkspacesWithLimits)
.. 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
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
...@@ -105,8 +105,7 @@ def generate_ts_pdf(run_number, focus_file_path, merge_banks=False, q_lims=None, ...@@ -105,8 +105,7 @@ def generate_ts_pdf(run_number, focus_file_path, merge_banks=False, q_lims=None,
if merge_banks: if merge_banks:
q_min, q_max = _load_qlims(q_lims) q_min, q_max = _load_qlims(q_lims)
merged_ws = mantid.MergeWorkspaceWithLimits(focused_ws, q_min, q_max) merged_ws = mantid.MergeWorkspacesWithLimits(focused_ws, q_min, q_max)
#merged_ws = _merge_workspace_with_limits(focused_ws, q_min, q_max)
pdf_output = mantid.PDFFourierTransform(Inputworkspace=merged_ws, InputSofQType="S(Q)-1", PDFType="G(r)", pdf_output = mantid.PDFFourierTransform(Inputworkspace=merged_ws, InputSofQType="S(Q)-1", PDFType="G(r)",
Filter=True) Filter=True)
else: else:
......
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