Learn R Programming

eseis (version 0.6.0)

signal_filter: Filter a seismic signal in the time or frequency domain

Description

The function filters the input signal vector in the time or frequency domain.

Usage

signal_filter(
  data,
  f,
  fft = FALSE,
  dt,
  type,
  shape = "butter",
  order = 2,
  p = 0,
  lazy = FALSE
)

Value

Numeric vector or list of vectors, filtered signal vector.

Arguments

data

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

f

Numeric value or vector of length two, lower and/or upper cutoff frequencies (Hz).

fft

Logical value, option to filter in the time domain (fft = FALSE) or the frequency domain (fft = TRUE). Default is (fft = FALSE).

dt

Numeric value, sampling period. If omitted, dt is set to 1/200.

type

Character value, type of filter, one out of "LP" (low pass), "HP" (high pass), "BP" (band pass) and "BR" (band rejection). If omitted, the type is interpreted from f. If f is of length two, type is set to "BP". If f is of length one, type is set to "HP".

shape

Character value, one out of "butter" (Butterworth), default is "butter".

order

Numeric value, order of the filter, default is 2. Only needed if data is no eseis object.

p

Numeric value, fraction of the signal to be tapered.

lazy

Logical value, option to pre- and post-process data, including detrending, demeaning and tapering (p = 0.02). Default if FALSE.

Author

Michael Dietze

Examples

Run this code

## load example data set
data(rockfall)

## filter data set by bandpass filter between 1 and 90 Hz
rockfall_bp <- signal_filter(data = rockfall_eseis, 
                             f = c(1, 90))
                             
## taper signal to account for edge effects
rockfall_bp <- signal_taper(data = rockfall_bp, 
                            n = 2000)

## plot filtered signal
plot_signal(data = rockfall_bp)

## compare time domain versus frequency domain filtering
rockfall_td <- signal_filter(data = rockfall_eseis, 
                             f = c(10, 40), 
                             fft = FALSE)
                             
rockfall_td_sp <- signal_spectrum(data = rockfall_td)

rockfall_fd <- signal_filter(data = rockfall_eseis, 
                             f = c(10, 40), 
                             fft = TRUE)
                             
rockfall_fd_sp <- signal_spectrum(data = rockfall_fd)

plot_spectrum(data = rockfall_td_sp)
plot_spectrum(data = rockfall_fd_sp)
                     

Run the code above in your browser using DataLab