EtienneCmb / visbrain

A multi-purpose GPU-accelerated open-source suite for brain data visualization
http://visbrain.org
Other
241 stars 64 forks source link

Automatic detection of sleep spindles issue. #73

Open Dolki opened 4 years ago

Dolki commented 4 years ago

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 Screen Shot 2020-04-03 at 12 26 32 AM
raphaelvallat commented 4 years ago

Hi @Dolki !

1) 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.

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

Dolki commented 4 years ago

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

raphaelvallat commented 4 years ago

Hi @Dolki !

1) YASA is designed to be used with Jupyter notebook or Jupyter Lab

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