visbrain.objects.PacmapObj

class visbrain.objects.PacmapObj(name, data=None, sf=1.0, f_pha=[(2, 4), (5, 7), (8, 13)], f_amp=[(40, 60), (60, 100)], idpac=(4, 0, 0), n_window=None, cmap='viridis', clim=None, vmin=None, under='gray', vmax=None, over='red', interpolation='nearest', max_pts=-1, parent=None, transform=None, verbose=None, pac_kw={}, **kw)[source][source]

Create a Phase-Amplitude Coupling (PAC) object.

The PAC is computed using the tensorpac package.

The Pacmap can be used to visualize :

  • PAC, across time for a fixed phase and several amplitude frequencies

  • PAC, across time for a fixed amplitude and several phase frequencies

  • PAC is computed across time for several amplitudes and phase.

Parameters:
namestring | None

Name of the pacmap object.

dataarray_like

Array of data of shape (N,)

sffloat | 1.

The sampling frequency.

f_phalist | [(2, 4), (5, 7), (8, 13)]

The phase vector.

f_amplist | [(40, 60), (60, 100)]

The amplitude vector.

idpactuple | (4, 0, 0)

The PAC method to use.

n_windowint | None

Number of time points to consider when computing pac for a fixed phase or amplitude.

climtuple | None

Colorbar limits. If None, clim=(data.min(), data.max())

cmapstring | None

Colormap name.

vminfloat | None

Minimum threshold of the colorbar.

understring/tuple/array_like | None

Color for values under vmin.

vmaxfloat | None

Maximum threshold of the colorbar.

understring/tuple/array_like | None

Color for values over vmax.

interpolationstring | ‘nearest’

Interpolation method for the image. See vispy.scene.visuals.Image for availables interpolation methods.

max_ptsint | -1

Maximum number of points of the image along the x or y axis. This parameter is essentially used to solve OpenGL issues with very large images.

transformVisPy.visuals.transforms | None

VisPy transformation to set to the parent node.

parentVisPy.parent | None

Markers object parent.

verbosestring

Verbosity level.

kwdict | {}

Optional arguments are used to control the colorbar (See ColorbarObj).

Notes

List of supported shortcuts :

  • s : save the figure

  • <delete> : reset camera

Examples

>>> import numpy as np
>>> from visbrain.objects import SpectrogramObj
>>> n, sf = 512, 256  # number of time-points and sampling frequency
>>> time = np.arange(n) / sf  # time vector
>>> data = np.sin(2 * np.pi * 25. * time) + np.random.rand(n)
>>> spec = SpectrogramObj('spec', data, sf)
>>> spec.preview(axis=True)

Methods

__init__(name[, data, sf, f_pha, f_amp, ...])

Init.

animate([step, interval, iterations])

Animate the object.

copy()

Get a copy of the object.

describe_tree()

Tree description.

preview([bgcolor, axis, xyz, show, obj, ...])

Previsualize the result.

record_animation(name[, n_pic, bgcolor])

Record an animated object and save as a *.gif file.

render()

Render the canvas.

screenshot(saveas[, print_size, dpi, unit, ...])

Take a screeshot of the scene.

set_data(data[, sf, f_pha, f_amp, idpac, ...])

Compute pacmap and set data to the ImageObj.

set_shortcuts_to_canvas(canvas)

Set shortcuts to a VisbrainCanvas.

to_dict()

Return a dictionary of all colorbar args.

to_kwargs([addisminmax])

Return a dictionary for input arguments.

update()

Fonction to run when an update is needed.

update_from_dict(kwargs)

Update attributes from a dictionary.

Examples using visbrain.objects.PacmapObj

Phase-Amplitude Coupling (PAC) object

Phase-Amplitude Coupling (PAC) object