Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
  • Aug 24 2017 19:45

    EtienneCmb on screenshot

    Fix canvas names (compare)

  • Aug 24 2017 18:51

    EtienneCmb on screenshot

    Fix factor visibility Add screenshot GUI tooltips (compare)

  • Aug 24 2017 18:33

    EtienneCmb on screenshot

    Remove screenshot menu Screenshot configuration for Sl… (compare)

  • Aug 24 2017 17:57

    EtienneCmb on develop

    Use master figure Bump to version v0.3.1 Merge branch 'release/v0.3.1' i… (compare)

  • Aug 24 2017 17:57

    EtienneCmb on screenshot

    Merge branch 'release/v0.3.1' i… Remove brain GUI components rel… Add UiScreenshot class and 12 more (compare)

Thanks Raphael this has fixed the issue. One thing i'd like to see in YASA is spindle density calculation that visbrain has
Raphael Vallat
Thanks @apavlo89 ! Indeed I am planning on implementing that in the next release
Renan Bortoluzzi da Silva
Hi all, I need help to install visbrain Sleep. Can someone help me?
Great! Btw just saw your opinion piece on lucid dreaming and potential negative impact on sleep ;)
I'm an LD researcher
Raphael Vallat
Hi @RenanB ! For installing Visbrain, please refer to the documentation at http://visbrain.org/introduction.html#install-visbrain. If you're completely new to Python I suggest that you get help from someone with a little experience as it can be a bit overwhelming at first to navigate between all the packages. Hope this helps!
Nelly Matorina
Hello, I was wondering if someone could help me run the software. Using both the MNE loading option and the regular loading option for .edf files, the interface doesn't open and I get this in the terminal:
Data successfully loaded (/Users/nellymatorina/Documents/Science/Data/MEMRI_432___SleepPM_20170906_104118_ABM000020.edf):
  • Sampling-frequency : 256.00Hz
  • Number of time points (before down-sampling): 7197184
  • Down-sampling frequency : 128.00Hz
  • Number of time points (after down-sampling): 3598592
  • Number of channels : 26
Raphael Vallat
Hi @nmatorina ! The message that you get in the terminal is not an error -- instead, it seems that the data was successfully loaded. Do you see an error message after that? Please follow closely the installation instructions of Visbrain (http://visbrain.org/introduction.html#install-visbrain), and make sure that PyQt5 is installed. Thanks
Hi All,
I am trying this package out for the first time and am running into problems. When I load my select my EDF file it seems to load correctly (similar to Nelly) but when I try to launch the gui it just opens a new blank window and stops responding. I am using Spyder and the versions of the dependent packages are:
PyQt5 = 5.13.2
PyQt5-sip = 12.7.0
PyQtWebEngine = 5.13.2
PyOpenGL = 3.1.0
Pillow = 6.2.0
The same result happens when I run the example data. Any help is appreciated!
Raphael Vallat
Hi @mjs966 ! I think this might be caused by Spyder. I'd suggest that you run the Python file directly from a .py file (e.g. python run_visbrain.py) instead of using Spyder. Let me know if that helped. Thanks!
I want to filter EEG channels and EMG channels with different settings.
I am just allowed to apply filters for " all channels" or a single channel that gets reversed if I change filter for another single channel. Is this a bug? According to AASM EMG and EEG should be filtered differently...
Thank you :)
Hi! I'm wondering if there might be a bug in the macOS visbrain software? During scoring, half of the gridlines suddenly go missing in different/random parts of the scoring window. This problem does not using Windows. Any clues to why this is happening and/or ideas for fixing it? Thanks!
Raphael Vallat
HI @linefolv! So, unfortunately, it is not possible to filter the EEG and EMG separately in Visbrain. However, I suggest that you use the MNE-Python package to filter your data before loading them into Visbrain. See https://mne.tools/stable/generated/mne.io.Raw.html#mne.io.Raw.filter
Hi @HeddaN! I don't have a Mac so I cannot replicate the error, I think you're the first to report this issue so I'm not sure if this is related to Visbrain or rather the Python environment (e.g. PyQt, VisPy version..) I'd suggest updating your packages and see if the error persists. Thanks!
Nelly Matorina
Hello @raphaelvallat, thanks for your message! The data was successfully loaded, and I have PyQt5 installed but no GUI is popping up. So I can't see any new windows or my edf file. Do you have some advice for how to fix this issue?
Etienne Combrisson

