tensorpac.utils.BinAmplitude

class tensorpac.utils.BinAmplitude(x, sf, f_pha=[2, 4], f_amp=[60, 80], n_bins=18, dcomplex='hilbert', cycle=(3, 6), width=7, edges=None, n_jobs=-1)[source]

Bin the amplitude according to the phase.

Parameters
xarray_like

Array of data of shape (n_epochs, n_times)

sffloat

The sampling frequency

f_phatuple, list | [2, 4]

List of two floats describing the frequency bounds for extracting the phase

f_amptuple, list | [60, 80]

List of two floats describing the frequency bounds for extracting the amplitude

n_binsint | 18

Number of bins to use to binarize the phase and the amplitude

dcomplex{‘wavelet’, ‘hilbert’}

Method for the complex definition. Use either ‘hilbert’ or ‘wavelet’.

cycletuple | (3, 6)

Control the number of cycles for filtering (only if dcomplex is ‘hilbert’). Should be a tuple of integers where the first one refers to the number of cycles for the phase and the second for the amplitude [2].

widthint | 7

Width of the Morlet’s wavelet.

edgesint | None

Number of samples to discard to avoid edge effects due to filtering

__init__(x, sf, f_pha=[2, 4], f_amp=[60, 80], n_bins=18, dcomplex='hilbert', cycle=(3, 6), width=7, edges=None, n_jobs=-1)[source]

Init.

Methods

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

Init.

filter(sf, x[, ftype, keepfilt, edges, n_jobs])

Filt the data in the specified frequency bands.

plot([unit, normalize])

Plot the amplitude.

show()

Show the figure.

Attributes

amplitude

Get the amplitude value.

cycle

Get the cycle value.

dcomplex

Get the dcomplex value.

f_amp

Vector of amplitudes of shape (n_amp, 2).

f_pha

Vector of phases of shape (n_pha, 2).

phase

Get the phase value.

width

Get the width value.

xvec

Vector of phases of shape (n_pha,) use for plotting.

yvec

Vector of amplitudes of shape (n_amp,) use for plotting.

filter(sf, x, ftype='phase', keepfilt=False, edges=None, n_jobs=-1)

Filt the data in the specified frequency bands.

Parameters
sffloat

The sampling frequency.

xarray_like

Array of data of shape (n_epochs, n_times)

ftype{‘phase’, ‘amplitude’}

Specify if you want to extract phase (‘phase’) or the amplitude (‘amplitude’).

n_jobsint | -1

Number of jobs to compute PAC in parallel. For very large data, set this parameter to 1 in order to prevent large memory usage.

keepfiltbool | False

Specify if you only want the filtered data (True). This parameter is only available with dcomplex=’hilbert’ and not wavelet.

edgesint | None

Number of samples to discard to avoid edge effects due to filtering

Returns
xfiltarray_like

The filtered data of shape (n_freqs, n_epochs, n_times)

plot(unit='rad', normalize=False, **kw)[source]

Plot the amplitude.

Parameters
unit{‘rad’, ‘deg’}

The unit to use for the phase. Use either ‘deg’ for degree or ‘rad’ for radians

normalizebool | None

Normalize the histogram by the maximum

kwdict | {}

Additional inputs are passed to the matplotlib.pyplot.bar function

Returns
axMatplotlib axis

The matplotlib axis that contains the figure

show()[source]

Show the figure.

property amplitude

Get the amplitude value.

property cycle

Get the cycle value.

property dcomplex

Get the dcomplex value.

property f_amp

Vector of amplitudes of shape (n_amp, 2).

property f_pha

Vector of phases of shape (n_pha, 2).

property phase

Get the phase value.

property width

Get the width value.

property xvec

Vector of phases of shape (n_pha,) use for plotting.

property yvec

Vector of amplitudes of shape (n_amp,) use for plotting.