pactools.Comodulogram

class pactools.Comodulogram(fs, low_fq_range, low_fq_width=2.0, high_fq_range='auto', high_fq_width='auto', method='tort', n_surrogates=0, vmin=None, vmax=None, progress_bar=True, ax_special=None, minimum_shift=1.0, random_state=None, coherence_params={}, extract_params={}, low_fq_width_2=4.0, n_jobs=1)[source]

An object to compute the comodulogram for phase-amplitude coupling.

Parameters
fsfloat

Sampling frequency

low_fq_rangearray or list

List of filtering frequencies (phase signal)

high_fq_rangearray or list or ‘auto’

List of filtering frequencies (amplitude signal) If ‘auto’, it uses np.linspace(max(low_fq_range), fs / 2.0, 40).

low_fq_widthfloat

Bandwidth of the band-pass filter (phase signal)

high_fq_widthfloat or ‘auto’

Bandwidth of the band-pass filter (amplitude signal) If ‘auto’, it uses 2 * max(low_fq_range).

methodstring or DAR instance

Modulation index method:

  • String in (‘ozkurt’, ‘canolty’, ‘tort’, ‘penny’, ), for a PAC

    estimation based on filtering and using the Hilbert transform.

  • String in (‘vanwijk’, ) for a joint AAC and PAC estimation

    based on filtering and using the Hilbert transform.

  • String in (‘sigl’, ‘nagashima’, ‘hagihira’, ‘bispectrum’, ), for

    a PAC estimation based on the bicoherence.

  • String in (‘colgin’, ) for a PAC estimation

    and in (‘jiang’, ) for a PAC directionality estimation, based on filtering and computing coherence.

  • String in (‘duprelatour’, ) or a DAR instance, for a PAC estimation

    based on a driven autoregressive model.

n_surrogatesint

Number of surrogates computed for the z-score If n_surrogates <= 1, the z-score is not computed.

vmin, vmaxfloat or None

If not None, it define the min/max value of the plot.

progress_barboolean

If True, a progress bar is shown in stdout.

ax_specialmatplotlib.axes.Axes or None

If not None, a special figure is drawn on it, depending on the PAC method used.

minimum_shiftfloat

Minimum time shift (in sec) for the surrogate analysis.

random_stateNone, int or np.random.RandomState instance

Seed or random number generator for the surrogate analysis.

coherence_paramsdict

Parameters for methods base on coherence or bicoherence. May contain:

-block_lengthint

Block length

-fft_lengthint or None

Length of the FFT

-stepint or None

Step between two blocks

If the dictionary is empty, default values will be applied based on fs and low_fq_width, with 0.5 overlap windows and no zero-padding.

extract_paramsdict

Parameters for DAR models driver extraction

low_fq_width_2float

Bandwidth of the band-pass filters centered on low_fq_range, for the amplitude signal. Used only with ‘vanwijk’ method.

n_jobsint

Number of jobs to use in parallel computations. Recquires scikit-learn installed.

Examples

>>> from pactools.comodulogram import Comodulogram
>>> c = Comodulogram(fs=200., low_fq_range=np.arange(2, 4, 0.2),
...                  low_fq_width=2.)
>>> c.fit(signal_in)
>>> c.plot()
>>> comod_array = c.comod_
__init__(self, fs, low_fq_range, low_fq_width=2.0, high_fq_range='auto', high_fq_width='auto', method='tort', n_surrogates=0, vmin=None, vmax=None, progress_bar=True, ax_special=None, minimum_shift=1.0, random_state=None, coherence_params={}, extract_params={}, low_fq_width_2=4.0, n_jobs=1)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(self, fs, low_fq_range[, …])

Initialize self.

fit(self, low_sig[, high_sig, mask])

Call fit to compute the comodulogram.

get_maximum_pac(self)

Get maximum PAC value in a comodulogram.

plot(self[, titles, axs, cmap, vmin, vmax, …])

Plot the comodulograms computed during the fit

save(self, fname[, overwrite])

Save a comodulogram object on disk with h5py.

Attributes

comod_z_score_

Compute the z-score based on the comodulogram and the surrogates

surrogate_max_

Compute the distribution of maxima of the surrogates comodulograms