hilbert#
- class diffsptk.HilbertTransform(fft_length: int, dim: int = -1, device: device | None = None, dtype: dtype | None = None)[source]#
Hilbert transform module.
- Parameters:
- fft_lengthint >= 1
The number of FFT bins.
- dimint
The dimension along which to take the Hilbert transform.
- devicetorch.device or None
The device of this module.
- dtypetorch.dtype or None
The data type of this module.
- forward(x: Tensor) Tensor [source]#
Compute the analytic signal using the Hilbert transform.
- Parameters:
- xTensor [shape=(…, T, …)]
The input signal.
- Returns:
- outTensor [shape=(…, T, …)]
The analytic signal, where the real part is the input signal and the imaginary part is the Hilbert transform of the input signal.
Examples
>>> import diffsptk >>> hilbert = diffsptk.HilbertTransform(4) >>> x = diffsptk.ramp(3) >>> z = hilbert(x) >>> z.real tensor([0., 1., 2., 3.]) >>> z.imag tensor([ 1., -1., -1., 1.])
- diffsptk.functional.hilbert(x: Tensor, fft_length: int | None = None, dim: int = -1) Tensor [source]#
Compute the analytic signal using the Hilbert transform.
- Parameters:
- xTensor [shape=(…, T, …)]
The input signal.
- fft_lengthint >= 1 or None
The number of FFT bins. If None, set to \(T\).
- dimint
The dimension along which to take the Hilbert transform.
- Returns:
- outTensor [shape=(…, T, …)]
The analytic signal.
See also