Hello @nmatorina , can you try the following small code please :
Create a test.py file and paste the following lines :

from visbrain.objects import BrainObj

Then from your terminal run the file : python test.py. Do u see the GUI?


Hi @raphaelvallat ! Thank you for the MNE tips :)
Is it possible to rearrange the display of the channels so channels are displayed in non-alphabetical order? Ev. rename the channels within visbrain so we can determine how they are displayed?

I am also experiencing the gridline-problem on my Mac laptop as reported by HeddaN and the same goes for my colleague on her Windows laptop. Sometimes all of them and sometimes only half of them.

Swayanshu Shanti Pragnya
I have downloaded data from this sorce: https://www.physionet.org/content/sleep-edfx/1.0.0/ and decoded using MNE library but unable to understand how to find algorithm. can any one suggest how to classify sleep stages?
Raphael Vallat
Hi @swayanshu , Visbrain does not currently allow to automatically classify sleep stages. Instead, it allows to visualize and manually stage the EEG data. It also implements some automatic detection of sleep microstructure (spindles, K-complex) that you can use to facilitate the tedious process of staging the files. Hope this helps, thanks!
Swayanshu Shanti Pragnya
Hello @raphaelvallat thanks for responding, but can you tell me how to customize these tools for our edf files?
Raphael Vallat
Hi @apavlo89 ! You need to install the entropy package first, https://raphaelvallat.com/entropy/build/html/index.html
Hi All, Hi Raphael @raphaelvallat I am trying to use the sleep GUI, I have downloaded the latest vispy. I have successfully loaded an EEG data set and the GUI opens but cannot be clicked upon, i am then prompted to add a text file, if i try to add one or cancel the kernel is closed and GUI disappears. Any help would be most appreciated ! thank you Danny
Thank you Raphael. I managed to get it to work so I deleted my messages here, not sure if they were deleted just on my side lol!
Is there a way to extract non-linear features per sleep stage?
or currently is it only by epoch?

Also I can't seem to be able to run the following code:

from sklearn.feature_selection import f_classif

Extract sorted F-values

fvals = pd.Series(f_classif(X=df_feat, y=hypno)[0],

Plot best features

plt.figure(figsize=(6, 6))
sns.barplot(y=fvals.index, x=fvals, palette='RdYlGn')

Plot hypnogram and higuchi

fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(12, 6), sharex=True)

hypno = pd.Series(hypno).map({-1: -1, 0: 0, 1: 2, 2: 3, 3: 4, 4: 1}).values
hypno_rem = np.ma.masked_not_equal(hypno, 1)

Plot the hypnogram

ax1.step(times, -1 hypno, color='k')
ax1.step(times, -1
hypno_rem, color='r')
ax1.set_yticks([0, -1, -2, -3, -4])
ax1.set_yticklabels(['W', 'R', 'N1', 'N2', 'N3'])
ax1.set_ylim(-4.5, 0.5)
ax1.set_ylabel('Sleep stage')

Plot the non-linear feature

ax2.plot(times, df_feat['higuchi'])
ax2.set_ylabel('Higuchi Fractal Dimension')
ax2.set_xlabel('Time [minutes]')

ax2.set_xlim(0, times[-1]);

