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)

manoj
@abstractnew

Hello, I am trying to use the Sleep GUI to load the data from the Sleep EDF database - https://www.physionet.org/content/sleep-edf/1.0.0/ . (format - .rec, .hyp files).

When I try to open the file with the Sleep GUI it loads the .rec file just fine, but fails on selecting the hypnogram (.hyp) file with the following error

File "C:\pathtovisbrain\visbrain\io\rw_hypno.py", line 355, in _read_hypno_hyp_sample
sf_hyp = 1 / float(hyp[0].split()[1])
IndexError: too many indices for array

As a side note, I am able to load/view the signal data array in R just fine. Any suggestions would be greatly appreciated

Raphael Vallat
@raphaelvallat
Hi @abstractnew, this is most likely because your hypnogram does not follow the required format (see http://visbrain.org/sleep.html#hypnogram). Where did your .hyp file come from?
manoj
@abstractnew
@raphaelvallat Thank you. I am using the https://www.physionet.org/content/sleep-edf/1.0.0/ sleep edf dataset. The hyp file comes from their dataset. I was able to load it up with edfReader package in R so I assumed that the formats would be fine. My bad. I will go through the visbrain format and see where the discrepancy is from.
It is an older dataset so maybe the hyp formats are not the right ones. Thanks again.
Raphael Vallat
@raphaelvallat
Sorry for the confusion @abstractnew , indeed the .hyp format in the Physionet database is not the same as the .hyp format in Visbrain (the latter being a custom format that we used in my former lab). But hopefully it shouldn't be too problematic to convert your current hypnogram. Thanks!
manoj
@abstractnew
@raphaelvallat Thanks for clarifying. I will work on trying to convert the hypnogram to a format usable by Visbrain. Thanks again.
sharomer
@sharomer
@agpr141 @raphaelvallat - After you finshed scoring and you have a hypno file - how do you bring it into MNE? Do you have a function to make an Annotation object for MNE or are there better alternatives? Thanks!
Raphael Vallat
@raphaelvallat
Hi @sharomer, what are you trying to do with the hypnogram in MNE? Visbrain hypnograms are not directly compatible with MNE annotations so you'll need to convert them manually. I think it should be pretty straightforward though, because, from memory, you'll just need the start time, duration and label of the event (stage) to create the Annotations; all of which you can get from Visbrain. Hope this helps
sharomer
@sharomer
Hi @raphaelvallat, thanks for the quick attention. I would like to analyze my REM/N3 separately - perhaps clean artifacts differently etc - I was wondering if anyone already wrote the function that reads it in . Or whether there is a nicer way to do it... say I want to plot the average spectrum of all the N3 30s epochs or particular subject. What would would you do?
Raphael Vallat
@raphaelvallat
Hi @sharomer, please have a look at the YASA package (https://github.com/raphaelvallat/yasa), a command-line sleep analysis toolbox, which contains some functions to calculate the spectral power in different sleep stages, or remove artefacts, etc
sharomer
@sharomer
Thanks @raphaelvallat I'll check it out
Jessica Kendall-Bar
@jmkendallbar
Hi all! I am very new to Python and have spent the last few hours troubleshooting installing the Sleep module from visbrain.. I tried doing it through my terminal first and then through the Anaconda terminal, with the current versions of numPy and scipy and then reverting to older versions when I got RunTime errors (scipy 1.4.1 and numpy 1.19.2). I am able to "import visbrain" in Python but when I try to run "from visbrain.gui import Sleep", I get this error: "OSError: [WinError 126] The specified module could not be found" Does anyone have any guidance? Thank you in advance.
Raphael Vallat
@raphaelvallat
Hi @jmkendallbar, have you closely followed the installation instructions on the documentation? If so, are you running Visbrain directly from a Python script (and not from Python / Spyder or Jupyter notebook)? What are you trying to do with Visbrain? Unfortunately, Visbrain is not really updated and/or maintained anymore, and I would recommend the following alternatives: 1) for visualization of EEG data, use EDFBrowser, 2) for complex sleep analysis (spectral power, spindles detection, etc) use YASA (https://raphaelvallat.com/yasa/build/html/index.html). Thanks!
Jessica Kendall-Bar
@jmkendallbar
Hi @raphaelvallat, yes, I've done everything in the instructions but suspect that I am running awry with my file directories. I used anaconda to install both visbrain and now your package, YASA, and when I go to Python, I add the file directory where YASA and visbrain are in my computer (sys.path.append('c:\programdata\anaconda3\lib\site-packages')) and then still get an error when I try "import yasa", with the error ModuleNotFoundError: No module named 'yasa'. However, when I open that file directory in my file browser, I see the folder named yasa. Let me know if you have any tips and thank you for pointing us to your updated tool. I am using EDF Browser to visualize my seal sleep data but would appreciate exploring automated tools to analyze it.
Raphael Vallat
@raphaelvallat
Seal sleep data -- pretty cool!! I think there might be something wrong with your Anaconda installation then, because you shouldn't have to add the site-packages to the path each time you run Python. Do you use the default Anaconda environment (base) or a custom one? If you're using Windows, you may want to add Anaconda directly to your PATH variables.
Jessica Kendall-Bar
@jmkendallbar
Hi, I am using Windows and using the Anaconda environment (base). How do I add Anaconda directly to my PATH variables?
nilauom
@nilauom
Could you please help me to find the python tutorial for sleep onset detection. how I can start ?
Raphael Vallat
@raphaelvallat
Hi @nilauom. Sleep onset detection is not implemented in Visbrain. However, I have recently developed a machine-learning based tool for automatic sleep staging. You can find it here: https://raphaelvallat.com/yasa/build/html/generated/yasa.SleepStaging.html
nilauom
@nilauom
Hi @raphaelvallat . many thank you kind your reply
Ilana Hairston
@piliphant_twitter
hello - i'm new to visbrain/sleep. It was working fine until i installed big sur, and i keep getting "AttributeError: dlsym(RTLD_DEFAULT, CFStringCreateWithCString): symbol not found" when trying to launch sleep gui. Any ideas?
Raphael Vallat
@raphaelvallat
Hi @piliphant_twitter, are you using Python 3? This is not an issue with Visbrain, instead it seems to be related to the conda installation (see here: conda/conda#10361). I'd therefore suggest a fresh reinstall of Python3 using conda
Ilana Hairston
@piliphant_twitter
thanks @raphaelvallat i tried anaconda and i think i got the same result. but to be honest i tried so many options at this point, i could be mistaken. will try again. The problem is with vispy, but given that it's a backbone of visbrain, i would have thought others would have encountered a similar issue.
Raphael Vallat
@raphaelvallat
Hi @piliphant_twitter have you opened an issue on the GitHub of Vispy? So sorry I cannot be of more help
Ilana Hairston
@piliphant_twitter
@raphaelvallat others have opened the issue before me. Some have posted work-arounds. But I haven’t been able to implement them. It’s odd that I’m the first to report the issue here. Perhaps not many are using OS X 10.16.
MarcoSleepCBT-I
@MarcoSleepCBT-I

Hi @raphaelvallat. I'm trying to load and .edf PSG and a .txt scoring. I can load the traces, nevertheless the loading of the scoring lock my computer...According with http://visbrain.org/sleep.html#hypnogram I converted stages from e.g. "STAGE-S1" to "1", because i extracted the scoring from RemLogic software. However, the .txt file has in every line a 30-second epoch, is it a problem? In addition, Do I have to enter first 4 lines like this?:
time_base 1.000000
sampling_period 0.030
epoch_nb (e.g. 857)
epoch_list

If you send me a format (example) of a .txt that could be run with the GUI could be very useful for me. Thank you very much!

MarcoSleepCBT-I
@MarcoSleepCBT-I
ExampleScoring.png
This is an example of a scoring file with in every line a 30-sec epoch, i need to convert it in order to upload from the GUI. Thank again!
Raphael Vallat
@raphaelvallat
Hi @MarcoSleepCBT-I ! So you need to convert your hypnogram to a Visbrain-compatible format. I'd suggest keeping the .txt format, but replacing all the strings by numbers, e.g. SLEEP-S1 --> 1
Once you do that, you will also need to create a "description" file which contains the stage mapping of your hypnogram as well as the time resolution, as illustrated here: https://drive.google.com/file/d/0B6vtJiCQZUBvYUFnQS1HWHhjSkE/view
So you will need to replace "time 5" by "time 30"
Screen Shot 2021-03-09 at 10.55.17 AM.png
See this section of the documentation for more details:
MarcoSleepCBT-I
@MarcoSleepCBT-I

Hi @raphaelvallat. Perfect! Now i have two .txt files: one with the scoring (in every line 30-second epoch) and one "description" file equal to your drive link but with "time 30" instead of "time 5". And then? when the GUI ask me the scoring file, should i select both files?

Thanks again.

MarcoSleepCBT-I
@MarcoSleepCBT-I
I tried to select first of all the traces, and it works, then the "description" file (because i can select just one file) but this error comes up:
Immagine.png
Raphael Vallat
@raphaelvallat
Hi @MarcoSleepCBT-I, you just need to select the .txt file with the sleep stages, not the "_description.txt" file
Make sure that the file naming is correct too. If your hypnogram is named "hypnogram.txt" then the description file should be named "hypnogram_description.txt"
MarcoSleepCBT-I
@MarcoSleepCBT-I
Hi @raphaelvallat. I really thank you for your step by step support. Now it works!!
oo-zz
@oo-zz
I'm using Zmax lite to capture my sleep data. There are a number of EDF files and, specifically, two EEG files (L & R). However, i am only able to upload one because it is saying there is only 1 channel.
I'm also not familiar w/Python at all. Can anyone help me?
oo-zz
@oo-zz
image.png
image.png
Raphael Vallat
@raphaelvallat
Hi @oo-zz, to visualize your sleep data in EDF Format I would strongly recommend using the free software EDFBrowser (https://www.teuniz.net/edfbrowser/) instead of Visbrain
oo-zz
@oo-zz
@raphaelvallat is this able to score the data? I saw your software on github but i couldnt figure out how to work it.
Raphael Vallat
@raphaelvallat
It is not able to score the data, but so is Visbrain. You can score the data using YASA. Please follow the example at: https://github.com/raphaelvallat/yasa/blob/master/notebooks/14_automatic_sleep_staging.ipynb Thanks!
oo-zz
@oo-zz
@raphaelvallat when i upload my hypnogram file using YASA, i get the following output:
array(['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '2', '2', '1',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '5', '2', '2',
'2', '5', '5', '2', '2', '2', '2', '2', '2', '2', '2', '2', '1',
'1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '2',
'5', '5', '5', '5', '5', '5', '1', '1', '1', '1', '1', '1', '1',
'1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1',
'1', '5', '1', '1', '1', '1', '1', '1', '5', '1', '1', '1', '2',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '5',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
'2', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5',
'5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5',
'5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5',
'5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5',
'5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5',
'5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5',
'5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5',
'5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5',
'5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5',
'5', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '1', '1', '1', '1',
'1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1',
'1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1',
'1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1',
'5', '5', '5', '1', '1', '1', '1', '1', '1', '1', '2', '2', '2',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '5', '2',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
'2', '2', '2', '2', '5', '5', '2', '2', '2', '2', '2', '2', '2',
'2', '2', '2', '2', '2', '2', '1', '1', '1', '1', '1', '1', '1',
'1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1',
'1', '1', '1', '1', '5', '1', '1', '1', '1', '1', '1', '1', '1',
'1', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
'2', '2', '2', '2', '2', '2', '5', '2', '2', '2', '2', '2', '2',
'2', '2', '2', '2', '2', '2', '2', '5', '5', '5', '5', '5', '2',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
'2', '2', '2', '2', '2', '2', '5', '5', '2', '2', '2', '2', '2',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '5', '2', '2', '2',
'2', '2', '2', '2', '2', '1', '1', '1', '1', '1', '1', '1', '1',
'1', '1', '5', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1',
'1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1',
'1', '1', '1', '1', '1', '1', '5', '1', '1', '2', '2', '2', '5',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
'5', '5', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '1', '1',
'1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1',
'1', '1', '1', '1', '1', '1', '1', '1', '1', '5', '1', '1
Any idea why this is occuring?
oo-zz
@oo-zz
@raphaelvallat got it working!!