BirdSongToolbox.preprocess.hilbert_module¶
-
BirdSongToolbox.preprocess.
hilbert_module
(neural_data, output: str, smooth=False)¶ Use the Hilbert Transform to get either the Amplitude or Phase of the Input Neural Data
- Parameters
- neural_datandarray | shape (…, Samples)
Input Neural Activity during all Trials
- outputstr
String that instructs what information to extract from the analytical signal, options: ‘phase’, ‘amplitude’
- smoothbool, optional
If True the instantaneous phase will be passed through a sine function, defaults to False
- Returns
- hilbert_results: ndarray | shape (…, Samples)
- Depending on the output parameter:
‘phase’: Instantaneous Phase of the Input Neural Activity in radians ‘amplitude’: Envelope (Amplitude) of the Input Neural Activity
Notes
The analytic signal
x_a(t)
of signalx(t)
is:\[x_a = F^{-1}(F(x) 2U) = x + i y\]where F is the Fourier transform, U the unit step function, and y the Hilbert transform of x. [1]_
In other words, the negative half of the frequency spectrum is zeroed out, turning the real-valued signal into a complex signal. The Hilbert transformed signal can be obtained from
np.imag(hilbert(x))
, and the original signal fromnp.real(hilbert(x))
.