I get ValueError: Input contains NaN, infinity or a value too large for dtype('float64').
df_feat works just fine
Raphael Vallat
Hi @apavlo89 , this is not really Visbrain-related so I'd suggest that you open an issue on YASA's GitHub instead. I think f_classif is giving you an error because you have a NaN values in your df_feat or hypnogram. Also, it is possible to calculate non-linear features by sleep stage by manually selecting where your data is equal each sleep stage (e.g. data[hypno == 4]). Hope this helps
Hi @dballICN , are you getting any error messages on the terminal? Could you send us a screenshot of the bug? I would try re-installing Visbrain, making sure that you install all the required dependencies (pyqt, pyopengl_accelerate, etc)
Sven Leach
Hey everybody, first of all congrats to such a nice toolbox! My team is considering using your toolbox as the new default program for sleep scoring data. However, for distinguishing between N2 and N3, we need some kind of ruler functionality, with which we can measure the length of slow waves (20% of slow waves in an epoch --> N3). I was not able to find it so far, is such a feature implemented?
Raphael Vallat
Hi @SvennoNito ! Thanks for your feedback, glad to hear that you and your team like it! There is no "hard ruler" functionality to determine the amplitude of slow-waves, however, if you check the checkbox "Show grid" on the bottom and then adjust the amplitude of each or all channels accordingly, you should be able to get a ruler close to the desired threshold (e.g. 75 uV). Let me know if that helps! Thanks
Sven Leach
Hi @raphaelvallat , thanks for your response! Right, the amplitude is easy to determine with the grid. But how do you determine whether 20% of the epoch contains slow waves? Our old program had a ruler or line that we could draw from positive to positive peak of a slow wave, which then added up the time in seconds of counted slow waves. When 6s were reached, we staged the epoch as N3. How would you do that in your toolbox?
Raphael Vallat
Oh, I see @SvennoNito ! That is not currently possible in Visbrain. If it's a feature that you'd like, I'd suggest opening an issue on GitHub, but I cannot promise that we can implement this feature in the near future as we're all jammed up with our postdoc right now. If you or one of your lab members is versed in Python, please feel free to make changes to the code source and submit a PR. Thanks so much!
Sven Leach
Thanks @raphaelvallat ! I will create an issue then. Out of curiosity: how have you distinguished between N2 and N3 with your toolbox so far?
Hey everybody! I was wondering if the Sleep toolbox will be supporting XDF eeg files at any point in the future? Currently my work around is to pickle the header and data files separately and load them into the gui in a similar fashion as is done with matlab files, but any future accommodations would be appreciated :)

Hi, I was wondering whether anyone could help me understand the issue here with importing the Sleep module? I get the following error message in my Jupyter notebook: ---------------------------------------------------------------------------
ImportError Traceback (most recent call last)

<ipython-input-11-56a0d0d4e9bb> in <module>
----> 1 from visbrain.gui import Sleep

~/visbrain/visbrain/gui/init.py in <module>
----> 1 from .brain import Brain # noqa
2 from .figure import Figure # noqa
3 from .signal import Signal # noqa
4 from .sleep import Sleep # noqa

~/visbrain/visbrain/gui/brain/init.py in <module>
1 """From the brain file, import the brain module."""
----> 2 from .brain import Brain

~/visbrain/visbrain/gui/brain/brain.py in <module>
11 import vispy.scene.cameras as viscam
---> 13 from .interface import UiInit, UiElements, BrainShortcuts
14 from .visuals import Visuals
15 from .cbar import BrainCbar

~/visbrain/visbrain/gui/brain/interface/init.py in <module>
1 """Import uiElements and uiInit."""
----> 2 from .ui_init import UiInit, BrainShortcuts
3 from .ui_elements import UiElements

~/visbrain/visbrain/gui/brain/interface/ui_init.py in <module>
14 from .gui import Ui_MainWindow
---> 15 from visbrain.objects import VisbrainCanvas

~/visbrain/visbrain/objects/init.py in <module>
1 """Import visbrain objects."""
----> 2 from .brain_obj import BrainObj # noqa
3 from .cbar_obj import ColorbarObj # noqa
4 from .connect_obj import ConnectObj, CombineConnect # noqa
5 from .crossec_obj import CrossSecObj # noqa

~/visbrain/visbrain/objects/brain_obj.py in <module>
6 from vispy import scene
----> 8 from .visbrain_obj import VisbrainObject
9 from ._projection import _project_sources_data
10 from ..visuals import BrainMesh

