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

- libXpertMassCore
- Gaussian

# MsXpS::libXpertMassCore::Math::Gaussian Class

class MsXpS::libXpertMassCore::Math::Gaussian

The Gaussian class provides a number of utility features for Gaussian fitting. More...

Header: | `#include <MsXpS/libXpertMassCore/Math/Gaussian.hpp>`

- List of all members, including inherited members
- Gaussian is part of libXpertMassCore Math.

## Static Public Members

std::tuple<double, double, double, double> | levenbergMarquardtFit(const pappso::Trace &input_trace, pappso::Trace &fit_trace)
std::tuple<double, double, double> | linearLeastSquaresFit(const pappso::Trace &input_trace, pappso::Trace &fit_trace)

## Detailed Description

## Member Function Documentation

### `[static]` std::tuple<double, double, double, double> Gaussian::levenbergMarquardtFit(const pappso::Trace &input_trace, pappso::Trace &fit_trace)

Performs a Gaussian fit of the input_trace and sets the computed fit data to fit_trace.

The Gaussian fit is computed using the Levenberg-Marquardt method. The Levenberg-Marquardt functor that is used for the minimization is fed with parameters obtained from running Math::Generic::weightedCenterOfMass.

The returned tuple has four members:

- Member 0: Gaussian mu (µ), the abscissa of the curve's apex
- Member 1: A (amplitude), the intensity at the apex
- Member 2: sigma [related to the FWHM according to: FWHM = 2 * sqrt(2 * std::log(2)) * sigma]
- Member 3: b, the baseline value

If an error occurs, or if input_trace is empty or no fit could be computed, a tuple will all three members set to 0 is returned.

See also Math::Gaussian::linearLeastSquaresFit and Math::Generic::weightedCenterOfMass.

### `[static]` std::tuple<double, double, double> Gaussian::linearLeastSquaresFit(const pappso::Trace &input_trace, pappso::Trace &fit_trace)

Performs a Gaussian fit of the input_trace and sets the computed fit data to fit_trace.

The Gaussian fit is computed using the least squares method.

The returned tuple has these members:

- Member 0: Gaussian mu (µ), the abscissa of the curve's apex
- Member 1: A (amplitude), the intensity at the apex
- Member 2: FWHM (the full width at half maximum)

If an error occurs, or if input_trace is empty or no fit could be computed, a tuple will all three members set to 0 is returned.