lfp_phase_coherence#
- class braintools.metric.lfp_phase_coherence(lfp_signals, dt, freq_band=(8, 12))#
Compute pairwise phase coherence between LFP channels in a frequency band.
For each channel the band-limited analytic signal is built (Hilbert construction), and the pairwise phase-locking value
\[\text{PLV}_{ij} = \left| \frac{1}{T} \sum_t e^{\,i(\phi_i(t) - \phi_j(t))} \right|\]is returned for every channel pair.
- Parameters:
lfp_signals (
Array|ndarray|bool|number|bool|int|float|complex|Quantity) – Multiple LFP signals with shape(n_time, n_channels).dt (
float|Quantity) – Sampling interval (seconds if a float; converted if aQuantity).freq_band (
Tuple[float,float]) – Frequency band (Hz) for phase extraction (e.g. the alpha band).
- Returns:
phase_coherence_matrix – Symmetric coherence matrix with shape
(n_channels, n_channels)and values in[0, 1](diagonal exactly 1).- Return type:
Array
Notes
The phase of a channel that carries negligible power in
freq_bandis undefined. Such channels are detected (in-band power negligible relative to their broadband power) and their off-diagonal coherence is reported as0rather than a spurious value (a zero band-limited signal would otherwise appear perfectly phase-locked).