elephant.phase_analysis.phase_locking_value

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

Calculates the phase locking value (PLV) (Lachaux et al., 1999).

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.

Parameters:
phases_i, phases_j(t, n) np.ndarray

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

Returns:
plv(t,) np.ndarray

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

Raises:
ValueError

If the shapes of phases_i and phases_j are different.

Notes

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

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

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