BandPass#
- class torch_ecg.preprocessors.BandPass(fs: Real, lowcut: Real | None = 0.5, highcut: Real | None = 45, inplace: bool = True, **kwargs: Any)[source]#
Bases:
ModuleBandpass 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: ndarray | Tensor) ndarray | Tensor[source]#
Apply the preprocessor to the signal.
- Parameters:
sig (numpy.ndarray or torch.Tensor) – The ECG signal, of shape
(batch, lead, siglen)or(lead, siglen).- Returns:
The bandpass filtered ECG signal, of same shape and type as sig.
- Return type: