-
Notifications
You must be signed in to change notification settings - Fork 122
/
StretchExpMuon.cpp
40 lines (31 loc) · 1.12 KB
/
StretchExpMuon.cpp
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
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "MantidCurveFitting/Functions/StretchExpMuon.h"
#include "MantidAPI/FunctionFactory.h"
#include <cmath>
namespace Mantid {
namespace CurveFitting {
namespace Functions {
using namespace CurveFitting;
using namespace Kernel;
using namespace API;
DECLARE_FUNCTION(StretchExpMuon)
void StretchExpMuon::init() {
declareParameter("A", 0.2, "Amplitude (height at origin)");
declareParameter("Lambda", 0.2, "Decay rate of the standard exponential");
declareParameter("Beta", 0.2,
"Stretching exponent, usually in the (0,2] range");
}
void StretchExpMuon::function1D(double *out, const double *xValues,
const size_t nData) const {
const double A = getParameter("A");
const double G = getParameter("Lambda");
const double b = getParameter("Beta");
for (size_t i = 0; i < nData; i++) {
out[i] = A * exp(-pow(G * xValues[i], b));
}
}
} // namespace Functions
} // namespace CurveFitting
} // namespace Mantid