Mantid
|
Classes | |
class | LinearFunction |
A linear function. More... | |
Typedefs | |
using | FunctionMapType = std::map< std::string, std::pair< size_t, Function > > |
Enumerations | |
enum | Function { None , Gaussian , Lorentzian , BackToBackExponential } |
Functions | |
void MANTID_CURVEFITTING_DLL | estimate (API::IFunction &function, const API::FunctionDomain1D &domain, const API::FunctionValues &values) |
ParameterEstimator estimates parameter values of some fitting functions from fitting data. More... | |
void | extractValues (const API::FunctionDomain1D &domain, const API::FunctionValues &values, std::vector< double > &x, std::vector< double > &y) |
Extract values from domain and values objects to vectors. More... | |
const FunctionMapType & | getFunctionMapType () |
Returns a reference to the static functionMapType. More... | |
double | getPeakCentre (double centre, const SimpleChebfun &der1) |
Improve an estimate of a peak centre. More... | |
std::pair< double, double > | getPeakHWHM (double centre, double height, const SimpleChebfun &fun) |
Get displacements from peak centre where peak reaches half the maximum. More... | |
std::pair< double, double > | getPeakLeftRightExtent (double centre, const SimpleChebfun &der2) |
Get the peak's extent on either side of the centre. More... | |
std::pair< double, double > | getPeakLeftRightWidth (double centre, const SimpleChebfun &der2, size_t n=1) |
Get a measure of peak's width. More... | |
double | getPeakWidth (double centre, const SimpleChebfun &der2) |
Estimate a peak width from a second derivative of the data. More... | |
void | initFunctionLookup (FunctionMapType &functionMapType) |
Initializes a FunctionMapType object. More... | |
bool | needSettingInitialValues (const API::IFunction &function) |
Test if initial values need to be set before fitting. More... | |
void | setBackToBackExponential (API::IFunction &function, const SimpleChebfun &fun, const SimpleChebfun &der1, const SimpleChebfun &der2) |
Set initial values to a BackToBackExponential. More... | |
void | setValues (API::IFunction &function, const SimpleChebfun &fun, const SimpleChebfun &der1, const SimpleChebfun &der2) |
Set initial values to a function if it needs to. More... | |
Function | whichFunction (const API::IFunction &function) |
Return a function code for a function if it needs setting values or None otherwise. More... | |
Variables | |
Kernel::Logger | g_log ("ParameterEstimator") |
The logger. More... | |
using Mantid::CurveFitting::ParameterEstimator::FunctionMapType = typedef std::map<std::string, std::pair<size_t, Function> > |
Definition at line 32 of file ParameterEstimator.cpp.
Enumerator | |
---|---|
None | |
Gaussian | |
Lorentzian | |
BackToBackExponential |
Definition at line 31 of file ParameterEstimator.cpp.
void Mantid::CurveFitting::ParameterEstimator::estimate | ( | API::IFunction & | function, |
const API::FunctionDomain1D & | domain, | ||
const API::FunctionValues & | values | ||
) |
ParameterEstimator estimates parameter values of some fitting functions from fitting data.
function | :: A function to estimate parameters for. |
domain | :: A domain with fitting data arguments. |
values | :: A FunctionValues object with the fitting data. |
Definition at line 391 of file ParameterEstimator.cpp.
References Mantid::CurveFitting::Functions::SimpleChebfun::derivative(), extractValues(), needSettingInitialValues(), setValues(), Mantid::Geometry::x, and Mantid::Geometry::y.
Referenced by Mantid::CurveFitting::IMWDomainCreator::setInitialValues(), and Mantid::CurveFitting::TableWorkspaceDomainCreator::setInitialValues().
void Mantid::CurveFitting::ParameterEstimator::extractValues | ( | const API::FunctionDomain1D & | domain, |
const API::FunctionValues & | values, | ||
std::vector< double > & | x, | ||
std::vector< double > & | y | ||
) |
Extract values from domain and values objects to vectors.
domain | :: A domain with fitting data arguments. |
values | :: A FunctionValues object with the fitting data. |
x | :: A vector to store the domain values |
y | :: A vector to store the fitting data values. |
Definition at line 91 of file ParameterEstimator.cpp.
References Mantid::API::FunctionValues::getFitData(), Mantid::API::FunctionDomain1D::getPointerAt(), n, Mantid::API::FunctionDomain1D::size(), Mantid::Geometry::x, and Mantid::Geometry::y.
Referenced by estimate().
const FunctionMapType & Mantid::CurveFitting::ParameterEstimator::getFunctionMapType | ( | ) |
Returns a reference to the static functionMapType.
Definition at line 48 of file ParameterEstimator.cpp.
References initFunctionLookup().
Referenced by whichFunction().
double Mantid::CurveFitting::ParameterEstimator::getPeakCentre | ( | double | centre, |
const SimpleChebfun & | der1 | ||
) |
Improve an estimate of a peak centre.
centre | :: A rough estimate of the centre. |
der1 | :: A first derivative of a function. |
Definition at line 216 of file ParameterEstimator.cpp.
References fabs, n, Mantid::CurveFitting::Functions::SimpleChebfun::roughRoots(), and Mantid::CurveFitting::Functions::SimpleChebfun::width().
Referenced by setBackToBackExponential().
std::pair< double, double > Mantid::CurveFitting::ParameterEstimator::getPeakHWHM | ( | double | centre, |
double | height, | ||
const SimpleChebfun & | fun | ||
) |
Get displacements from peak centre where peak reaches half the maximum.
centre | :: Peak centre. |
height | :: Peak height above background. height == fun(centre) - background. |
fun | :: A function which is expected to be a peak on a background. |
Definition at line 176 of file ParameterEstimator.cpp.
References Mantid::CurveFitting::Functions::SimpleChebfun::endX(), height, left, right, Mantid::CurveFitting::Functions::SimpleChebfun::roughRoots(), and Mantid::CurveFitting::Functions::SimpleChebfun::startX().
Referenced by setBackToBackExponential().
std::pair< double, double > Mantid::CurveFitting::ParameterEstimator::getPeakLeftRightExtent | ( | double | centre, |
const SimpleChebfun & | der2 | ||
) |
Get the peak's extent on either side of the centre.
centre | :: An approximate peak centre. |
der2 | :: A second derivative of a function. |
Definition at line 165 of file ParameterEstimator.cpp.
References getPeakLeftRightWidth().
Referenced by setBackToBackExponential().
std::pair< double, double > Mantid::CurveFitting::ParameterEstimator::getPeakLeftRightWidth | ( | double | centre, |
const SimpleChebfun & | der2, | ||
size_t | n = 1 |
||
) |
Get a measure of peak's width.
It finds approximate zeros of the second derivative of a function. Zeros nearest to the centre are interpreted as the peak's inflection points. The next zero is interpreted as peak boundary.
centre | :: Approximate peak centre. |
der2 | :: A second derivative of a peak. It is expected to have a minimum at centre. |
n | :: An order of the zeros to look for. If n == 1 it's the inflection points, if n == 2 it's the boundary. |
Definition at line 134 of file ParameterEstimator.cpp.
References left, n, right, Mantid::CurveFitting::Functions::SimpleChebfun::roughRoots(), and Mantid::CurveFitting::Functions::SimpleChebfun::xPoints().
Referenced by getPeakLeftRightExtent(), and getPeakWidth().
double Mantid::CurveFitting::ParameterEstimator::getPeakWidth | ( | double | centre, |
const SimpleChebfun & | der2 | ||
) |
Estimate a peak width from a second derivative of the data.
centre | :: Approximate peak centre. |
der2 | :: An approximation to the second derivative. |
Definition at line 206 of file ParameterEstimator.cpp.
References fabs, and getPeakLeftRightWidth().
Referenced by setBackToBackExponential(), and setValues().
void Mantid::CurveFitting::ParameterEstimator::initFunctionLookup | ( | FunctionMapType & | functionMapType | ) |
Initializes a FunctionMapType object.
functionMapType | :: the function map to initialize |
Definition at line 38 of file ParameterEstimator.cpp.
Referenced by getFunctionMapType().
bool Mantid::CurveFitting::ParameterEstimator::needSettingInitialValues | ( | const API::IFunction & | function | ) |
Test if initial values need to be set before fitting.
function | :: A fitting function to test. |
Definition at line 73 of file ParameterEstimator.cpp.
References needSettingInitialValues(), None, and whichFunction().
Referenced by estimate(), and needSettingInitialValues().
void Mantid::CurveFitting::ParameterEstimator::setBackToBackExponential | ( | API::IFunction & | function, |
const SimpleChebfun & | fun, | ||
const SimpleChebfun & | der1, | ||
const SimpleChebfun & | der2 | ||
) |
Set initial values to a BackToBackExponential.
function | :: A fitting BackToBackExponential function. |
fun | :: A smooth approximation of the fitting data. |
der1 | :: The first derivative of the fitting data. |
der2 | :: The second derivative of the fitting data. |
Definition at line 252 of file ParameterEstimator.cpp.
References Mantid::Kernel::Logger::debug(), Mantid::CurveFitting::Functions::SimpleChebfun::derivative(), Mantid::API::IFunction::fix(), Mantid::API::g_log, Mantid::API::IFunction::getParameter(), getPeakCentre(), getPeakHWHM(), getPeakLeftRightExtent(), getPeakWidth(), height, Mantid::CurveFitting::Functions::SimpleChebfun::order(), Mantid::API::IFunction::setParameter(), and sigma.
Referenced by setValues().
void Mantid::CurveFitting::ParameterEstimator::setValues | ( | API::IFunction & | function, |
const SimpleChebfun & | fun, | ||
const SimpleChebfun & | der1, | ||
const SimpleChebfun & | der2 | ||
) |
Set initial values to a function if it needs to.
function | :: A fitting function. |
fun | :: A smooth approximation of the fitting data. |
der1 | :: The first derivative of the fitting data. |
der2 | :: The second derivative of the fitting data. |
Definition at line 356 of file ParameterEstimator.cpp.
References Mantid::API::IFunction::getParameter(), getPeakWidth(), setBackToBackExponential(), Mantid::API::IFunction::setParameter(), setValues(), and whichFunction().
Referenced by estimate(), and setValues().
Function Mantid::CurveFitting::ParameterEstimator::whichFunction | ( | const API::IFunction & | function | ) |
Return a function code for a function if it needs setting values or None otherwise.
Definition at line 60 of file ParameterEstimator.cpp.
References getFunctionMapType(), index, Mantid::API::IFunction::isExplicitlySet(), Mantid::API::IFunction::name(), and None.
Referenced by needSettingInitialValues(), and setValues().
Kernel::Logger Mantid::CurveFitting::ParameterEstimator::g_log("ParameterEstimator") | ( | "ParameterEstimator" | ) |
The logger.