From 7894dde92ec2349df568d449f31b12d74d18d833 Mon Sep 17 00:00:00 2001 From: Stefano Moia Date: Tue, 8 Oct 2024 15:40:27 +0200 Subject: [PATCH] Add metric to show maximum amplitude in signal --- physioqc/metrics/multimodal.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/physioqc/metrics/multimodal.py b/physioqc/metrics/multimodal.py index 31a456f..021f5af 100644 --- a/physioqc/metrics/multimodal.py +++ b/physioqc/metrics/multimodal.py @@ -142,7 +142,25 @@ def max(signal: np.array): @physio_or_numpy -def iqr(signal: np.array, q_high: float = 75, q_low: float = 25): +def max_amplitude(signal: np.array): + """ + Calculate max across input channels of signal. + + Parameters + ---------- + signal : np.array or peakdet Physio object + Physiological data + + Returns + ------- + N-sized array :obj:`numpy.ndarray` + max of signal. + """ + return np.max(signal, axis=0) - np.min(signal, axis=0) + + +@physio_or_numpy +def IQR(signal: np.array, q_high: float = 75, q_low: float = 25): """Calculate the Inter Quantile Range (IQR) over the input signal. Parameters