19using namespace CurveFitting;
20using namespace Constraints;
22using namespace Kernel;
37 auto leftShapeConstraint = std::make_unique<BoundaryConstraint>(
this,
"LeftShape", 0.0,
true);
39 auto rightShapeConstraint = std::make_unique<BoundaryConstraint>(
this,
"RightShape", 0.0,
true);
50 for (
size_t i = 0; i < nData; ++i) {
51 double offset = xValues[i] - peak_centre;
53 if (xValues[i] <= peak_centre) {
77 for (
size_t i = 0; i < nData; ++i) {
78 double offset = xValues[i] - peak_centre;
80 if (xValues[i] <= peak_centre) {
114 throw std::runtime_error(
"Attempt to use an inactive parameter");
124 throw std::runtime_error(
"Attempt to use an inactive parameter");
168 double offset_sq = offset * offset;
169 double weight_sq = weight * weight;
170 return -peak_height / 2.0 * log(4.0 * offset_sq * weight_sq);
174 double offset_sq = offset * offset;
175 double weight_sq = weight * weight;
176 return 1.0 + 4.0 * offset_sq * (pow(2, 1.0 /
m) - 1.0) * weight_sq;
180 return 8.0 * peak_height *
m * offset * (pow(2, 1.0 /
m) - 1.0) * weight /
185 double offset_sq = offset * offset;
186 double weight_sq = weight * weight;
double value
The value of the point.
#define DECLARE_FUNCTION(classname)
Macro for declaring a new type of function to be used with the FunctionFactory.
bool isActive(size_t i) const
Check if an active parameter i is actually active.
virtual void addConstraint(std::unique_ptr< IConstraint > ic)
Add a constraint to function.
An interface to a peak function, which extend the interface of IFunctionWithLocation by adding method...
void setParameter(const std::string &name, const double &value, bool explicitlySet=true) override
Override parent so that we may bust the cache when a parameter is set.
Represents the Jacobian in IFitFunction::functionDeriv.
virtual void set(size_t iY, size_t iP, double value)=0
Set a value to a Jacobian matrix element.
std::string parameterName(size_t i) const override
Returns the name of parameter i.
void declareParameter(const std::string &name, double initValue=0, const std::string &description="") override
Declare a new parameter.
double getParameter(size_t i) const override
Get i-th parameter.
Provides an implementation of the asymmetric PearsonVII function (sometimes it is also referred to as...
double rightShape() const
double fwhm() const override
Returns the peak FWHM.
void setCentre(const double newCentre) override
Sets the parameters such that centre == c.
void functionDerivLocal(API::Jacobian *out, const double *xValues, const size_t nData) override
Derivative evaluation method. Default is to calculate numerically.
void setActiveParameter(size_t i, double value) override
Set new value of i-th active parameter.
double getPearsonVIIDerivWRTh(double offset, double weight, double m) const
double getPearsonVII(double peak_height, double offset, double weight, double m) const
double getPearsonVIIDerivWRTmLimitmEq0(double peak_height, double offset, double weight) const
void setFwhm(const double newFwhm) override
Sets the parameters such that FWHM = w.
double getPearsonVIIDerivWRTm(double peak_height, double offset, double weight, double m) const
double activeParameter(size_t i) const override
Value of i-th active parameter.
double getPearsonVIIDerivWRTcLimitmEq0() const
double getPearsonVIILimitmEq0(double peak_height) const
double getPearsonVIIDerivWRTwLimitmEq0() const
void setHeight(const double newHight) override
Sets the parameters such that height == h.
void init() override
Override IFunction base class method, which declares function parameters.
double getPearsonVIIDerivWRThLimitmEq0() const
double height() const override
Override IPeakFunction base class methods.
void functionLocal(double *out, const double *xValues, const size_t nData) const override
Function evaluation method to be implemented in the inherited classes.
double getPearsonVIIDerivWRTw(double peak_height, double offset, double weight, double m) const
void setRightShape(const double newRightShape)
double getPearsonVIIDerivWRTc(double peak_height, double offset, double weight, double m) const
double centre() const override
Returns the centre of the function, which may be something as simple as the centre of the fitting ran...
void setLeftShape(const double newLeftShape)
double m_derivative_function(double peak_height, double offset_sq, double weight_sq, double m)
double denominator_function(double offset_sq, double weight_sq, double m)
double derivative_function(double peak_height, double offset, double weight, double m)