def _my_hilbert(x, n_fft=None, envelope=False):
""" Compute Hilbert transform of signals w/ zero padding.
Parameters
----------
x : array, shape (n_times)
The signal to convert
n_fft : int, length > x.shape[-1] | None
How much to pad the signal before Hilbert transform.
Note that signal will then be cut back to original length.
envelope : bool
Whether to compute amplitude of the hilbert transform in order
to return the signal envelope.
Returns
-------
out : array, shape (n_times)
The hilbert transform of the signal, or the envelope.
"""
from scipy.signal import hilbert
n_fft = x.shape[-1] if n_fft is None else n_fft
n_x = x.shape[-1]
out = hilbert(x, N=n_fft)[:n_x]
if envelope is True:
out = np.abs(out)
return out
base.py 文件源码
python
阅读 20
收藏 0
点赞 0
评论 0
评论列表
文章目录