API

Compute phase-amplitude coupling

tensorpac:

Pac([idpac, f_pha, f_amp, dcomplex, cycle, …])

Compute Phase-Amplitude Coupling (PAC).

EventRelatedPac([f_pha, f_amp, dcomplex, …])

Compute the Event Related Phase-Amplitude Coupling (ERPAC).

PreferredPhase([f_pha, f_amp, dcomplex, …])

Compute the Preferred Phase (PP).

Utility functions

tensorpac.utils:

PSD(x, sf)

Power Spectrum Density for electrophysiological brain data.

ITC(x, sf[, f_pha, dcomplex, cycle, width, …])

Compute the Inter-Trials Coherence (ITC).

BinAmplitude(x, sf[, f_pha, f_amp, n_bins, …])

Bin the amplitude according to the phase.

PeakLockedTF(x, sf, cue[, times, f_pha, …])

Peak-Locked Time-frequency representation.

pac_vec([f_pha, f_amp])

Generate cross-frequency coupling vectors.

pac_trivec([f_start, f_end, f_width])

Generate triangular vector.

Generate synthetic signals

tensorpac.signals:

pac_signals_wavelet([f_pha, f_amp, sf, …])

Generate artificially phase-amplitude coupled signals using wavelets.

pac_signals_tort([f_pha, f_amp, sf, …])

Generate artificially phase-amplitude coupled signals.

Statistics

tensorpac.stats:

test_stationarity(x[, p])

Test the stationarity of an electrophysiological dataset.

Individual methods

tensorpac.methods:

PAC methods

If you don’t want to use the tensorpac.Pac class, you can also manually import the method of your choice and use it on phase / amplitude to compute PAC. Note that some functions have both a tensor or Numba-based implementation.

Tensor-based implementation

mean_vector_length(pha, amp)

Tensor-based Mean Vector Length (MVL).

modulation_index(pha, amp[, n_bins])

Tensor-based Modulation index (MI).

heights_ratio(pha, amp[, n_bins])

Tensor-based Heights ratio (HR).

norm_direct_pac(pha, amp[, p])

Tensor-based Normalized direct Pac (ndPAC).

phase_locking_value(pha, pha_amp)

Tensor-based Phase Locking-Value (PLV).

gauss_cop_pac(pha, amp)

Tensor-based Gaussian Copula PAC (gcPac).

Numba-based implementation

mean_vector_length_nb(pha, amp)

Numba-based Mean Vector Length (MVL).

modulation_index_nb(pha, amp[, n_bins])

Numba-based Modulation index (MI).

heights_ratio_nb(pha, amp[, n_bins])

Numba-based Heights ratio (HR).

norm_direct_pac_nb(pha, amp[, p])

Numba-based Normalized direct Pac (ndPAC).

phase_locking_value_nb(pha, pha_amp)

Numba-based Phase Locking-Value (PLV).

Preferred phase

preferred_phase(pha, amp[, n_bins])

Compute the preferred phase.

Surrogates methods

swap_pha_amp(pha, amp[, random_state])

Compute surrogates by swapping phase / amplitude trials.

swap_blocks(pha, amp[, random_state])

Compute surrogates by swapping amplitudes time blocks.

time_lag(pha, amp[, random_state])

Compute surrogates by introducing a time lag on phase series.

Normalization

normalize(idn, pac, surro)

Normalize the phase amplitude coupling.