visbrain.objects.HypnogramObj

class visbrain.objects.HypnogramObj(name, data=None, time=None, datafile=None, art=-1, wake=0, n1=1, n2=2, n3=3, rem=4, art_visual=1, wake_visual=0, rem_visual=-1, n1_visual=-2, n2_visual=-3, n3_visual=-4, art_color='#8bbf56', wake_color='#56bf8b', rem_color='#bf5656', n1_color='#aabcce', n2_color='#405c79', n3_color='#0b1c2c', line_width=2.0, antialias=False, unicolor=False, transform=None, parent=None, verbose=None, **kw)[source][source]

Hypnogram object.

Parameters:
namestring

Name of the hypnogram object or path to a *.txt or *.csv file.

dataarray_like

Array of data of shape (n_pts,).

timearray_like | None

Array of time points of shape (n_pts,)

datafilestring | None

Path to the data file.

art, wake, rem, n1, n2, n3

Stage identification inside the data array.

art_visual, wake_visual, rem_visual, n1_visual, n2_visual, n3_visual

Stage order when plotting.

art_color, wake_color, rem_color, n1_color, n2_color, n3_color

Stage color.

line_widthfloat | 2.

Line with of the hypnogram.

antialiasbool | False

Use anti-aliasing line.

unicolorbool | False

Use a uni black color for the hypnogram.

transformVisPy.visuals.transforms | None

VisPy transformation to set to the parent node.

parentVisPy.parent | None

Hypnogram 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 HypnogramObj
>>> data = np.repeat(np.arange(6), 100) - 1.
>>> h_obj = HypnogramObj('hypno', data)
>>> h_obj.preview(axis=True)

Methods

__init__(name[, data, time, datafile, art, ...])

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_shortcuts_to_canvas(canvas)

Set shortcuts to a VisbrainCanvas.

set_stage(stage, idx_start, idx_end)

Set stage.

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.