~/visbrain/visbrain/objects/visbrain_obj.py in <module>
7 import vispy.visuals.transforms as vist
----> 9 from .scene_obj import VisbrainCanvas
10 from ..io import (write_fig_canvas, dialog_save, path_to_visbrain_data,
11 load_config_json, get_data_url_path, download_file,

~/visbrain/visbrain/objects/scene_obj.py in <module>
6 from vispy import scene
----> 8 from ..io import write_fig_canvas, mpl_preview, dialog_save
9 from ..utils import color2vb, set_log_level, rotate_turntable, FixedCam
10 from ..visuals import CbarVisual

~/visbrain/visbrain/io/init.py in <module>
3 from .dialog import # noqa
4 from .download import
# noqa
----> 5 from .mneio import # noqa
6 from .path import
# noqa
7 from .read_annotations import * # noqa

~/visbrain/visbrain/io/mneio.py in <module>
2 import datetime
3 import numpy as np
----> 4 from ..utils import get_dsf
6 all = ['mne_switch']

~/visbrain/visbrain/utils/init.py in <module>
9 from .others import
10 from .physio import

---> 11 from .picture import
12 from .sigproc import

13 from .sleep import *

~/visbrain/visbrain/utils/picture.py in <module>
1 """Set of functions for picture managment."""
2 import numpy as np
----> 3 from scipy.misc import imresize

ImportError: cannot import name 'imresize' from 'scipy.misc' (/opt/anaconda3/lib/python3.7/site-packages/scipy/misc/init.py)

Hiya- I am starting to run Sleep on my Mac through PyCharm(I usually run on Windows w/ PyCharm). I am facing the following problem- when I load up the Sleep GUI, if I press certain buttons or try certain commands the python launcher will suddenly quit with 'Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)'. My scripts are exactly the same that I use between Windows and Mac. Do you know why this might be?
Hi. Question re: hypnogram lengths. Can anyone explain to me why, when Sleep generates the point-by-second hypnogram (i.e. the old format), it can be imprecise? My data file is 39503 seconds long, yet the hypnogram generated is 39658 seconds long. Where does this discrepancy actually come from? Is it a case of extra seconds just added onto the end of the file, or will there be some lag/displacement of assigned states throughout the hypnogram? I know you brought in the new format to deal with the discrepancy, but I just want to understand what is going on with the old format.
I'm unsure currently how to use the new format to separate out individual sleep states, so the old format is certainly simpler to use...
Raphael Vallat
Hi @agpr141 , re: hypnogram length. Could you try to load your data without downsampling (Sleep(downsample=False).show()) and let us know if you find the same discrepancy in the point-by-second hypnogram export?
Also, I recently opened a survey on hypnogram format on the Github of Visbrain, please feel free to add your opinion: EtienneCmb/visbrain#72
As for the MAC vs Windows issue, I honestly have no idea... (I don't have a Mac so cannot try Visbrain on it) -- I wonder if this is related to your Visbrain installation or your data, I would suggest you try to open and load some of the example files, play around with Visbrain and see if you end up with the same bugs
Hi Community,
I am new to Visbrain and I am trying to use a 1-D Numpy Array that lacks a hypnogram file to analyze slow wave sleep, but following some of the examples posted I am unable to get it working and receive "file not supported" everytime I try something new. I was wondering if anyone had working examples of loading a raw NumPy array into Sleep and receiving output?
Hi- I am just wondering if the module displays negative signals as plotted on the negative y-axis or positive y-axis? Perhaps I missed it in the documentation- thanks!
Raphael Vallat
Hi @zbandit98 , can you please share your code and a screenshot of the error you're getting?
@MirandaChappelFarley negative is down and positive is up! Does that answer your question? Thanks!
Hi, I'm wondering whether there's any functionality within the Sleep module to exclude epochs labelled as artefacts from the automatic detections?

Hello everyone,

When trying to run sleep using the following command:

from visbrain.gui import Sleep

Run the interface (requires loading of a data file):


I get:

Python 3.7.7 (default, Mar 23 2020, 23:19:08) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.

from visbrain.gui import Sleep

Run the interface (requires loading of a data file):

AttributeError: getattribute

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\apavl\anaconda3\envs\neuroscience\lib\site-packages\visbrain\gui\sleep\sleep.py", line 88, in init
File "C:\Users\apavl\anaconda3\envs\neuroscience\lib\site-packages\visbrain\gui\sleep\interface\ui_init.py", line 26, in init
File "C:\Users\apavl\anaconda3\envs\neuroscience\lib\site-packages\visbrain\gui\sleep\interface\gui\sleep_gui.py", line 2008, in setupUi
SystemError: <built-in function connectSlotsByName> returned a result with an error set