BandPass

class torch_ecg.preprocessors.BandPass(fs: Real, lowcut: Real | None = 0.5, highcut: Real | None = 45, inplace: bool = True, **kwargs: Any)[source]

Bases: Module

Bandpass filtering preprocessor.

Parameters:
  • fs (numbers.Real) – Sampling frequency of the ECG signal to be filtered.

  • lowcut (numbers.Real, optional) – Low cutoff frequency.

  • highcut (numbers.Real, optional) – High cutoff frequency.

  • inplace (bool, default True) – Whether to perform the filtering in-place.

  • kwargs (dict, optional) – Other keyword arguments for torch.nn.Module.

forward(sig: Tensor) Tensor[source]

Apply the preprocessor to the signal tensor.

Parameters:

sig (torch.Tensor) – The ECG signal tensor, of shape (batch, lead, siglen).

Returns:

The bandpass filtered ECG signal tensor, of shape (batch, lead, siglen).

Return type:

torch.Tensor