torch_ecg.utils.butter_bandpass_filter

torch_ecg.utils.butter_bandpass_filter(data: ndarray, lowcut: Real, highcut: Real, fs: Real, order: int, btype: str | None = None, verbose: int = 0) ndarray[source]

Butterworth bandpass filtering the signals.

Apply a Butterworth bandpass filter to the signal. For references, see [1] and [2].

Parameters:
  • data (numpy.ndarray) – Signal to be filtered.

  • lowcut (numbers.real) – Low cutoff frequency.

  • highcut (numbers.real) – High cutoff frequency.

  • fs (numbers.real) – Frequency of the signal.

  • order (int) – Order of the filter.

  • btype ({"lohi", "hilo"}, optional) – (special) type of the filter. Ignored for lowpass and highpass filters (as defined by lowcut and highcut).

  • verbose (int, default 0) – Verbosity level for printing.

Returns:

y – The filtered signal.

Return type:

numpy.ndarray

References