![]() |
OpenMS
|
Estimates the signal/noise (S/N) ratio of each data point in a scan by using the median (window based) More...
#include <OpenMS/PROCESSING/NOISEESTIMATION/SignalToNoiseEstimatorMedianRapid.h>
Classes | |
| struct | NoiseEstimator |
| Class to compute the noise value at a given position. More... | |
Public Member Functions | |
| SignalToNoiseEstimatorMedianRapid (double window_length) | |
| default constructor | |
| NoiseEstimator | estimateNoise (OpenMS::Interfaces::SpectrumPtr spectrum) |
| Compute noise estimator for an m/z and intensity array using windows. | |
| NoiseEstimator | estimateNoise (OpenMS::Interfaces::ChromatogramPtr chrom) |
| Compute noise estimator for an m/z and intensity array using windows. | |
| NoiseEstimator | estimateNoise (const std::vector< double > &mz_array, const std::vector< double > &int_array) |
| Compute noise estimator for an m/z and intensity array using windows. | |
Private Member Functions | |
| void | computeNoiseInWindows_ (const std::vector< double > &mz_array, std::vector< double > int_array, std::vector< double > &result, double mz_start) |
| Computes the noise in windows for two input arrays and stores the median intensity in the result (internal) | |
| double | computeMedian_ (std::vector< double >::iterator &first, std::vector< double >::iterator &last) |
| Median computation on a part of an array [first,last) | |
Static Private Member Functions | |
| static void | checkInputArrays_ (const std::vector< double > &mz_array, const std::vector< double > &int_array) |
| Throws Exception::InvalidParameter if the arrays are empty or differ in length. | |
Private Attributes | |
| double | window_length_ |
| Window length parameter. | |
Estimates the signal/noise (S/N) ratio of each data point in a scan by using the median (window based)
For each scan, we define a set of windows of a pre-defined size (param: window_length_) in m/z domain for which the intensity median is calculated. The noise for a data point is estimated to be the median of the intensities of the current window.
To get a more robust noise estimate, the nose value is calculated two times for two sets of windows that are shifted by 1/2 of the window size and the reported noise value is the average of the two.
A call to estimateNoise will return an object of type NoiseEstimator which then provides a function get_noise_value which will return the noise value for a given m/z value.
The idea behind this class is to have an estimator for signal to noise that gives similar results to SignalToNoiseEstimatorMedian but performs faster. Note that it will not give identical results as SignalToNoiseEstimatorMedian but for many application the results from this class will be sufficient.
|
inline |
default constructor
|
staticprivate |
Throws Exception::InvalidParameter if the arrays are empty or differ in length.
|
private |
Median computation on a part of an array [first,last)
|
private |
Computes the noise in windows for two input arrays and stores the median intensity in the result (internal)
The x-axis (mz_array) is partitioned into result.size() consecutive, non-overlapping windows of width window_length_ starting at mz_start. For each window the median of the intensities falling into it is stored in result. Windows whose median is exactly 0 (e.g. empty windows) receive an imputed fallback value derived from the mean and standard deviation of the whole intensity array.
| [in] | mz_array | Positions along the separation axis, in ascending (sorted) order. Units depend on the caller: Thomson (m/z) for spectra, seconds (retention time) for chromatograms. Must contain > 2 elements and have the same length as int_array. The values are only required to be monotonically non-decreasing (they are searched with std::lower_bound). |
| [in] | int_array | Intensities (arbitrary units, expected non-negative), one per mz_array entry, in the same order. Passed by value on purpose: computeMedian_ reorders it in place while selecting medians, so a private copy is required and the caller's array is left untouched. |
| [out] | result | Pre-sized (by the caller) to the number of windows to evaluate; its size alone determines how many windows are produced. On return, result[i] holds the noise estimate for the i-th window (same units as int_array): the median intensity of that window, or the imputed fallback value (see above) when that median is exactly 0. Window i spans the coordinate range [mz_start + i*window_length_, mz_start + (i+1)*window_length_). |
| [in] | mz_start | Position (same units as mz_array) of the left edge of the very first window. Typically mz_array.front() for the "even" set of windows, or mz_array.front() - window_length_/2 for the half-shifted "odd" set; hence it may legitimately lie below mz_array.front(). |
|
inline |
Compute noise estimator for an m/z and intensity array using windows.
Will return a noise estimator object.
| Exception::InvalidParameter | if the arrays are empty or differ in length |
References SignalToNoiseEstimatorMedianRapid::NoiseEstimator::result_windows_even, and SignalToNoiseEstimatorMedianRapid::NoiseEstimator::result_windows_odd.
|
inline |
Compute noise estimator for an m/z and intensity array using windows.
Will return a noise estimator object.
|
inline |
Compute noise estimator for an m/z and intensity array using windows.
Will return a noise estimator object.
|
private |
Window length parameter.