pybispectra.cfc.PPC#

class pybispectra.cfc.PPC(data: ndarray, freqs: ndarray, sampling_freq: int | float, verbose: bool = True)[source]#

Class for computing phase-phase coupling (PPC).

Parameters:
datandarray of float, shape of [epochs, channels, frequencies]

Fourier coefficients.

freqsndarray of float, shape of [frequencies]

Frequencies (in Hz) in data. Frequencies are expected to be evenly spaced.

sampling_freqint | float

Sampling frequency (in Hz) of the data from which data was derived.

verbosebool (default True)

Whether or not to report the progress of the processing.

Attributes:
resultstuple of ResultsCFC

Return the results.

datandarray of float, shape of [epochs, channels, frequencies]

Fourier coefficients.

freqsndarray of float, shape of [frequencies]

Frequencies (in Hz) in data.

sampling_freqint | float

Sampling frequency (in Hz) of the data from which data was derived.

verbosebool

Whether or not to report the progress of the processing.

Methods

compute([indices, f1s, f2s, n_jobs])

Compute PPC, averaged over epochs.

copy()

Return a copy of the object.

compute(indices: tuple[tuple[int]] | None = None, f1s: tuple[int | float] | None = None, f2s: tuple[int | float] | None = None, n_jobs: int = 1) None[source]#

Compute PPC, averaged over epochs.

Parameters:
indicestuple of tuple of int, length of 2 | None (default None)

Indices of the seed and target channels, respectively, to compute PPC between. If None, coupling between all channels is computed.

f1stuple of int or float, length of 2 | None (default None)

Start and end lower frequencies to compute PPC on, respectively. If None, all frequencies are used.

f2stuple of int or float, length of 2 | None (default None)

Start and end higher frequencies to compute PPC on, respectively. If None, all frequencies are used.

n_jobsint (default 1)

Number of jobs to run in parallel. If -1, all available CPUs are used.

Notes

PPC is computed as coherence between frequencies [1]

\(\textrm{PPC}(\textbf{x}_{f_1},\textbf{y}_{f_2})=\Large \frac{| \langle\textbf{a}_x(f_1)\textbf{a}_y(f_2) e^{i(\boldsymbol{\varphi}_x (f_1)\frac{f_2}{f_1}-\boldsymbol{\varphi}_y(f_2))} \rangle|}{\langle \textbf{a}_x(f_1)\textbf{a}_y(f_2) \rangle}\) ,

where \(\textbf{a}(f)\) and \(\boldsymbol{\varphi}(f)\) are the amplitude and phase of a signal at a given frequency, respectively; \(f_1\) and \(f_2\) correspond to a lower and higher frequency, respectively; and \(<>\) represents the average value over epochs.

PPC is computed between all values of f1s and f2s. If any value of f1s is higher than f2s, a numpy.nan value is returned.

References

copy()[source]#

Return a copy of the object.

property results: ResultsCFC#

Return the results.

Returns:
resultsResultsCFC

The results of the PPC computation.