by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 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)

apavlo89
@apavlo89

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):

Sleep().show()

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):

Sleep().show()
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
UiInit.init(self)
File "C:\Users\apavl\anaconda3\envs\neuroscience\lib\site-packages\visbrain\gui\sleep\interface\ui_init.py", line 26, in init
self.setupUi(self)
File "C:\Users\apavl\anaconda3\envs\neuroscience\lib\site-packages\visbrain\gui\sleep\interface\gui\sleep_gui.py", line 2008, in setupUi
QtCore.QMetaObject.connectSlotsByName(MainWindow)
SystemError: <built-in function connectSlotsByName> returned a result with an error set

>

Raphael Vallat
@raphaelvallat
Hi @SCL92_gitlab, there is currently no automatic detection of artifacts in Visbrain. If you're comfortable with command-line tools you can check https://raphaelvallat.com/yasa/build/html/generated/yasa.art_detect.html
Hi @apavlo89 , it seems that you need to upgrade your version of PyQt, see here: GNS3/gns3-gui#2819
Jefferson Souza 🇧🇷
@Jefinho_ZK_twitter
Hi people! I cant set up my hipnogram.txt to run in GUI sleep. Indeed, I need to use the hipnogram generated by Alice Sleepware (Respironics) in Sleep GUI. How can I get this data to Sleep GUI?
Raphael Vallat
@raphaelvallat
Hi @Jefinho_ZK_twitter, I've never used Alice Sleepware but you will probably need to convert your hypnogram to a format compatible with Visbrain. Please read the documentation for more details: http://visbrain.org/sleep.html#hypnogram
Jefferson Souza 🇧🇷
@Jefinho_ZK_twitter
Thank you Raphael. I would like to ask one more thing. The values of sleep latency (N1, N2, N3 and REM) are calculated based on the entire register and I have the first 20~40 minutes of edf files still awake (cognitive tests performed before naps). How I could disconsider these prior minutes awake in Sleep?
Raphael Vallat
@raphaelvallat
Hi @Jefinho_ZK_twitter. The best solution is to crop and re-export your EDF data to only include time in bed using Alice Sleepware or EDFBrowser. Or, if you prefer to stay in Python you can use the MNE .crop() function. Hope this helps! Thanks
Jefferson Souza 🇧🇷
@Jefinho_ZK_twitter
@raphaelvallat Thanks a lot Raphael! I will use Python (Spyder IDE) to crop the lights off - lights on interval.
apavlo89
@apavlo89
Thanks Vallat, visbrain now works. By the way, why does my Visbrain output hypnograms that when using the 'old method', it outputs 30 values per 30 seconds and not 1 value per 30 seconds? Is this how it should normally behave or am I doing something wrong? If it is working as intended, it would be great to have 3 methods for hypnogram output: 1) 1 value per 30 seconds, 2) 30 values per 30 seconds and 3) the new method you've implemented in 0.4.
MarcoSleepCBT-I
@MarcoSleepCBT-I
Hi people, thanks a lot for visbrain-python/sleep! it's very usefull for me! So is there a function to extract an FFT output with specific BIN frequencies? and what is the bin resolution for the analyses?
Raphael Vallat
@raphaelvallat
Hi @MarcoSleepCBT-I ! Visbrain is a visualization tool and as such does not implement advanced analysis functions. To calculate the power spectrum of your data, you will have to use create a Python script. Specifically, you can use the men package to load your data (for EDF see mne.io.read_raw_edf), and then the scipy.stats.peridogram or scipy.stats.welch to calculate the power spectrum. If you then want to calculate the spectral power in different frequency bands, please check this blog post: https://raphaelvallat.com/bandpower.html
MarcoSleepCBT-I
@MarcoSleepCBT-I
Hi, Thanks again, i'll try to use your information! are there guides with more details?have a good day!
AJ Hirsch Allen
@ajhallen_gitlab
Hi guys I am new to using visbrain sleep and relatively new to eeg analysis. I have about 500 elf files that I converted from sandman psgs at my sleep lab. I am trying to figure out a few things.

First when I try to import an edf using the following code# Import the Sleep module from visbrain :
from visbrain.gui import Sleep

Run the interface :

Sleep().show()

