torch_ecg.utils.resample_t

torch_ecg.utils.resample_t(sig: torch.Tensor, fs: Optional[int] = None, dst_fs: Optional[int] = None, siglen: Optional[int] = None, inplace: bool = False) torch.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