PreProcessor

class torch_ecg._preprocessors.PreProcessor[source]

Bases: ReprMixin, ABC

Base class for preprocessors.

abstract apply(sig: ndarray, fs: Real) Tuple[ndarray, int][source]

Apply the preprocessor to sig.

Parameters:
  • sig (numpy.ndarray) –

    The ECG signal, can be
    • 1d array, which is a single-lead ECG;

    • 2d array, which is a multi-lead ECG of “lead_first” format;

    • 3d array, which is a tensor of several ECGs, of shape (batch, lead, siglen).

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