Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederik-D-Weber committed Jan 11, 2019
1 parent 0bf7b1a commit cf12cce
Show file tree
Hide file tree
Showing 697 changed files with 219,513 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
/cosleep_RAM
*.zip
695 changes: 695 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

59 changes: 59 additions & 0 deletions README.md
@@ -0,0 +1,59 @@
#COsleep
Closed- and Open-loop (Slow Ocillations) sleep stimulation (auditory) or recording in _full_-PSG using OpenBCI for sleep.

* Its a **fun project**, but with hard science behind in hardware, software and concept, usable for research.
* Different modes: e.g. Stimulation, Recording only (just PSG, no stimulation), record on SD card without real-time monitoring/stimulation
* Setup for OpenBCI sleep recording (125 or 250 Hz sampling rate, 8 or 16 channels, incl. EEG, EOG, EMG and ECG) [here](https://www.spisop.org/openbci/)
* Build your own sleep lab for under a $1000 and do research-grade recording and reactivation protocols.
* Its free, its open and its closed-loop too, at least for slow waves/slow oscillations.
* Targeted & Untargeted Auditory Stimuli Presentation using Configurable Stimuli Playlists (easy to create and mix).
* Reproduce all the published research in this area, e.g. Targeted Memory Reactivation (TMR, e.g Rudoy et al. 2009) during sleep, or Slow wave enhancement (Ngo et al. 2013)
* Stimulate during a specific time point of a slow oscillation, and trigger another stimuli after that.
* Stimulation is activated manually, but disengaged automatically on arousal.
* See live ERPs from stimulation
* Latencies considered in stimulation (below 10 ms signal latency, auditory delay down to 24 ms, standard 93 ms)
* 100% logging what you did, all markers, Lights-off on, checklist for eye movements
* Lost samples are imputed and logged.
* works with parallel microSD card recording (250 Hz)
* Handles all kinds of auditory stimuli, peeps, noises, voices and baaaams! (as long as in wav or mp3 format, or what [_sox_ can handle](http://sox.sourceforge.net/soxformat.html))
* Detect accurately your **hearing threshold** on any PC with Linux (alsa) down to the deciBel, and stimulate accurately as well with online-adjustments of volume.
* FUll unfiltered BDF & CSV export (live, and including all markers)
* Obfuscate your sham/stim condition for blinding your experiment.
* Realtime-view, scalable channels, with spindle highlighting.
* Flexible rereferencing
* ... lots of stuff, see the poster:
**[A poster with pictures and infographics, lists'n'stuff](https://drive.google.com/open?id=15XmB4hGwDl6L_oVv34uby7bRQaTBXUhu)**

**Tutorial in the making, otherwise ask the author.**

#External Download
1. [Example Data](https://drive.google.com/open?id=1lG-Q-U_NJ-pon1OYjL4bfOzeRWntyBL9) for testing the simulation (FREDDY is 8 channel, JINGYI is 16 channel data, settings described in [here](https://www.spisop.org/openbci/)
1. [Example Stimuli (preprocessed)](https://drive.google.com/open?id=1LlGVS8i8-biWbdamWvwoxJH3bp0wo1Ch) for testing the open and closed loop stimulation of voice and tones. Example protocols for those stimuli see in the subfolder [stimulations](http://github.com/Frederik-D-Weber/cosleep/software/installation/source_python/stimulations)
1. [Binaries, Ubuntu 18.04 LTS x64](https://drive.google.com/open?id=1BkZig25DqL_edzowbonLJYWGkWO9WNGj) compiled using pyinstaller
1. [Proof of concept learning Chinese in sleep files for ANKI](https://drive.google.com/open?id=1tC-79FaSCWTRyq7YmemzdTrxar4xp6q6) if you like to learn more chinese.

# Requirements
## EEG
1. OpenBCI Cyton board (optionally a daisy module)
1. EEG electrodes
1. Battery/Power pack
1. Other stuff to record polysomnography
1. Motivation to built a little (you can do it!)
...see tutorial [here](https://www.spisop.org/openbci/)

## PC (minimum recommendation)
* Dual core 1.2 Ghz
* 1.5 GB RAM
* 5 GByte free disk space
* USB 2.0 port
* Audio jack (wireless audio due to delay not recommended)
(e.g. a Rasperry Pi3, Pine64, Rock64, etc. are fine too)

## OS (preferred)
* Linux, e.g. Ubuntu 12.XX and newer versions it was **tested** under Ubunutu 14.04 LTS and 18.04 LTS)
* _low-latency_ kernel preferred (will automatically installed with the _deploy_ scripts)

## Tested PCs, deploy, run and compiled (pyinstaller)
* Lenovo Thinkpad X220, Intel Core i7-2640M, 16 GByte RAM, fast SSD, Ubuntu 18.04 LTS
* Lenovo Thinkpad X220, Intel Core i5-2520M, 16 GByte RAM, fast SSD, Ubuntu 14.04 LTS
* Dell Laptitude, Ubuntu 18.04 LTS
4 changes: 4 additions & 0 deletions _deploy.sh
@@ -0,0 +1,4 @@
#!/bin/bash
sudo bash deploy/configure_ubuntu.sh
sudo bash deploy/install_additional_software.sh
#sudo bash deploy/create_RAMdisk_example.sh
4 changes: 4 additions & 0 deletions _recompile.sh
@@ -0,0 +1,4 @@
#!/bin/bash
cd ${PWD}/software/installation/source_python/
bash deploy.sh
bash compile.sh
38 changes: 38 additions & 0 deletions deploy/configure_ubuntu.sh
@@ -0,0 +1,38 @@
#!/bin/bash
# tested in Ubuntu 18.04 LTS
# required setup for cosleep to work
sudo apt-get -y install linux-lowlatency
sudo apt-get -y install sox
sudo apt-get -yes install libsox-fmt-mp3
## workaround for permission of recorder_simulation to the ttyUSB*
sudo chmod 666 /dev/ttyUSB*
sudo usermod -a -G dialout $USER

# recommended setup
sudo add-apt-repository ppa:danielrichter2007/grub-customizer
sudo apt-get update
sudo apt-get -y install grub-customizer

gsettings set org.gnome.desktop.interface clock-show-seconds true
gsettings set org.gnome.nautilus.preferences executable-text-activation ask

# optional software and setup
## for python to run and compile the packages
sudo apt-get -y install cmake
sudo apt-get -y install python # probably already up to date
sudo apt-get -y install python-pip
sudo apt-get -y install python-qt4
sudo apt-get -y install python-alsaaudio

# to run from Files by double clicking
sudo apt-get -y install nautilus-actions # might not work

# to configure and check sound card properties
sudo apt-get -y install jackd2

## to track the CPU usage in a GUI
sudo add-apt-repository ppa:cpug-devs/ppa
sudo apt-get update
sudo apt-get -y install cpu-g # might not work


8 changes: 8 additions & 0 deletions deploy/create_RAMdisk_example.sh
@@ -0,0 +1,8 @@
#!/bin/bash
cd ../
mkdir cosleep_RAM
sudo mount -t tmpfs -o size=4000M none cosleep_RAM
rsync -av --progress ./ cosleep_RAM/
# see https://wiki.ubuntuusers.de/RAM-Disk_erstellen/
# sudo umount ${PWD}/../cosleep_RAM

9 changes: 9 additions & 0 deletions deploy/install_QjackCtl.sh
@@ -0,0 +1,9 @@
#!/bin/bash
sudo apt-get -y install qtbase5-dev-tools qtbase5-dev qt5-default qttools5-dev-tools
cd ${BASEDIR}/../software/installation/qjackctl-0.5.2
sudo apt-get -y install libjack-dev
./configure
make
sudo make install


3 changes: 3 additions & 0 deletions deploy/install_additional_software.sh
@@ -0,0 +1,3 @@
#!/bin/bash
bash install_edf_browser.sh
bash install_QjackCtl.sh
4 changes: 4 additions & 0 deletions deploy/install_anki.sh
@@ -0,0 +1,4 @@
#!/bin/bash
sudo apt-get -y install mplayer
sudo apt-get -y install mpv
sudo apt-get -y install anki
8 changes: 8 additions & 0 deletions deploy/install_edf_browser.sh
@@ -0,0 +1,8 @@
#!/bin/bash
sudo apt-get -y install g++ make git-core
#sudo apt-get -y install qtbase5-dev-tools qtbase5-dev qt5-default
sudo apt-get -y install qt4-qmake libqt4-dev
cd ${BASEDIR}/../software/installation/edfbrowser_164_source
sudo qmake-qt4
sudo make
sudo make install
2 changes: 2 additions & 0 deletions software/anki.sh
@@ -0,0 +1,2 @@
#!/bin/bash
anki
3 changes: 3 additions & 0 deletions software/edfbrowser.sh
@@ -0,0 +1,3 @@
#!/bin/bash
cd ${PWD}/data
edfbrowser

0 comments on commit cf12cce

Please sign in to comment.