Mantid
Loading...
Searching...
No Matches
StretchExpMuon.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 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//----------------------------------------------------------------------
8// Includes
9//----------------------------------------------------------------------
12#include <cmath>
13
15
16using namespace CurveFitting;
17
18using namespace Kernel;
19
20using namespace API;
21
22DECLARE_FUNCTION(StretchExpMuon)
23
24void StretchExpMuon::init() {
25 declareParameter("A", 0.2, "Amplitude (height at origin)");
26 declareParameter("Lambda", 0.2, "Decay rate of the standard exponential");
27 declareParameter("Beta", 0.2, "Stretching exponent, usually in the (0,2] range");
28}
29
30void StretchExpMuon::function1D(double *out, const double *xValues, const size_t nData) const {
31 const double A = getParameter("A");
32 const double G = getParameter("Lambda");
33 const double b = getParameter("Beta");
34
35 for (size_t i = 0; i < nData; i++) {
36 out[i] = A * exp(-pow(G * xValues[i], b));
37 }
38}
39
40} // namespace Mantid::CurveFitting::Functions
#define DECLARE_FUNCTION(classname)
Macro for declaring a new type of function to be used with the FunctionFactory.
double getParameter(size_t i) const override
Get i-th parameter.
Provide stetch exponential function for Muon scientists.
void function1D(double *out, const double *xValues, const size_t nData) const override
Function you want to fit to.