-
Notifications
You must be signed in to change notification settings - Fork 124
/
Rebin.h
86 lines (74 loc) · 3.09 KB
/
Rebin.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2008 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#ifndef MANTID_ALGORITHMS_REBIN_H_
#define MANTID_ALGORITHMS_REBIN_H_
#include "MantidAPI/DistributedAlgorithm.h"
namespace Mantid {
namespace Algorithms {
/** Takes a workspace as input and rebins the data according to the input rebin
parameters.
Required Properties:
<UL>
<LI> InputWorkspace - The name of the workspace to take as input. Must
contain histogram data. </LI>
<LI> OutputWorkspace - The name of the workspace in which to store the
result. </LI>
<LI> RebinParameters - The new bin boundaries in the form
X1,deltaX1,X2,deltaX2,X3,... </LI>
</UL>
The algorithms used in the VectorHelper::rebin() and
VectorHelper::createAxisFromRebinParams()
are based on the algorithms used in OPENGENIE /src/transform_utils.cxx
(Freddie Akeroyd, ISIS).
When calculating the bin boundaries, if the last bin ends up with a width
being less than 25%
of the penultimate one, then the two are combined.
@author Dickon Champion, STFC
@date 25/02/2008
*/
class DLLExport Rebin : public API::DistributedAlgorithm {
public:
/// Algorithm's name for identification overriding a virtual method
const std::string name() const override { return "Rebin"; }
/// Summary of algorithms purpose
const std::string summary() const override {
return "Rebins data with new X bin boundaries. For EventWorkspaces, you "
"can very quickly rebin in-place by keeping the same output name "
"and PreserveEvents=true.";
}
/// Algorithm's version for identification overriding a virtual method
int version() const override { return 1; }
/// Algorithm's category for identification overriding a virtual method
const std::string category() const override { return "Transforms\\Rebin"; }
/// Algorithm's aliases
const std::string alias() const override { return "rebin"; }
/// Algorithm's seeAlso
const std::vector<std::string> seeAlso() const override {
return {"RebinToWorkspace", "Rebin2D", "Rebunch",
"Regroup", "RebinByPulseTimes", "RebinByTimeAtSample"};
}
static std::vector<double>
rebinParamsFromInput(const std::vector<double> &inParams,
const API::MatrixWorkspace &inputWS,
Kernel::Logger &logger);
protected:
const std::string workspaceMethodName() const override { return "rebin"; }
const std::string workspaceMethodOnTypes() const override {
return "MatrixWorkspace";
}
const std::string workspaceMethodInputProperty() const override {
return "InputWorkspace";
}
// Overridden Algorithm methods
void init() override;
void exec() override;
void propagateMasks(API::MatrixWorkspace_const_sptr inputWS,
API::MatrixWorkspace_sptr outputWS, int hist);
};
} // namespace Algorithms
} // namespace Mantid
#endif /*MANTID_ALGORITHMS_REBIN_H_*/