visbrain.gui.Sleep

class visbrain.gui.Sleep(data=None, hypno=None, config_file=None, annotations=None, channels=None, sf=None, downsample=100.0, axis=True, states_config_file=None, video_file=None, video_offset=None, preload=True, use_mne=False, kwargs_mne={}, verbose=None)[source][source]

Visualize and edit sleep data.

Use this module to :

  • Load and visualize polysomnographic data and spectrogram.

  • Load, edit and save hypnogram from the interface

  • Perform automatic events detection

  • Further signal processing tools (de-mean, de-trend and filtering)

  • Topographic data visualization

Sleep has been developped in collaboration with Raphael Vallat.

Parameters:
datastring, array_like | None

Polysomnographic data. Must either be a path to a supported file (see notes) or an array of raw data of shape (n_channels, n_pts). If None, a dialog window to load the file should appear.

hypnoarray_like | None

Hypnogram data. Should be a raw vector of shape (n_pts,)

config_filestring | None

Path to the configuration file (.txt)

annotationsstring | None

Path to the annotation file (.txt, .csv). Alternatively, you can pass an annotation instance of MNE or simply an (N,) array describing the onset.

channelslist | None

List of channel names. The length of this list must be n_channels.

sffloat | None

The sampling frequency of raw data.

downsamplefloat | 100.

The downsampling frequency for the data and hypnogram raw data.

axisbool | False

Specify if each axis have to contains its own axis. Be carefull with this option, the rendering can be much slower.

states_config_filepath-like | None

Path to the configuration file (.yaml) describing the vigilance states and associated value, color, shortcut, and display order on GUI. Refer to the documentation for an exemple. The default configuration contains the following states: [‘Art’, ‘Wake’, ‘REM’, ‘N1’, ‘N2’, ‘N3’] and their associated values: [-1, 0, 4, 1, 2, 3]

video_filepath-like | None

Path to the file to load in the video viewer. Supported formats are the same as Qt’s QMediaPlayer class.

video_offsetfloat | None

Offset between start of signal and start of video. Negative values mean the video starts after the recording. (default 0)

preloadbool | True

Preload data into memory. For large datasets, turn this parameter to True.

use_mnebool | False

Force to load the file using mne.io functions.

kwargs_mnedict | {}

Dictionary to pass to the mne.io loading function.

Notes

Note

  • Supported polysomnographic files : by default, Sleep support .vhdr (BrainVision), .eeg (Elan), .trc (Micromed) and .edf (European Data Format). If mne-python is installed, this default list of supported files is extended to .cnt, .egi, .mff, .edf, .bdf, .gdf, .set, .vhdr.

  • Supported hypnogram files : by default, Sleep support .txt, .csv and .hyp hypnogram files.

Deprecated since version 0.3.4: Input arguments file and hypno_file has been deprecated in 0.3.4 release. Use instead the data and hypno inputs.

Examples using visbrain.gui.Sleep

Basic configuration

Basic configuration

Load a BrainVision file

Load a BrainVision file

Load EDF file

Load EDF file

Load EDF file with custom vigilance state configuration

Load EDF file with custom vigilance state configuration

Load ELAN files

Load ELAN files

Load a Matlab file

Load a Matlab file

Load REC files

Load REC files

Load a file using MNE-python

Load a file using MNE-python

Replace detection algorithm : basic example

Replace detection algorithm : basic example

Replace detection with wonambi algorithm

Replace detection with wonambi algorithm