torch_ecg.utils.resample_t

torch_ecg.utils.resample_t(sig: Tensor, fs: int | None = None, dst_fs: int | None = None, siglen: int | None = None, inplace: bool = False) Tensor

Resample signal tensors to a new sampling frequency or a new signal length.

Parameters:
  • sig (torch.Tensor) – Signal to be normalized, assumed to have shape (..., n_leads, siglen).

  • fs (int, optional) – Sampling frequency of the source signal to be resampled.

  • dst_fs (int, optional) – Sampling frequency of the resampled signal.

  • siglen (int, optional) – Number of samples in the resampled signal. NOTE that one of only one of dst_fs (with fs) and siglen should be set.

  • inplace (bool, default False) – Whether to perform the operation in-place or not.

Returns:

The resampled signal, of shape (..., n_leads, siglen).

Return type:

torch.Tensor