✦ Day 16 · Complex Signal Analysis

The Hilbert Transform
& Analytic Signals

Convert real-valued neural oscillations into complex space to extract instantaneous amplitude envelopes and phase trajectories millisecond by millisecond.

🔄 90-Degree Phase Shift 📈 Amplitude Envelope 🧠 Instantaneous Phase 🐍 scipy.signal.hilbert 📖 Cohen ANTS Ch. 14

The Hilbert Transform converts a real-valued narrowband EEG signal into a complex analytic signal. This mathematical transformation separates a continuous oscillation into two instantaneous, time-varying properties: its amplitude envelope (how strong the oscillation is at each millisecond) and its instantaneous phase (where the wave is in its cycle: peak, trough, or slope).


1

The Analytic Signal
Real + j · Imaginary

Given a real narrowband signal x(t), the Hilbert transform produces a 90° phase-shifted signal xH(t). Combining them forms the complex analytic signal:

z(t) = x(t) + i · xH(t) = A(t) · exp(i · φ(t))

Instantaneous Amplitude A(t): np.abs(z) — the envelope of the signal.
Instantaneous Phase φ(t): np.angle(z) — values from −π to +π.

Filter-Hilbert vs Wavelet Equivalence (Cohen ANTS Ch. 14): Bandpass filtering a signal followed by a Hilbert transform yields mathematically equivalent amplitude and phase estimates to Morlet wavelet convolution, provided the filter kernel matches the Gaussian shape of the wavelet!


2

Python Implementation
Filtering and Extracting Envelopes

Python
from scipy.signal import hilbert
import numpy as np

# 1. Bandpass filter in narrow frequency range (e.g. Alpha 8-12 Hz)
raw_alpha = raw.copy().filter(l_freq=8.0, h_freq=12.0)
signal = raw_alpha.get_data(picks='Oz')[0]

# 2. Compute analytic signal
analytic = hilbert(signal)

# 3. Extract envelope and phase
amplitude_envelope = np.abs(analytic)
instantaneous_phase = np.angle(analytic)

# Power is envelope squared
instantaneous_power = amplitude_envelope ** 2

Mandatory Rule: Never apply the Hilbert transform to broadband data! Without narrow bandpass filtering first, the concept of instantaneous phase and amplitude becomes mathematically undefined and produces meaningless noise.