Learn R Programming

eseis (version 0.8.1)

signal_snr: Calculate signal-to-noise-ratio (SNR).

Description

The function calculates the signal-to-noise ratio of an input signal vector as the ratio between mean and max.

Usage

signal_snr(
  data,
  scale = "lin",
  detrend = FALSE,
  envelope = FALSE,
  method = "max-mean"
)

Value

Numeric value, signal-to-noise ratio.

Arguments

data

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

scale

Character value, scale of the output. One out of "lin" (linear) and "dB" (decibel). Default is "lin".

detrend

Logical value, optionally detrend data set before calculating snr. Default is FALSE

envelope

Logical value, optionally calculate the signal envelope before calculating the SNR. Default is FALSE.

method

Character value, method used to calculate the SNR. Available methods are "max-mean" (Ratio of maximum and mean signal), "mean-sd" (Ratio of mean and standard deviation). Default is max-mean.

Author

Michael Dietze

Examples

Run this code

## load example data set
data(rockfall)

## remove mean and calculate envelope beforehand
x_prep <- signal_envelope(signal_detrend(rockfall_eseis))

## calculate snr
snr <- signal_snr(data = x_prep)
print(snr$snr)

## calculate snr with preprocessing during function call, and in dB scale
snr_dB <- signal_snr(data = rockfall_eseis, detrend = TRUE, 
                     envelope = TRUE, scale = "dB")
print(snr_dB$snr)

Run the code above in your browser using DataLab