torch_ecg.utils.get_ampl

torch_ecg.utils.get_ampl(sig: numpy.ndarray, fs: numbers.Real, fmt: str = 'lead_first', window: numbers.Real = 0.2, critical_points: Optional[Sequence] = None) Union[float, numpy.ndarray][source]

Get amplitude of a signal (near critical points if given).

Parameters
  • sig (numpy.ndarray) – (ECG) signal.

  • fs (numbers.Real) – Sampling frequency of the signal

  • fmt (str, default "lead_first") – Format of the signal, can be “channel_last” (alias “lead_last”), or “channel_first” (alias “lead_first”). Ignored if sig is 1d array (single-lead).

  • window (int, default 0.2) – Window length of a window for computing amplitude, with units in seconds.

  • critical_points (numpy.ndarray, optional) – Positions of critical points near which to compute amplitude, e.g. can be rpeaks, t peaks, etc.

Returns

ampl – Amplitude of the signal.

Return type

float or numpy.ndarray