Slow Wave Sleep enhancement, using OpenBCI [2019, complete open source project]
Hi there,
My name is Alec Sheffield, I am an undergraduate researcher at Colorado College. I am working with Nina Friedman, who has posted here in the past, on an independent study using the OpenBCI. At our school we take four classes a semester, one at a time for 3.5 weeks. That means that currently we are working full time on our project, and this is our third day.
We are trying to replicate the study here
My name is Alec Sheffield, I am an undergraduate researcher at Colorado College. I am working with Nina Friedman, who has posted here in the past, on an independent study using the OpenBCI. At our school we take four classes a semester, one at a time for 3.5 weeks. That means that currently we are working full time on our project, and this is our third day.
We are trying to replicate the study here
Auditory Closed-Loop Stimulation of the Sleep Slow Oscillation Enhances Memory
Essentially researchers took data from a prefrontal EEG while participants slept after performing a memory exercise. The EEG was filtered between .25-4 Hz, and slow waves were detected when the signal crossed a threshold amplitude of -80 microvolts. Once the slow waves were detected, two beeps of pink noise were presented at the top of the next two slow wave up peaks, increasing both the amplitude and number of slow waves, ultimately improving memory consolidation. After detection, the program only needed two parameters which were found manually be analyzing a participants EEG data from a prior night. The parameters were the time between detection and the first up-peak, and then the time between the first and second up-peaks. Ideally we would like to create a program which can find the parameters without manual input.
Initially we were going to work on the project on cloudbrain, but the developer informed us that cloudbrain is not ready and we should look to other options. He recommended just coding it in python ourselves, something we are definitely exploring. The issue is that neither of us has tremendous programming experience, and we only have a month to complete this project. My focus is strongly on neuroscience, physics, and math, so my programming abilities are currently not what I would I like, but one has to make sacrifices for school. I am working on programming independently, but I don't want my EEG usage this month to be limited by my current programming experience.
I was wondering if anyone had any guidance towards programs or packages we should look into for our project. I have python and matlab, along with python-MNE, anaconda, EEGlab, and brainstorm. I also have openvibe, metabrain, and neurovibe. If anyone is interested, we would love for someone with more experience to help guide us and help out with the programming aspects. I'd like to be able to actually perform the slow-wave sleep stimulation as soon as possible, so I could perform testing on the long-term effects of the stimulation. Thanks in advance for any help, I'm so grateful to have this opportunity thanks to the OpenBCI team, and I know from browsing the forums that the people here are incredibly knowledgeable and experienced with EEG usage.
Have a wonderful day,
Alec
Initially we were going to work on the project on cloudbrain, but the developer informed us that cloudbrain is not ready and we should look to other options. He recommended just coding it in python ourselves, something we are definitely exploring. The issue is that neither of us has tremendous programming experience, and we only have a month to complete this project. My focus is strongly on neuroscience, physics, and math, so my programming abilities are currently not what I would I like, but one has to make sacrifices for school. I am working on programming independently, but I don't want my EEG usage this month to be limited by my current programming experience.
I was wondering if anyone had any guidance towards programs or packages we should look into for our project. I have python and matlab, along with python-MNE, anaconda, EEGlab, and brainstorm. I also have openvibe, metabrain, and neurovibe. If anyone is interested, we would love for someone with more experience to help guide us and help out with the programming aspects. I'd like to be able to actually perform the slow-wave sleep stimulation as soon as possible, so I could perform testing on the long-term effects of the stimulation. Thanks in advance for any help, I'm so grateful to have this opportunity thanks to the OpenBCI team, and I know from browsing the forums that the people here are incredibly knowledgeable and experienced with EEG usage.
Have a wonderful day,
Alec
Comments
You and Nina have chosen an interesting and challenging project. I'll just mention a couple of things that caught my eye. I only glanced at the paper for a minute or so.
Wiring up a subject for a sleep EEG study could be challenging. As you can see in their paper or video, they used a full head elastic cap that holds the electrodes in place. They might have also used a special gel injected in the cap holes that does not dry out over night. I don't know what materials sleep labs use if they don't have such caps. But I have heard that in the bad old days they would even temporarily 'glue' on separate electrodes to the head using a yuchy thing called Colloidion. The full head cap is definitely an advancement. The Ten20 paste in the kits is usable for some period of time, but I don't know that it would last all night without drying out. That's what they used the Collodion for, as a sealant. Maybe if you had a swim cap on over that?
I myself have not experienced a night in a sleep lab, but I did have a loaner device, Stephen LaBerge's early Lucid Dreaming Mask, that involved a mask with LEDs and sensors, connected via cables to a bedside computer. Concept sounds reasonable. I was never able to really sleep well with it, was getting tangled up in the wires, etc.
They show a pattern recognition algorithm in the paper, but my impression is that this only runs during a certain sleep stage? How are you going to categorize the sleep stages in real time? I guess you'll have your partner there by the bedside staying up all night looking for the right stage in which to engage the feedback. This sounds doable, but also potentially draining on the person gathering the data. Sleep stage recognition is a whole subject in itself.
The suggestion by the Cloudbrain guy seems correct, to code your algorithm in Python. The signal recognition shown in the paper is unique enough, I don't think you'll find pre-built support for it in any of the EEG packages you mention. Although there might be some sleep specific EEG software out there, I don't know. You might try writing the authors to see what they used.
Be aware that some users have reported the OpenBCI module can momentarily get frozen when collecting very long datasets, typically an hour+. There is a way to automatically reset out of that condition usually by doing a soft reset. Or if your monitor is present there at bedside, they can do whatever manual reset is needed.
Best regards,
William
Python libraries are available which do signal processing,
https://www.google.com/search?q=python+dsp
So you don't really need OpenViBE for filters or FFTs. I'll mention Jeremy Frey @jfrey here, he is an OpenViBE wizard. If you are just starting out in programming, you may find the Python easier to deal with than the C++ that OpenViBE is based on. And the Python DSP libraries are likely easier to get up to speed with than the mountain of MATLAB / EEGLAB.
Chip has some Python EEG code here,
https://github.com/chipaudette/EEGHacker
Regards, William