elephant.phase_analysis.phase_locking_value(phases_i, phases_j)[source]

Calculates the phase locking value (PLV).

This function expects the phases of two signals (each containing multiple trials). For each trial pair, it calculates the phase difference at each time point. Then it calculates the mean vectors of those phase differences across all trials. The PLV at time t is the length of the corresponding mean vector.

phases_i, phases_j(t, n) np.ndarray

Time-series of the first and second signals, with t time points and n trials.

plv(t,) np.ndarray

Vector of floats with the phase-locking value at each time point. Range: [0, 1]


If the shapes of phases_i and phases_j are different.


This implementation is based on the formula taken from [1] (pp. 195):

PLV_t = \frac{1}{N} \left |
\sum_{n=1}^N \exp(i \cdot \theta(t, n)) \right | \\

where \theta(t, n) = \phi_x(t, n) - \phi_y(t, n) is the phase difference at time t for trial n.


[1] Jean-Philippe Lachaux, Eugenio Rodriguez, Jacques Martinerie, and Francisco J. Varela, “Measuring Phase Synchrony in Brain Signals” Human Brain Mapping, vol 8, pp. 194-208, 1999.