visbrain
visbrain copied to clipboard
Automatic detection of sleep spindles issue.
Hello! -I have been trying to use the automatic detection of sleep spindles in python/Sleep modifying the settings but is does not seem to work properly. It seems that the number of spindles that are detected is the same no matter what frequency threshold I am using. Is there any explanation for that?
-In addition, many "spindle events" that are detected are not actual spindles, and some of the spindles that I can visually detect are missing form the automatic detection. Is there any suggestion for the proper use of this automatic detection tool ?
![Screen Shot 2020-04-03 at 12 26 57 AM](https://user-images.githubusercontent.com/63086998/78324215-104d1580-7542-11ea-9151-285ecf58171d.png)
![Screen Shot 2020-04-03 at 12 26 32 AM](https://user-images.githubusercontent.com/63086998/78324222-13480600-7542-11ea-9f68-3557dab52238.png)
Hi @Dolki !
-
Thanks for noting the issue with the frequency. In fact, what's happening under the hood is that Visbrain is automatically detecting the peak frequency in the 11 - 16 Hz power spectrum and then using a 1 Hz bandwidth around the peak. So, the Fmin and Fmax are not taken into account. I'll work on a PR to make this explicit.
-
For a better and more accurate spindles detection, I highly recommend my command-line package YASA, specifically the yasa.spindles_detect function. As explained in the docs, you can also link YASA to Visbrain if you want to visualize the detected spindles.
Hope this helps, Raphael
Hi @raphaelvallat !
Thank you so much for your response! I took a look at your suggestions and I have a couple of questions. -Is there a command line interface that I can use for YASA? (it seems to me that I have to create a new .py file, with yasa.spindles_detect in it and then run the .py file from the terminal).
-I gave it a shot and I saw that I have to give an array like argument as data. My data are .edf files. Do you have any suggestions?
Thanks a lot, Dolki
Hi @Dolki !
-
YASA is designed to be used with Jupyter notebook or Jupyter Lab
-
To load EDF files into memory, please refer to the mne.io.read_raw_edf function
I would also recommend that you have a look at the tutorials to familiarize yourself with the functions.
Hope this helps! Raphael