Vespucci  1.0.0
Vespucci::Math::PeakFinding Namespace Reference

A namespace for math functions relating to peak detection and counting. More...

Functions

VESPUCCI_EXPORT arma::uvec FindPeakCenters (const arma::vec &signal, const arma::vec &abscissa, std::list< arma::umat > &ridges, arma::uword first_scale, arma::uword last_scale, arma::uword search_window, arma::uword min_length, arma::uword max_gap, const std::string &max_method)
 
VESPUCCI_EXPORT arma::vec DerivGaussKernel (double abscissa_step, arma::uword window_size, arma::uword width, double height)
 
VESPUCCI_EXPORT arma::vec MexicanHatKernel (double abscissa_step, arma::uword window_size, arma::uword width, double height)
 
VESPUCCI_EXPORT arma::uvec FindIntercepts (const arma::vec &signal)
 
VESPUCCI_EXPORT arma::vec FindPeaks (arma::vec X, arma::vec dX, double sel, double threshold, arma::vec &peak_magnitudes)
 Vespucci::Math::PeakFinding::FindPeaks an implementation of the peakfinder arma::mat routine. More...
 
VESPUCCI_EXPORT arma::uvec FindPeakPositions (arma::vec X, arma::vec dX, double sel, double threshold, arma::uvec &local_minima)
 
VESPUCCI_EXPORT arma::mat FindPeaksMat (arma::mat X, double sel, double threshold, arma::uword poly_order, arma::uword window_size, arma::mat &peak_magnitudes)
 Vespucci::Math::PeakFinding::FindPeaksMat Performs FindPeaks on a spectra arma::matrix. More...
 
VESPUCCI_EXPORT arma::vec EstimateBaseline (arma::vec X, arma::umat peaks, arma::uword window_size)
 EstimateBaseline. More...
 
VESPUCCI_EXPORT arma::umat FindPeakPositions (arma::vec X, arma::vec dX, double threshold, std::string threshold_method, arma::vec &peak_magnitudes)
 Vespucci::Math::PeakFinding::FindPeakPositions. More...
 
VESPUCCI_EXPORT arma::vec PeakPopulation (arma::uword vector_size, arma::umat peak_positions)
 
VESPUCCI_EXPORT arma::vec PeakExtrema (arma::uword vector_size, arma::umat peak_positions)
 

Detailed Description

A namespace for math functions relating to peak detection and counting.

Function Documentation

VESPUCCI_EXPORT arma::vec Vespucci::Math::PeakFinding::DerivGaussKernel ( double  abscissa_step,
arma::uword  window_size,
arma::uword  width,
double  height 
)
arma::vec Vespucci::Math::PeakFinding::EstimateBaseline ( arma::vec  X,
arma::umat  peaks,
arma::uword  window_size 
)

EstimateBaseline.

Parameters
XSignal
peaksPositions of peaks to exclude from spectrum to calculate baseline
window_sizeSize of local minimum filter applied to baseline
Returns

Definition at line 351 of file peakfinding.cpp.

VESPUCCI_EXPORT arma::uvec Vespucci::Math::PeakFinding::FindIntercepts ( const arma::vec &  signal)
VESPUCCI_EXPORT arma::uvec Vespucci::Math::PeakFinding::FindPeakCenters ( const arma::vec &  signal,
const arma::vec &  abscissa,
std::list< arma::umat > &  ridges,
arma::uword  first_scale,
arma::uword  last_scale,
arma::uword  search_window,
arma::uword  min_length,
arma::uword  max_gap,
const std::string &  max_method 
)
VESPUCCI_EXPORT arma::uvec Vespucci::Math::PeakFinding::FindPeakPositions ( arma::vec  X,
arma::vec  dX,
double  sel,
double  threshold,
arma::uvec &  local_minima 
)
arma::umat Vespucci::Math::PeakFinding::FindPeakPositions ( arma::vec  X,
arma::vec  dX,
double  threshold,
std::string  threshold_method,
arma::vec &  peak_magnitudes 
)

Vespucci::Math::PeakFinding::FindPeakPositions.

Parameters
X
dXA buffered first derivative (same size of X with value of X(i) equal to the derivative of X at i. Taken as a parameter incase a smoothed derivative is to be used
thresholdA value for threshold of significance. Depending on type
threshold_methodDescribes the method to be used (see below)
Returns
A arma::umat in which each row represents a peak. The first column contains indices of peak centers, the second column contains the left bound of the peak and the third column contains the right bound of the peak. A arma::matrix of this forarma::mat is the expected input for Vespucci::Math::PeakFinding::EstimateBaseline. The peak determination may be carried out on a transformed spectra (such as heavy S-G smoothing, kernel convolution or CWT) then EstimateBaseline called with these peak centers and the original spectrum. EstimateBaseline will then exclude the larger peaks from the baseline. Since EstimateBaseline uses a local minimum filter, smaller peaks will be retained while preventing wider peaks from being cut into by the filter.

threshold_method can be the following: "magnitude" - a minimum peak-height threshold, arbitrary double "count" - maximum number of peaks found, largest magnitude first (1 to many) "countpercentage" - largest percentage of all peaks found (0 to 1) "ratio" - ratio of largest magnitude (0 to 1)

Definition at line 201 of file peakfinding.cpp.

arma::vec Vespucci::Math::PeakFinding::FindPeaks ( arma::vec  X,
arma::vec  dX,
double  sel,
double  threshold,
arma::vec &  peak_magnitudes 
)

Vespucci::Math::PeakFinding::FindPeaks an implementation of the peakfinder arma::mat routine.

Parameters
XA vector representing a spectrum
dXA first-derivative spectrum of X
selThe amount above surrounding data for a peak to be identified
thresholdA threshold value which peaks must be larger than to be maxima
poly_orderThe polynomial order of the Savitzky-Golay filter used for derivatization
window_sizeThe window size of the Savitzky-Golay filter used for derivatization
peak_locationsA vector containing one and arma::zeros corresponding to whether or not a peak center exists at that wavelength
peak_magnitudesA vector containing values at peak centers.
Returns

Definition at line 44 of file peakfinding.cpp.

arma::mat Vespucci::Math::PeakFinding::FindPeaksMat ( arma::mat  X,
double  sel,
double  threshold,
arma::uword  poly_order,
arma::uword  window_size,
arma::mat &  peak_magnitudes 
)

Vespucci::Math::PeakFinding::FindPeaksMat Performs FindPeaks on a spectra arma::matrix.

Parameters
x
sel
threshold
poly_order
window_size
peak_locations
peak_magnitudes
Returns

Definition at line 131 of file peakfinding.cpp.

VESPUCCI_EXPORT arma::vec Vespucci::Math::PeakFinding::MexicanHatKernel ( double  abscissa_step,
arma::uword  window_size,
arma::uword  width,
double  height 
)
arma::vec Vespucci::Math::PeakFinding::PeakExtrema ( arma::uword  vector_size,
arma::umat  peak_positions 
)

Definition at line 327 of file peakfinding.cpp.

arma::vec Vespucci::Math::PeakFinding::PeakPopulation ( arma::uword  vector_size,
arma::umat  peak_positions 
)

Definition at line 318 of file peakfinding.cpp.