Mantid
Loading...
Searching...
No Matches
Stitch1D.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2014 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
11#include "MantidAlgorithms/DllConfig.h"
12
13#include <boost/tuple/tuple.hpp>
14
15namespace Mantid {
16namespace Algorithms {
17
20class MANTID_ALGORITHMS_DLL Stitch1D final : public API::Algorithm {
21public:
23 const std::string name() const override { return "Stitch1D"; }
25 int version() const override { return 3; }
27 const std::string category() const override { return "Reflectometry"; }
29 const std::string summary() const override { return "Stitches single histogram matrix workspaces together"; }
30 const std::vector<std::string> seeAlso() const override { return {"Rebin", "Stitch1DMany"}; }
32 bool hasNonzeroErrors(Mantid::API::MatrixWorkspace_sptr &ws);
34 std::map<std::string, std::string> validateInputs() override;
35
37 using SpecialTypeIndexes = std::vector<std::vector<size_t>>;
44
45 void resize(size_t histogramCount) {
46 nanE.resize(histogramCount);
47 nanY.resize(histogramCount);
48 infE.resize(histogramCount);
49 infY.resize(histogramCount);
50 }
51 };
52
54 int a1 = -1;
55 int a2 = -1;
56 };
57
58private:
60 void init() override;
62 void exec() override;
64 double getStartOverlap(const double intesectionMin, const double intesectionMax) const;
66 double getEndOverlap(const double intesectionMin, const double intesectionMax) const;
67
69 std::vector<double> getRebinParams(Mantid::API::MatrixWorkspace_const_sptr &lhsWS,
70 Mantid::API::MatrixWorkspace_const_sptr &rhsWS, const bool scaleRHS) const;
72 Mantid::API::MatrixWorkspace_sptr rebin(Mantid::API::MatrixWorkspace_sptr &input, const std::vector<double> &params,
73 SpecialValueIndexes &specialValues);
75 Mantid::API::MatrixWorkspace_sptr integration(Mantid::API::MatrixWorkspace_sptr const &input, const double start,
76 const double stop);
85 boost::tuple<int, int> findStartEndIndexes(double startOverlap, double endOverlap,
90 void maskInPlace(int a1, int a2, Mantid::API::MatrixWorkspace_sptr &source);
92 void reinsertSpecialValues(const Mantid::API::MatrixWorkspace_sptr &ws, const SpecialValueIndexes &lhsSpecialValues,
93 const SpecialValueIndexes &rhsSpecialValues, overlapBounds bounds);
95 void useValidOverlapData(const Mantid::API::MatrixWorkspace_sptr &overlap,
97 const SpecialValueIndexes &lhsSpecialValues, const SpecialValueIndexes &rhsSpecialValues,
98 const overlapBounds bounds);
100 static const double range_tolerance;
106 void scaleWorkspace(API::MatrixWorkspace_sptr &ws, API::MatrixWorkspace_sptr &scaleFactorWS,
111};
112
113} // namespace Algorithms
114} // namespace Mantid
const std::vector< double > & rhs
IPeaksWorkspace_sptr workspace
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
Stitch1D : Stitches two Matrix Workspaces together into a single output.
Definition Stitch1D.h:20
SpecialValueIndexes m_lhsSpecialValues
Index per workspace spectra of special values.
Definition Stitch1D.h:109
const std::string summary() const override
Summary of algorithm's purpose.
Definition Stitch1D.h:29
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso algorithms related to this algorithm.
Definition Stitch1D.h:30
std::vector< std::vector< size_t > > SpecialTypeIndexes
Helper typedef for storing special-value indexes per spectrum.
Definition Stitch1D.h:37
const std::string name() const override
Algorithm's name for identification.
Definition Stitch1D.h:23
SpecialValueIndexes m_rhsSpecialValues
Definition Stitch1D.h:110
Mantid::API::MatrixWorkspace_sptr singleValueWS(const double val)
const std::string category() const override
Algorithm's category for identification.
Definition Stitch1D.h:27
int version() const override
Algorithm's version for identification.
Definition Stitch1D.h:25
double m_scaleFactor
Scaling factors.
Definition Stitch1D.h:102
static const double range_tolerance
Range tolerance.
Definition Stitch1D.h:100
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
void MANTID_KERNEL_DLL rebin(const std::vector< double > &xold, const std::vector< double > &yold, const std::vector< double > &eold, const std::vector< double > &xnew, std::vector< double > &ynew, std::vector< double > &enew, bool distribution, bool addition=false)
Rebins data according to a new output X array.
Helper class which provides the Collimation Length for SANS instruments.
Indexes of Y and E values that were NaN or infinite before processing.
Definition Stitch1D.h:39