## create synthetic event signal
p <- sin(seq(0, 10 * pi, by = 0.35)) * 0.2 *
(1 + sin(seq(0, pi, length.out = 90)))^5
## show event signal
plot(p, type = "l")
## create synthetic noise signal
x <- runif(n = 1000, min = -1, max = 1)
t <- seq(from = Sys.time(), length.out = length(x), by = 1/200)
ii <- floor(runif(n = 3, min = 100, max = 900))
## add events to noise
for(k in 1:length(ii)) {
nn <- ii[k]:(ii[k] + 89)
x[nn] <- x[nn] + p
}
## show resulting time series
plot(x = t, y = x, type = "l")
## pick events based on template
picks <- eseis::pick_correlation(data = x,
on = 0.8,
template = p,
time = t,
dt = 1/200)
## show result
print(picks)
Run the code above in your browser using DataLab