| <large>libXpertMassCore and libXpertMassGui Developer Documentation</large>

- libXpertMassCore
- CubicSplineModel

# MsXpS::libXpertMassCore::Processing::CubicSplineModel Class

class MsXpS::libXpertMassCore::Processing::CubicSplineModel

The CubicSplineModel struct provides a cubic spline model of a mass spectrometric data peak. More...

Header: | `#include <MsXpS/libXpertMassCore/Processing/CubicSplineModel.hpp>`

- List of all members, including inherited members
- CubicSplineModel is part of libXpertMassCore Data processing.

## Public Functions

| CubicSplineModel()
| CubicSplineModel(const QMap<double, double> &x_y_values_map)
| CubicSplineModel(const QList<double> &x_values, const QList<double> &y_values)
| CubicSplineModel(const MsXpS::libXpertMassCore::Processing::CubicSplineModel &other)
virtual | ~CubicSplineModel()
MsXpS::libXpertMassCore::Processing::CubicSplineModel * | clone(const MsXpS::libXpertMassCore::Processing::CubicSplineModel &other)
double | derivative(const double x_value) const
double | derivatives(const double x_value, unsigned int order) const
double | evalSplineAt(double x_value) const
const QList<double> & | getKnots() const
void | setup(const QList<double> &x_values, const QList<double> &y_values)
MsXpS::libXpertMassCore::Processing::CubicSplineModel & | operator=(const MsXpS::libXpertMassCore::Processing::CubicSplineModel &other)

## Detailed Description

The spline model is used to interpolate the peak shape between discrete data points, allowing for sub-sampling resolution. This is particularly useful for the centroidation of mass peaks.

## Member Function Documentation

### CubicSplineModel::CubicSplineModel()

Constructs a CubicSplineModel instance.

Because no spectral data are provided, the setup() call does not happen and the member data are not initialized.

### `[explicit]` CubicSplineModel::CubicSplineModel(const QMap<double, double> &x_y_values_map)

Constructs a CubicSplineModel uninitialized instance with input data x_y_values_map.

Delegates the construction to CubicSplineModel(const QList<double> &x_values, const QList<double> &y_values).

See also CubicSplineModel(const QList<double> &x_values, const QList<double> &y_values).

### `[explicit]` CubicSplineModel::CubicSplineModel(const QList<double> &x_values, const QList<double> &y_values)

Constructs a CubicSplineModel instance with input data x_values and y_values.

The x_values (m/z) values need to be sorted in increasing order.

setup() is called on the provided data for the initialization of member data.

See also setup().

### CubicSplineModel::CubicSplineModel(const MsXpS::libXpertMassCore::Processing::CubicSplineModel &other)

Constructs a CubicSplineModel using other as a template.

### `[virtual noexcept]` CubicSplineModel::~CubicSplineModel()

Destructs this instance.

### MsXpS::libXpertMassCore::Processing::CubicSplineModel *CubicSplineModel::clone(const MsXpS::libXpertMassCore::Processing::CubicSplineModel &other)

Heap-allocates a new CubicSplineModel using other as a template and returns it.

Member data are copied deeply.

### double CubicSplineModel::derivative(const double x_value) const

Calculates the derivative at x-axis point x_value and returns it.

The derivative order is 1.

### double CubicSplineModel::derivatives(const double x_value, unsigned int order) const

Calculates the derivative at x-axis point x_value with order order and returns it.

### double CubicSplineModel::evalSplineAt(double x_value) const

Evaluates the spline curve at x-axis value x_value and returns the evaluation value.

### const QList<double> &CubicSplineModel::getKnots() const

Returns the member m_knots.

### void CubicSplineModel::setup(const QList<double> &x_values, const QList<double> &y_values)

Sets up this instance by looking into the x_values (m/z) and y_values (intensity).

The member data are derived from looking into the data passed to the function.

### MsXpS::libXpertMassCore::Processing::CubicSplineModel &CubicSplineModel::operator=(const MsXpS::libXpertMassCore::Processing::CubicSplineModel &other)

Initializes this instance using other as a template and returns a reference to itself.