/
ProcessBackground.h
149 lines (108 loc) · 4.41 KB
/
ProcessBackground.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#ifndef MANTID_CURVEFITTING_PROCESSBACKGROUND_H_
#define MANTID_CURVEFITTING_PROCESSBACKGROUND_H_
#include "MantidKernel/System.h"
#include "MantidAPI/Algorithm.h"
#include "MantidCurveFitting/Functions/BackgroundFunction.h"
#include "MantidDataObjects/Workspace2D.h"
#include "MantidDataObjects/TableWorkspace.h"
#include "MantidKernel/ArrayProperty.h"
#include "MantidAPI/WorkspaceFactory.h"
#include "MantidAPI/FunctionDomain1D.h"
#include "MantidAPI/FunctionValues.h"
namespace Mantid {
namespace CurveFitting {
namespace Functions {
class RemovePeaks {
public:
RemovePeaks();
~RemovePeaks();
void setup(DataObjects::TableWorkspace_sptr peaktablews);
DataObjects::Workspace2D_sptr
removePeaks(API::MatrixWorkspace_const_sptr dataws, int wsindex,
double numfwhm);
private:
/// Parse peak centre and FWHM from a table workspace
void parsePeakTableWorkspace(DataObjects::TableWorkspace_sptr peaktablews,
std::vector<double> &vec_peakcentre,
std::vector<double> &vec_peakfwhm);
/// Exclude peak regions
size_t excludePeaks(std::vector<double> v_inX, std::vector<bool> &v_useX,
std::vector<double> v_centre, std::vector<double> v_fwhm,
double num_fwhm);
std::vector<double> m_vecPeakCentre;
std::vector<double> m_vecPeakFWHM;
};
/** ProcessBackground : Process background obtained from LeBailFit
Copyright © 2012 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge
National Laboratory & European Spallation Source
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport ProcessBackground : public API::Algorithm {
public:
ProcessBackground();
~ProcessBackground() override;
const std::string category() const override { return "Diffraction\\Utility"; }
const std::string name() const override { return "ProcessBackground"; }
int version() const override { return 1; }
/// Summary of algorithms purpose
const std::string summary() const override {
return "ProcessBackground provides some tools to process powder "
"diffraction pattern's "
"background in order to help Le Bail Fit.";
}
private:
/// Define properties
void init() override;
/// Execution body
void exec() override;
/// Set up dummy output optional workspaces
void setupDummyOutputWSes();
/// Select b...
void selectBkgdPoints();
/// Select background points (main)
void selectFromGivenXValues();
/// Select background points (main)
void selectFromGivenFunction();
/// Select background points automatically
DataObjects::Workspace2D_sptr
autoBackgroundSelection(DataObjects::Workspace2D_sptr bkgdWS);
/// Create a background function from input properties
BackgroundFunction_sptr
createBackgroundFunction(const std::string backgroundtype);
/// Filter non-background data points out and create a background workspace
DataObjects::Workspace2D_sptr
filterForBackground(BackgroundFunction_sptr bkgdfunction);
DataObjects::Workspace2D_const_sptr m_dataWS;
DataObjects::Workspace2D_sptr m_outputWS;
int m_wsIndex;
double m_lowerBound;
double m_upperBound;
std::string m_bkgdType;
// bool m_doFitBackground;
// double mTolerance;
/// Number of FWHM of range of peak to be removed.
double m_numFWHM;
/// Remove peaks in a certain region
void removePeaks();
/// Remove a certain region from input workspace
void deleteRegion();
/// Add a certain region from a reference workspace
void addRegion();
void fitBackgroundFunction(std::string bkgdfunctiontype);
};
} // namespace Functions
} // namespace CurveFitting
} // namespace Mantid
#endif /* MANTID_CURVEFITTING_PROCESSBACKGROUND_H_ */