data(tea)
new.lambdas <- seq(260, 500, by = 2)
tea <- lapply(tea.raw, preprocess, dim2 = new.lambdas)
tea.split <- splitTimeWindow(tea, c(12, 14), overlap = 10)
Xl <- tea.split[[2]]
Xl.opa <- opa(Xl, 4)
Xl.als <- doALS(Xl, Xl.opa)
tpoints <- getTime(Xl.als)
plot(tpoints, Xl.als$CList[[2]][,2], type = "l", col = "gray")
pk.pos <- findpeaks(Xl.als$CList[[2]][,2], span = 11)
abline(v = tpoints[pk.pos], col = 4)
pks <- fitpeaks(Xl.als$CList[[2]][,2], pk.pos)
apply(pks, 1,
function(pkmodel) {
lines(tpoints,
dnorm(1:length(tpoints), pkmodel["rt"], pkmodel["sd"]) *
pkmodel["area"],
col = 2)
invisible()
})
## reasonably close fit, apart from the small peak in the middle...
Run the code above in your browser using DataLab