pybispectra.cfc.PPC#
- class pybispectra.cfc.PPC(data: ndarray, freqs: ndarray, sampling_freq: int | float, times: ndarray | None = None, verbose: bool = True)[source]#
Class for computing phase-phase coupling (PPC).
- Parameters:
- data
ndarrayoffloat, shape of [epochs, channels, frequencies, times] Fourier coefficients of the time-frequency representation (TFR) of data.
Changed in version 1.3: Requires TFR coefficients instead of non-time-resolved coefficients.
- freqs
ndarrayoffloat, shape of [frequencies] Frequencies (in Hz) in
data. Frequencies are expected to be evenly spaced.- sampling_freq
int|float Sampling frequency (in Hz) of the data from which
datawas derived.- times
ndarray, shape of [times] |None Timepoints (in seconds) in
data. Ifdatahas a times dimension andtimes = None, the time of the first sample indatais assumed to be 0 seconds.Added in version 1.3.
- verbose
bool(defaultTrue) Whether or not to report the progress of the processing.
- data
- Attributes:
- results
ResultsCFC PPC results.
- data
ndarrayoffloat, shape of [epochs, channels, frequencies, times] Fourier coefficients of the TFR of data.
- freqs
ndarrayoffloat, shape of [frequencies] Frequencies (in Hz) in
data.- sampling_freq
int|float Sampling frequency (in Hz) of the data from which
datawas derived.- times
ndarray, shape of [times] |None Timepoints (in seconds) in
data.- verbose
bool Whether or not to report the progress of the processing.
- results
Methods
compute([indices, f1s, f2s, times, 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, times: tuple[int | float] | None = None, n_jobs: int = 1) None[source]#
Compute PPC, averaged over epochs.
- Parameters:
- indices
tupleoftupleofint, length of 2 |None(defaultNone) Indices of the seed and target channels, respectively, to compute PPC between. If
None, coupling between all channels is computed.- f1s
tupleofintorfloat, length of 2 |None(defaultNone) Start and end lower frequencies to compute PPC on, respectively. If
None, all frequencies are used.- f2s
tupleofintorfloat, length of 2 |None(defaultNone) Start and end higher frequencies to compute PPC on, respectively. If
None, all frequencies are used.- times
tupleofintorfloat, length of 2 |None(defaultNone) Start and end times (in seconds) to compute PPC on, respectively. If
None, all timepoints are used.Added in version 1.3.
- n_jobs
int(default1) Number of jobs to run in parallel. If
-1, all available CPUs are used.
- indices
Notes
PPC is computed as coherence between frequencies [1]
\(\textrm{PPC}(\textbf{x}_{f_1},\textbf{y}_{f_2})=\Large \langle\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_t|}{\langle\textbf{a}_x (f_1)\textbf{a}_y(f_2) \rangle_t}\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; \(<>_t\) represents the average value over timepoints; and \(<>\) represents the average value over epochs.
PPC is computed between all values of
f1sandf2s.Warning
For values of
f1shigher thanf2s, anumpy.nanvalue is returned.References