signal_filter function

Filter a seismic signal in the time or frequency domain

Filter a seismic signal in the time or frequency domain

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

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

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 rate 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. If omitted, no tapering will be done.

  • zero: Logical value, option to run filter in zero phase shift mode. Note that this will triple the length of the signal vector during calculation. Default is FALSE.

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

Returns

Numeric vector or list of vectors, filtered signal vector.

Examples

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

Author(s)

Michael Dietze

  • Maintainer: Michael Dietze
  • License: GPL-3
  • Last published: 2025-03-25

Useful links