Skip to content
heliaEDGE
Reference
HELIA

snr

Signal-to-Noise Ratio (SNR) metric where y_true: signal, y_pred: signal + noise

Classes

Name Description
Snr Computes the Signal-to-Noise Ratio (SNR) in dB.

Machine-readable model

class

Snr

Python

helia_edge/metrics/snr.py:15

Snr(name='snr', **kwargs={})

Signal-to-Noise Ratio (SNR) metric where y_true: signal y_pred: signal + noise

Example:

# Create 4-second sine wave w/ freq=4, amplitude=1, Fs=1000Hz
t = np.linspace(0, 4, 4 * 1000, endpoint=False)
x = np.sin(2 * np.pi * 4 * t)
# Add random noise with amplitude 0.1
noise = np.random.normal(0, 0.1, len(t))
y = x + noise
import helia_edge as helia
snr = helia.metrics.Snr()
snr.update_state(x, y)
print(snr.result())
Parameters of Snr
NameTypeDefaultDescription
namestr'snr'Name of the metric. Defaults to 'snr'.