savgol: Apply a Savitzky-Golay algorithm to smooth thermoluminescence...

View source: R/savgol.R

savgolR Documentation

Apply a Savitzky-Golay algorithm to smooth thermoluminescence glow curves

Description

Smooth thermoluminescence glow curves with a Savitzky-Golay smoothing filter and calculate derivatives.

Usage

savgol(y, drv, hwd = 3 * (drv + 2), pod = 4)

Arguments

y

numeric(required): the data to be filtered

drv

integer(required): the order of the derivative to be calculated

hwd

integer(with default): half width of the segement used for filter

pod

integer(with default): order of the polynomial used for filter

Details

The Savitzky-Golay smoothing algorithm is particularly good at preserving lineshape while removing high frequency squiggles (Press et al., 1986). The procedure can be used to calculate derivatives of thermoluminescence data to identify the location of glow peaks.

Value

The filtered signal, which has the same length as y.

References

Press WH, Teukolsky SA, Vetterling WT, Flannery BP, 1986. Numberic recipes in Fortran 77, the Art of Scientific Computing, second edition.

See Also

tgcd

Examples

 library(tgcd)
 data(Refglow)

 x <- Refglow$x009[,1]
 y <- Refglow$x009[,2]
 y0 <- savgol(y, drv=0)
 dy <- savgol(y, drv=1)

 plot(x, y, type="p", pch=21, bg="black")
 points(x, y0, type="l", col="blue", lwd=2)

 plot(x, dy, type="l", col="blue", lwd=2)
 abline(h=0, lty="dashed", col="red", lwd=2)


tgcd documentation built on Sept. 8, 2023, 6:10 p.m.