sablib
Loading...
Searching...
No Matches
snip.h File Reference

Baseline estimation using Statistics-sensitive Non-linear Iterative Peak-clipping(SNIP). More...

#include <stdexcept>
#include <vector>

Go to the source code of this file.

Enumerations

enum class  sablib::SnipPreprocess { None , LL , LLS }
 Preprocessing types for the SNIP algorithm. More...

Functions

const std::vector< double > sablib::BaselineSnip (const std::vector< double > &y, const unsigned int m, const bool decreasing=true, const SnipPreprocess preprocess=SnipPreprocess::None, const unsigned int loop=1)
 Performs baseline estimation using the Statistics-sensitive Non-linear Iterative Peak-clipping (SNIP) algorithm.

Detailed Description

Baseline estimation using Statistics-sensitive Non-linear Iterative Peak-clipping(SNIP).

Author
Izadori

References:

  • Ryan, C. G.; Clayton, E.; Griffin, W. L.; Sie, S. H.; Cousens, D. R. "SNIP, A Statistics-sensitive Background Treatment for the Quantitative Analysis of PIXE Spectra in Geoscience Applications" Nuclear Instruments and Methods in Physics Research, 1988, B34(3), 396-402.
  • Caccia, M.; Ebolese, A.; Matteo, M.; Santro, R.; Locatteli, M.; Pieracci, M.; Tintori, C. "Background removal procedure based on the SNIP algorithm for γ−ray spectroscopy with the CAEN Educational Kit" Educational Note ED3163; CAEN S.p.A.: Viareggio, Italy, 2021.

Definition in file snip.h.

Enumeration Type Documentation

◆ SnipPreprocess

enum class sablib::SnipPreprocess
strong

Preprocessing types for the SNIP algorithm.

SNIP often works better when the data is transformed to stabilize the variance or handle high dynamic range peaks.

Enumerator
None 

No preprocessing (linear scale).

LL 

Log-log transformation: v = log(log(y + 1) + 1). Useful for large dynamic ranges.

LLS 

Log-log-sqrt transformation: v = log(log(sqrt(y + 1) + 1) + 1). More aggressive variance stabilization.

Definition at line 25 of file snip.h.

Function Documentation

◆ BaselineSnip()

const std::vector< double > sablib::BaselineSnip ( const std::vector< double > & y,
const unsigned int m,
const bool decreasing = true,
const SnipPreprocess preprocess = SnipPreprocess::None,
const unsigned int loop = 1 )

Performs baseline estimation using the Statistics-sensitive Non-linear Iterative Peak-clipping (SNIP) algorithm.

Parameters
yThe input data vector (signal to be processed).
mThe maximum half-window size (maximum clipping distance).
decreasingIf true, iterates from m down to 1 (recommended). If false, iterates from 1 up to m.
preprocessThe preprocessing transformation to apply before clipping (None, LL, or LLS).
loopThe number of times to repeat the entire SNIP process (usually 1 is sufficient).
Returns
A vector of the estimated baseline.
Exceptions
std::invalid_argumentOne or more parameters are wrong.

Definition at line 17 of file snip.cpp.