API reference

Automatic sleep staging & events detection

SleepStaging(raw, eeg_name, *[, eog_name, …])

Automatic sleep staging of polysomnography data.

art_detect(data[, sf, window, hypno, …])

Automatic artifact rejection.

rem_detect(loc, roc, sf[, hypno, include, …])

Rapid eye movements (REMs) detection.

REMResults(events, data, sf, ch_names, …)

Output class for REMs detection.

spindles_detect(data[, sf, ch_names, hypno, …])

Spindles detection.

SpindlesResults(events, data, sf, ch_names, …)

Output class for spindles detection.

sw_detect(data[, sf, ch_names, hypno, …])

Slow-waves detection.

SWResults(events, data, sf, ch_names, hypno, …)

Output class for slow-waves detection.

Hypnogram tools & sleep statistics

hypno_upsample_to_data(hypno, sf_hypno, data)

Upsample an hypnogram to a given sampling frequency and fit the resulting hypnogram to corresponding EEG data, such that the hypnogram and EEG data have the exact same number of samples.

hypno_upsample_to_sf(hypno, sf_hypno, sf_data)

Upsample the hypnogram to a given sampling frequency.

hypno_str_to_int(hypno[, mapping_dict])

Convert a string hypnogram array to integer.

hypno_int_to_str(hypno[, mapping_dict])

Convert an integer hypnogram array to a string array.

load_profusion_hypno(fname[, replace])

Load a Compumedics Profusion hypnogram (.xml).

transition_matrix(hypno)

Create a state-transition matrix from an hypnogram.

sleep_statistics(hypno, sf_hyp)

Compute standard sleep statistics from an hypnogram.

Spectral analyses & plotting tools

bandpower(data[, sf, ch_names, hypno, …])

Calculate the Welch bandpower for each channel and, if specified, for each sleep stage.

bandpower_from_psd(psd, freqs[, ch_names, …])

Compute the average power of the EEG in specified frequency band(s) given a pre-computed PSD.

bandpower_from_psd_ndarray(psd, freqs[, …])

Compute bandpowers in N-dimensional PSD.

irasa(data[, sf, ch_names, band, hset, …])

Separate the aperiodic (= fractal, or 1/f) and oscillatory component of the power spectra of EEG data using the IRASA method.

moving_transform(x[, y, sf, window, step, …])

Moving transformation of one or two time-series.

plot_spectrogram(data, sf[, hypno, win_sec, …])

Plot a full-night multi-taper spectrogram, optionally with the hypnogram on top.

sliding_window(data, sf, window[, step, axis])

Calculate a sliding window of a 1D or 2D EEG signal.

stft_power(data, sf[, window, step, band, …])

Compute the pointwise power via STFT and interpolation.

topoplot(data[, montage, vmin, vmax, mask, …])

Topoplot.