filterbank_hilbert¶
- filterbank_hilbert(x, fs, Wn=[70, 150], spacing=0.14285714285714285, n_jobs=1)[source][source]¶
Compute the phase and amplitude (envelope) of a signal for a single frequency band, as in [#edwards]_. This is done using a filter bank of gaussian shaped filters with center frequencies linearly spaced until 4Hz and then logarithmically spaced. The Hilbert Transform of each filter’s output is computed and the amplitude and phase are computed from the complex values. See [#edwards]_ for details on the filter bank used.
See also
filter_hilbert- Parameters:
x (
np.ndarray,shape (time,channels)) – Signal to filter. Filtering is performed on each channel independently.fs (
int) – Sampling rate.Wn (
listorarray-like,length 2, default[70,150]) – Lower and upper boundaries for filterbank center frequencies. A range of [1, 150] results in 42 filters.n_jobs (
int, default1) – Number of jobs to use to compute filterbank across channels in parallel.
- Returns:
x_phase (
np.ndarray,shape (time,channels,frequency_bins)) – Phase of each frequency bin in the filter bank for each channel.x_envelope (
np.ndarray,shape (time,channels,frequency_bins)) – Envelope of each frequency bin in the filter bank for each channel.center_freqs (
np.ndarray,shape (frequency_bins,)) – Center frequencies for each frequency bin used in the filter bank.
Examples
>>> import numpy as np >>> x = np.random.rand(1000,3) # 3 channels of signals >>> fs = 500 >>> x_envelope = filterbank_hilbert(x, fs, Wn=[1, 150]) ... # the outputs have the phase and envelope for each channel and each ... # filter in the filterbank >>> x_envelope.shape # 3rd dimension is one for each filter in filterbank (1000, 3, 42) >>> filterbank_hilbert(x, fs, [1, 150], 1/10).shape (1000, 3, 58)