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

- libXpertMassCore
- LocalSignalToNoiseEstimator

# MsXpS::libXpertMassCore::Processing::LocalSignalToNoiseEstimator Class

class MsXpS::libXpertMassCore::Processing::LocalSignalToNoiseEstimator

The LocalSignalToNoiseEstimator class encapsulates all the features required to compute a signal-to-noise ratio value for each point in a trace. More...

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

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

## Public Types

struct | GaussianEstimateParams
struct | Parameters
enum | IntensityThresholdCalculation { MANUAL_BY_VALUE, AUTO_MAX_BY_STDEV, AUTO_MAX_BY_PERCENTILE }

## Public Functions

| LocalSignalToNoiseEstimator()
| LocalSignalToNoiseEstimator(const MsXpS::libXpertMassCore::Processing::LocalSignalToNoiseEstimator::Parameters &parameters)
virtual | ~LocalSignalToNoiseEstimator()
void | computeSignaToNoiseRatio(const pappso::Trace &trace)
MsXpS::libXpertMassCore::Processing::LocalSignalToNoiseEstimator::GaussianEstimateParams | estimateGaussian(const MsXpS::libXpertMassCore::Processing::TraceIterator &iter_first_data_point, const MsXpS::libXpertMassCore::Processing::TraceIterator &iter_last_data_point) const
double | getSignalToNoiseRatio(qsizetype index) const
void | initialize(const pappso::Trace &trace)

## Protected Variables

double | m_histogramOverflowPercentage
MsXpS::libXpertMassCore::Processing::LocalSignalToNoiseEstimator::Parameters | m_parameters
QList<double> | m_signalToNoiseEstimates
double | m_sparseWindowPercentage

## Detailed Description

This class is used in support of the code that performs the low mass deconvolution of an input mass spectrum.

## Member Type Documentation

### enum LocalSignalToNoiseEstimator::IntensityThresholdCalculation

This enum type specifies the method to be used to caculate the maximum intensity above which mass spectral data points are skipped in the local noise-to-signal estimation.

Constant | Value | Description
--- | --- | ---
`MsXpS::libXpertMassCore::Processing::LocalSignalToNoiseEstimator::MANUAL_BY_VALUE` | `0x0` | The maximum intensity is defined manually.
`MsXpS::libXpertMassCore::Processing::LocalSignalToNoiseEstimator::AUTO_MAX_BY_STDEV` | `0x1` | The maximum intensity will be determined using the standard deviation.
`MsXpS::libXpertMassCore::Processing::LocalSignalToNoiseEstimator::AUTO_MAX_BY_PERCENTILE` | `0x2` | The maximum intensity will be determined using the percentile.

## Member Function Documentation

### LocalSignalToNoiseEstimator::LocalSignalToNoiseEstimator()

Constructs a LocalSignalToNoiseEstimator instance with default parameters.

### `[explicit]` LocalSignalToNoiseEstimator::LocalSignalToNoiseEstimator(const MsXpS::libXpertMassCore::Processing::LocalSignalToNoiseEstimator::Parameters &parameters)

Constructs a LocalSignalToNoiseEstimator instance with parameters to initialize m_parameters.

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

Destructs this instance.

### void LocalSignalToNoiseEstimator::computeSignaToNoiseRatio(const pappso::Trace &trace)

Iterates in trace and, for each one of its pappso::DataPoint instances, estimates the local signal-to-noise ratio by using a sliding window approach.

See also initialize().

### MsXpS::libXpertMassCore::Processing::LocalSignalToNoiseEstimator::GaussianEstimateParams LocalSignalToNoiseEstimator::estimateGaussian(const MsXpS::libXpertMassCore::Processing::TraceIterator &iter_first_data_point, const MsXpS::libXpertMassCore::Processing::TraceIterator &iter_last_data_point) const

Estimates the Gaussian for the mass spectral points contained in the iterator range [iter_first_data_point - iter_last_data_point].

Returns the Gaussian parameters as a GaussianEstimateParams object.

### double LocalSignalToNoiseEstimator::getSignalToNoiseRatio(qsizetype index) const

Returns the item at index in the member container m_signalToNoiseEstimates of local signal-to-noise ratios.

Each data point in the input mass spectrum trace used to initialize this LocalSignalToNoiseEstimator instance has a corresponding (that is, at the same index) double value representing its local signal-to-noise estimated value.

### void LocalSignalToNoiseEstimator::initialize(const pappso::Trace &trace)

Initializes this LocalSignalToNoiseEstimator instance by looking into trace.

The input trace is not stored in this instance. It is iterated into and for each one of its pappso::DataPoint instances the local signal-to-noise ratio is estimated and stored in m_signalToNoiseEstimates.

Calls computeSignaToNoiseRatio()

## Member Variable Documentation

### double LocalSignalToNoiseEstimator::m_histogramOverflowPercentage

Counter of histogram overflow events.

This value is updated while the local signal-to-noise estimation is carried out.

### MsXpS::libXpertMassCore::Processing::LocalSignalToNoiseEstimator::Parameters LocalSignalToNoiseEstimator::m_parameters

This variable holds the Parameters required to perform the local signal-to-noise estimation.

### QList<double> LocalSignalToNoiseEstimator::m_signalToNoiseEstimates

This variable holds the actual calculated local signal-to-noise estimates.

Each point in the input mass spectrum has a corresponding double value in this container. The user of this class will be able to query the noise estimation corresponding to any mass spectral data point of the input mass spectrum.

### double LocalSignalToNoiseEstimator::m_sparseWindowPercentage

Counter for the number of sparse windows.

This value is updated while the local signal-to-noise estimation is carried out.