Mantid
|
Provide interpolation over a series of points. More...
#include <Interpolation.h>
Public Member Functions | |
void | addPoint (const double &xx, const double &yy) |
add data point More... | |
bool | containData () const |
return false if no data has been added More... | |
std::string | getMethod () const |
get interpolation method More... | |
Unit_sptr | getXUnit () const |
get x-axis unit More... | |
Unit_sptr | getYUnit () const |
get y-axis unit More... | |
Interpolation () | |
Constructor default to linear interpolation and x-unit set to TOF. More... | |
void | printSelf (std::ostream &os) const |
Prints object to stream. More... | |
void | resetData () |
Clear interpolation values. More... | |
void | setMethod (const std::string &method) |
set interpolation method More... | |
void | setXUnit (const std::string &unit) |
set x-axis unit More... | |
void | setYUnit (const std::string &unit) |
set y-axis unit More... | |
double | value (const double &at) const |
get interpolated value at location at More... | |
virtual | ~Interpolation ()=default |
Protected Member Functions | |
std::vector< DataXY >::const_iterator | cbegin () const |
std::vector< DataXY >::const_iterator | cend () const |
std::vector< DataXY >::const_iterator | findIndexOfNextLargerValue (double key) const |
Get iterator of item that is next larger than the supplied x value. More... | |
Private Attributes | |
std::vector< DataXY > | m_data |
internal storage of x and y values More... | |
std::string | m_method |
method used for doing the interpolation More... | |
Unit_sptr | m_xUnit |
unit of x-axis More... | |
Unit_sptr | m_yUnit |
unit of y-axis More... | |
Provide interpolation over a series of points.
Definition at line 29 of file Interpolation.h.
Mantid::Kernel::Interpolation::Interpolation | ( | ) |
Constructor default to linear interpolation and x-unit set to TOF.
Definition at line 30 of file Interpolation.cpp.
References Mantid::DataObjects::create().
|
virtualdefault |
void Mantid::Kernel::Interpolation::addPoint | ( | const double & | xx, |
const double & | yy | ||
) |
add data point
Add point in the interpolation.
xx | :: x-value |
yy | :: y-value |
Definition at line 102 of file Interpolation.cpp.
References findIndexOfNextLargerValue(), and m_data.
Referenced by Mantid::Kernel::AttenuationProfile::AttenuationProfile(), Mantid::Algorithms::TOFSANSResolutionByPixel::exec(), Mantid::Algorithms::CreateUserDefinedBackground::getInterpolator(), Mantid::Kernel::operator>>(), and Mantid::Kernel::AttenuationProfile::setAttenuationCoefficient().
|
protected |
Definition at line 42 of file Interpolation.cpp.
References m_data.
|
protected |
Definition at line 44 of file Interpolation.cpp.
References m_data.
|
inline |
return false if no data has been added
Definition at line 78 of file Interpolation.h.
References m_data.
Referenced by Mantid::Kernel::AttenuationProfile::AttenuationProfile(), and Mantid::Geometry::FitParameter::getValue().
|
protected |
Get iterator of item that is next larger than the supplied x value.
key | :: the x value to base the search on |
Definition at line 38 of file Interpolation.cpp.
References m_data.
Referenced by addPoint(), and value().
|
inline |
|
inline |
get x-axis unit
Definition at line 72 of file Interpolation.h.
|
inline |
get y-axis unit
Definition at line 75 of file Interpolation.h.
void Mantid::Kernel::Interpolation::printSelf | ( | std::ostream & | os | ) | const |
Prints object to stream.
os | :: the Stream to output to |
Definition at line 139 of file Interpolation.cpp.
References m_data, m_method, m_xUnit, and m_yUnit.
Referenced by Mantid::Kernel::operator<<().
void Mantid::Kernel::Interpolation::resetData | ( | ) |
Clear interpolation values.
Resets interpolation data by clearing the internal storage for x- and y-values.
Definition at line 150 of file Interpolation.cpp.
References m_data.
Referenced by Mantid::Kernel::operator>>().
|
inline |
set interpolation method
Definition at line 60 of file Interpolation.h.
References m_method.
Referenced by Mantid::Algorithms::CreateUserDefinedBackground::getInterpolator(), and Mantid::Kernel::operator>>().
void Mantid::Kernel::Interpolation::setXUnit | ( | const std::string & | unit | ) |
set x-axis unit
Definition at line 46 of file Interpolation.cpp.
References Mantid::Kernel::SingletonHolder< T >::Instance(), and m_xUnit.
Referenced by Mantid::Algorithms::CreateUserDefinedBackground::getInterpolator(), and Mantid::Kernel::operator>>().
void Mantid::Kernel::Interpolation::setYUnit | ( | const std::string & | unit | ) |
set y-axis unit
Definition at line 48 of file Interpolation.cpp.
References Mantid::Kernel::SingletonHolder< T >::Instance(), and m_yUnit.
Referenced by Mantid::Algorithms::CreateUserDefinedBackground::getInterpolator(), and Mantid::Kernel::operator>>().
double Mantid::Kernel::Interpolation::value | ( | const double & | at | ) | const |
get interpolated value at location at
Get interpolated value at location at.
at | :: Location where to get interpolated value |
Definition at line 54 of file Interpolation.cpp.
References Mantid::Kernel::Logger::error(), findIndexOfNextLargerValue(), Mantid::Kernel::DateAndTimeHelpers::g_log, and m_data.
Referenced by Mantid::Algorithms::TOFSANSResolutionByPixel::exec(), Mantid::Kernel::AttenuationProfile::getAttenuationCoefficient(), and Mantid::Geometry::FitParameter::getValue().
|
private |
internal storage of x and y values
Definition at line 32 of file Interpolation.h.
Referenced by addPoint(), cbegin(), cend(), findIndexOfNextLargerValue(), printSelf(), resetData(), and value().
|
private |
method used for doing the interpolation
Definition at line 35 of file Interpolation.h.
Referenced by printSelf().
|
private |
unit of x-axis
Definition at line 38 of file Interpolation.h.
Referenced by printSelf(), and setXUnit().
|
private |
unit of y-axis
Definition at line 41 of file Interpolation.h.
Referenced by printSelf(), and setYUnit().