AJ Hirsch Allen
@ajhallen_gitlab
and then select an elf file and hit cancel as to not load a hypnogram . the sleep interface opens but I get the spinning wheel of death and am forced to quit. Second I am going to post a screen shot of what is contained in the my original folder for each patient for the sleep lab because I do not know if I actually have a hypnogram file that is compatible with this package. Third , I was wondering if I need a hypnogram to break the sleep study in to stages with visbrains functionality or if the raw egg data is enough. Above when I wrote elf I meant edf
AJ Hirsch Allen
@ajhallen_gitlab
I just realized I do not know how to post the screen shot of my folders to this forum can anybody help with that too.
thanks for all the help
AJ
Raphael Vallat
@raphaelvallat
Hi @ajhallen_gitlab , you don't need to have an hypnogram to run Visbrain. The hypnogram file format supported in Visbrain are described here: http://visbrain.org/sleep#hypnogram I think you can upload screenshots to Gitter by just doing drag-and-drop. Finally I don't know what you mean y "break the sleep study in stages with Visbrain functionality"? Remember that Visbrain is a visualization tool, not an analysis tool. Thanks!
AJ Hirsch Allen
@ajhallen_gitlab
Screen Shot 2020-07-19 at 9.59.48 PM.png
Screen Shot 2020-07-19 at 9.59.27 PM.png
thanks for your response i was interested in identifying k complexes will that be possible without the hypnogram file. Also do I Have anything that resembles a hypnogram file in the screenshots I uploaded .
thanks again
AJ Hirsch Allen
@ajhallen_gitlab
I got the program to work without the hypnogram file. the issue was I was using Jupiter notebooks and when I ran the code for the GUI from the terminal it worked. I am still interested if I have a hypnogram file that may work in the screenshots I sent of if I have a file I could convert into a format that would work. Also I was wondering if the GUi allows you to look at multiple files at the same Time and if so how.
thanks
Raphael Vallat
@raphaelvallat
Hi @ajhallen_gitlab, good to know for Visbrain! I think the stage.evt is probably the hypnogram file in the screenshot that you sent however I do not know what file format .evt is, and what software is needed to open this file (Visbrain cannot). I suggest you try to open it into a text editor and see if you can convert it to a Visbrain-readable hypnogram (e.g. a simple text file). You can detect slow-waves / K-complex without hypnogram but it's usually much better to use the sleep stage information when you have it. Thanks
AJ Hirsch Allen
@ajhallen_gitlab
thanks I will work on the conversion. Also in regards to my last question can you use the interface to open multiple files at the same time or is it just for visualizing one patient at a time.
Raphael Vallat
@raphaelvallat
Hi, the interface can only visualize one recording at a time. Thanks
AJ Hirsch Allen
@ajhallen_gitlab
when I upload my edf files and view them with the GUI it only loads under 1 hour for each file even though there are upto 10 hours of sleep data in each one. what do you think that is the case and do you have any suggestions
thanks AJ
Raphael Vallat
@raphaelvallat
Hmm that's weird. Are you sure the EDF file is valid? Maybe there's an issue with your sampling frequency. I'd recommend using the EDFBrowser free software to visualize your data and check that you have 10 hours of data. Thanks
AJ Hirsch Allen
@ajhallen_gitlab
I have already visualized my data with mne python and have extracted vents and epochs. This is data from UBC sleep lab and the pigs have already been scored and there is between 7-10 hours in all the Edf's but when I try to visualize with visbrain it only shows less then 1 our per edf
sindyburnburn
@sindyburnburn
Hi there, I was referred to this discussion by my friend and colleague Christian O'Reilly. I have a question regarding sleep spindle detection. I'm wondering what does it mean when there are grey verticle lines bordering the putative spindle vs when there are no grey verticle lines?
https://imgur.com/EyO5pry link to example figure
sindyburnburn
@sindyburnburn
also is it possible to export the colormap for the spectrogram?
Raphael Vallat
@raphaelvallat
Hi @sindyburnburn , the grey verticle lines highlight the limits of the current selected spindles in the left Detection panel.
Could you please provide more details s to what you mean by "exporting the colormap"? Thanks
sindyburnburn
@sindyburnburn
thanks for your quick response!
i guess i'm a little confused because there is a red marking covering the areas where spindles are detected and sometimes there are grey verticle lines around these red parts and sometimes there aren't
by colormap, i mean that usually in figures there is a colorbar to match the color map to tell you what each color means quantitatively. I guess for the time-frequency spectrogram, the units are arbitrary, so I can just put the color bar from 0 to 1, but i was just wondering if there was some way to export this (otherwise, it's okay!)
Raphael Vallat
@raphaelvallat
@sindyburnburn there is no way to export the colorbar in Visbrain, however if you're not afraid of writing code you can have a look at the yasa.plot_spectrogram function: https://raphaelvallat.com/yasa/build/html/generated/yasa.plot_spectrogram.html
sindyburnburn
@sindyburnburn
Afraid of writing code? Interesting way to put it. Not afraid! Thanks a lot
Susy
@SCL92_gitlab
Hi, is there a way to prevent the automatic detection from 'detecting' k-complexes and slow wave sleep from sections of the defined awake EEG? Currently the software is incorrectly indicating many episodes of each when the subject is in fact awake. Thanks!
Raphael Vallat
@raphaelvallat
Hi @SCL92_gitlab , you can select : "Perform detection only for NREM sleep : if True and a hypnogram is loaded, then the detection will only be performed on NREM sleep epochs." in the detection panel to limit the detection to NREM sleep. This would require loading an hypnogram into Visbrain. Alternatively, you can use YASA to detect slow-waves on specific sleep stages: https://raphaelvallat.com/yasa/build/html/generated/yasa.sw_detect.html Thanks
agpr141
@agpr141
Hi everyone. Does anyone know the best way to import the hypnogram file as Annotations for an mne.raw object? I am currently struggling!
Raphael Vallat
@raphaelvallat
Hi @agpr141! In Visbrain, hypnogram and annotations are two different things. So you'll have to manually convert your annotations into a format that is compatible to Visbrain's hypnogram formats, which are described here: http://visbrain.org/sleep.html#hypnogram
Oscar Smith
@Oscar777_gitlab
Hello... i'm new to python and visbrain. I want to use "Sleep" and after a few difficulties I was able to install visbrain successfully. Now I wanted to start "Sleep" via "from visbrain.gui import Sleep", but i only get this message: "AttributeError: module 'time' has no attribute 'clock'". I use Anaconda (Windows 10) and I get the same Error via Spyder and a Terminal. What do I have to do? Thanks for helping!
Raphael Vallat
@raphaelvallat
Hi @Oscar777_gitlab, are you using Python 3.8? It seems that the time.clock() function has been deprecated in Python 3.8, hence the error (see https://stackoverflow.com/questions/58569361/attributeerror-module-time-has-no-attribute-clock-in-python-3-8). This will require some changes in the code of Visbrain. If possible, I'd suggest downgrading to Python 3.7. Thanks
Oscar Smith
@Oscar777_gitlab
@raphaelvallat This helps, thank you! For the moment it works with the examples from the homepage. In the next weeks we will try it by using our own data. Thanks a lot!
drcostco
@drcostco
Hi @raphaelvallat - do you know if visbrain has plans to do automatic sleep stage detection?
Raphael Vallat
@raphaelvallat
Hi @drcostco! Sadly neither Etienne nor I have really much time to work on Visbrain nowadays, so we won't be able to implement automatic sleep stage detection in a near future. I wish I can work on that one day, but that would certainly not happen within the next months.
Kat Lu
@Katharin_gitlab
Hej... My team and I installed successful visbrain for using the Sleep Module. There are no problems with the examples from the visbrain homepage. But now, we want to use our own BrainVision-Files but loading the data failed. In the first step we get an "Assertation Error". To solve this problem I followed your advices in this conversation EtienneCmb/visbrain#68.
But it ends in another error message:
(Sleep2) D:\Anaconda\envs\Sleep2\Beispiel\Test15092020>python readdata.py
D:\Anaconda\envs\Sleep2\lib\site-packages\vispy\visuals\line\line.py:395: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
('color', np.float32, 4)])
D:\Anaconda\envs\Sleep2\lib\site-packages\vispy\visuals\line\arrow.py:57: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
('linewidth', np.float32, 1)
D:\Anaconda\envs\Sleep2\lib\site-packages\vispy\visuals\isocurve.py:22: UserWarning: VisPy is not yet compatible with matplotlib 2.2+
warnings.warn("VisPy is not yet compatible with matplotlib 2.2+")
Extracting parameters from Test3_15092020.vhdr...
Setting channel info structure...
Reading 0 ... 79029 = 0.000 ... 158.058 secs...
Hypnogram successfully loaded (D:/Anaconda/envs/Sleep2/Beispiel/Test15092020/Test3_15092020.vhdr)
Traceback (most recent call last):
File "readdata.py", line 9, in <module>
Sleep(data=data, sf=sf, channels=channels).show()
File "C:\Users\i\AppData\Roaming\Python\Python37\site-packages\visbrain\gui\sleep\sleep.py", line 100, in init
annotations)
File "C:\Users\i\AppData\Roaming\Python\Python37\site-packages\visbrain\io\readsleep.py", line 134, in init
hypno,
= read_hypno(hypno, time=time, datafile=file)
File "C:\Users\i\AppData\Roaming\Python\Python37\site-packages\visbrain\io\rw_hypno.py", line 333, in read_hypno
return vispy_array(hypno), sf_hyp
UnboundLocalError: local variable 'hypno' referenced before assignment
Do you have a hint to solve the problem? Thank you and best wishes!