diff --git a/Framework/Algorithms/src/Stitch1D.cpp b/Framework/Algorithms/src/Stitch1D.cpp index 553365f31092bdb21f3a0e007e6e253fdfad9f8b..fd605eb15131ee27394150a97e2edb11974f5300 100644 --- a/Framework/Algorithms/src/Stitch1D.cpp +++ b/Framework/Algorithms/src/Stitch1D.cpp @@ -7,10 +7,11 @@ #include "MantidHistogramData/HistogramY.h" #include "MantidHistogramData/HistogramE.h" #include "MantidKernel/ArrayProperty.h" +#include "MantidKernel/BoundedValidator.h" +#include "MantidKernel/ListValidator.h" +#include "MantidKernel/MultiThreaded.h" #include "MantidKernel/PropertyWithValue.h" #include "MantidKernel/RebinParamsValidator.h" -#include "MantidKernel/MultiThreaded.h" -#include "MantidKernel/BoundedValidator.h" #include <boost/tuple/tuple.hpp> #include <boost/format.hpp> @@ -160,6 +161,12 @@ void Stitch1D::init() { declareProperty(make_unique<PropertyWithValue<double>>( "OutScaleFactor", Mantid::EMPTY_DBL(), Direction::Output), "The actual used value for the scaling factor."); + + const std::vector<std::string> outputXOption{"WeightedMeanOverlap", + "OriginalOverlap"}; + declareProperty("OutputXOption", "WeightedMeanOverlap", + boost::make_shared<StringListValidator>(outputXOption), + "Output option to choose how to overlap x values."); } /**Gets the start of the overlapping region diff --git a/docs/source/algorithms/Stitch1D-v3.rst b/docs/source/algorithms/Stitch1D-v3.rst index 010ebcdb32a900f7de9c9288609b80103db4dd53..becd58bff641c132314acc9c3a0cdcf142c2bde5 100644 --- a/docs/source/algorithms/Stitch1D-v3.rst +++ b/docs/source/algorithms/Stitch1D-v3.rst @@ -18,6 +18,9 @@ Users can optionally provide :ref:`algm-Rebin` :literal:`Params`, otherwise they Likewise, :literal:`StartOverlap` and :literal:`EndOverlap` are optional. If not provided, then these are taken to be the region of X-axis intersection. +The option :literal:`OutputXOption` defines the calculation of x values in the overlap range of the output workspace. +The default option is :literal:`WeightedMeanOverlap`. + The algorithm workflow is as follows: #. The workspaces are initially rebinned, as prescribed by the rebin :literal:`Params`. Note that @@ -42,12 +45,13 @@ The algorithm workflow is as follows: #. The weighted mean of the two workspaces in range [:literal:`StartOverlap`, :literal:`EndOverlap`] is calculated. Note that if both workspaces have zero errors, an un-weighted mean will be performed instead. -#. The output workspace will be created by summing the left-hand-side workspace (values in range +#. If :literal:`OutputXOption` is :literal:`WeightedMeanOverlap`, the output workspace will be created by summing the left-hand-side workspace (values in range [:literal:`StartX`, :literal:`StartOverlap`], where :literal:`StartX` is the minimum X value specified via :literal:`Params` or calculated from the left-hand-side workspace) + weighted mean workspace + right-hand-side workspace (values in range [:literal:`EndOverlap`, :literal:`EndX`], where :literal:`EndX` is the maximum X value specified via :literal:`Params` or calculated from the right-hand-side workspace) multiplied by the scale factor. + If :literal:`OutputXOption` is :literal:`OriginalOverlap`, the output workspace will propagate x values and Dx values present in the overlap range to the :literal:`OutputWorkspace`. #. The special values are put back in the output workspace. Note that if both the left-hand-side workspace and the right-hand-side workspace happen to have a different special value in the same bin, this bin will be set to infinite in the output workspace. @@ -121,4 +125,4 @@ Output: .. categories:: .. sourcelink:: - :filename: Stitch1D \ No newline at end of file + :filename: Stitch1D