Learn R Programming

eseis (version 0.7.3)

pick_correlation: Signal correlation based event picking

Description

The function picks (identifies) events from continuous data by comparing the data patterns against a template signal using Pearson's correlation coefficient, defining an event when that coefficient is above a threshold value.

Usage

pick_correlation(data, on, template, dur_min, time, dt)

Value

data.frame, picked events.

Arguments

data

eseis object, numeric vector or list of objects, data set to be processed.

on

Numeric value, minimum correlation coefficient to define event occurence.

template

eseis object or signal vector, template event with which the data set is correlated.

dur_min

Numeric value, minimum duration of the event. This is required as the routine tends to identify multipe picks with similarly high correlation coefficients due to autocorrelation effects. If omitted, dur_min is set to 0, i.e., all picks are returned.

time

POSIXct vector, time vector of the signal(s). If not provided, a synthetic time vector will be created.

dt

Numeric value, sampling period. If omitted, either estimated from time or set to 0.01 s (i.e., f = 100 Hz).

Author

Michael Dietze

Examples

Run this code

## 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