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

View source: R/signal_snr.R

signal_snrR Documentation

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

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.

Value

Numeric value, signal-to-noise ratio.

Author(s)

Michael Dietze

Examples


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


eseis documentation built on April 3, 2025, 10:57 p.m.