A collection of background subtraction algorithms for spectroscopic data
To install the package, simply type "]
" followed up by "add BackgroundSubtraction
" in the Julia REPL.
The main function is based on the multi-component background learning model (MCBL), with the corresponding function mcbl
:
mcbl(A::AbstractMatrix, k::Int, x::AbstractVector, l::Real)
A
is the data matrix, each column of which is assumed to be a spectrogram.k
is the number of components in the multi-component background model.x
is the index vector corresponding to rows ofA
. For example, if a column ofA
is an X-ray diffraction spectrogram,x
should be the angle of diffraction of each row.l
is the length scale of the background component. It controls how quickly the background model is allowed to vary withx
. This functions as an important regularization for medium-sized data (100s-1000s spectrograms).
There are 3 parameters controlling the algorithm, which can optionally be passed as keyword arguments:
minres
is the minimum residual standard deviation after which the algorithms terminates.nsigma
is the number of standard deviations above the noise level after which a data point is classified as a peak. A smaller number will be more agressive in classifying points as peaks.maxiter
is the maximum number of iterations between updating the noise and background model.
If you use the MCBL for work or a publication, please cite the original article:
Ament, S.E., Stein, H.S., Guevarra, D. et al. Multi-component background learning automates signal detection for spectroscopic data. npj Comput Mater 5, 77 (2019). https://doi.org/10.1038/s41524-019-0213-0