t9_ssvep

Python Implementation for a real time SSVEP-based BCI using a stream of EEG data trough LSL

https://github.com/ludovicdmt/t9_ssvep

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
    Links to: nature.com, ieee.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.1%) to scientific vocabulary

Keywords

bci eeg real-time ssvep-bci
Last synced: 6 months ago · JSON representation ·

Repository

Python Implementation for a real time SSVEP-based BCI using a stream of EEG data trough LSL

Basic Info
  • Host: GitHub
  • Owner: ludovicdmt
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 27.3 KB
Statistics
  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
bci eeg real-time ssvep-bci
Created almost 4 years ago · Last pushed over 3 years ago
Metadata Files
Readme Citation

README.md

T9 BCI using SSVEP

Python scripts of a Brain Computer Interface (BCI) using SSVEP stimuli to operate a T9 (11 classes). The online (synchronous) classification relies on TRCA. The GUI is using Psychopy3.
It was developped in the Human-Factors department of ISAE-Supaero (France) by the team under the supervision of Frédéric Dehais.

The code was used for the last experiment described in our paper Improving user experience of SSVEP BCI through low amplitude depth and high frequency stimuli design (2022, Scientific Report).

Contents

Dependencies
Installation
Example usage
Help

Dependencies

Installation

Clone the repo:

bash git clone https://github.com/ludovicdmt/t9_ssvep cd ${INSTALL_PATH}

Install conda dependencies and the project with

bash conda env create -f environment.yml

The pyRiemann package has to be installed separately using pip: bash conda activate psychopy pip install pyriemann

If the dependencies in environment.yml change, update dependencies with

bash conda env update --file environment.yml

You will need to set path to the scripts in either run_T9.sh or run_T9.bat.
Depending on your EEG system, you may want to change the electrodes selection. Here it works with BrainProduct system streaming the electrode number, instead of their names.

This was tested using an EEG BrainProduct system with a native sampling frequency Fs of 500Hz, downsampled to 250Hz for the TRCA algorithm. If your EEG system uses a lower sampling frequency, please consider changing the downsampling argument, to ensure that the signal fed to TRCA algorithm is sampled at 250Hz.

Example Usage

Run it on Linux:

bash cd ${INSTALL_PATH} chmod u+x run_T9.sh ./run_T9.sh

Or on Windows, just click on run_T9.bat.

The script will first run a calibration phase, used to train the classification model. This model will be saved in the main directory, along calibration data. This model can be re-used within the same session and with the same subject.

A PyLSL stream from an EEG is required to make the script run.

To change frequencies, phases or amplitude of the stimuli please go to the config file.

Help

You will probably need to do some adjustement to collect EEG stream if you are not using a BrainProduct EEG.
If you experience issues during use of this code, you can post a new issue on the issues webpage.
I will reply to you as soon as possible and I'm very interested in to improve it.

References

  1. M. Nakanishi, Y. Wang, X. Chen, Y. -T. Wang, X. Gao, and T.-P. Jung, "Enhancing detection of SSVEPs for a high-speed brain speller using task-related component analysis", IEEE Trans. Biomed. Eng, 65(1): 104-112, 2018. http://ieeexplore.ieee.org/document/7904641/
  2. X. Chen, Y. Wang, M. Nakanishi, X. Gao, T. -P. Jung, S. Gao, "High-speed spelling with a non-invasive brain-computer interface", Proc. Natl. Acad. Sci. U.S.A, 112(44): E6058-E6067, 2015. http://www.pnas.org/content/early/2015/10/14/1508080112.abstract
  3. Peirce, J. W., Gray, J. R., Simpson, S., MacAskill, M. R., Höchenberger, R., Sogo, H., Kastman, E., Lindeløv, J. (2019). PsychoPy2: experiments in behavior made easy. Behavior Research Methods. 10.3758/s13428-018-01193-y

Owner

  • Login: ludovicdmt
  • Kind: user
  • Company: ISAE-Supaero

Machine Learning, Statistical Learning, Image Forensics, BCI and EEG

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Ladouce"
  given-names: "Simon"
- family-names: Darmet"
  given-names: "Ludovic"
- family-names: "Torre Tresols"
  given-names: "Juan"
- family-names: "Velut"
  given-names: "Sebastien"
- family-names: "Ferraro"
  given-names: "Giuseppe"
- family-names: "Dehais"
  given-names: "Frederic"
title: "Improving user experience of SSVEP BCI through low amplitude depth and high frequency stimuli design"
doi: 10.1038/s41598-022-12733-0
url: https://doi.org/10.1038/s41598-022-12733-0
date-released: 2022-05-25

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Dependencies

environment.yml conda
  • numpy
  • pandas
  • pickle
  • psychopy
  • pylsl
  • pyriemann
  • python 3.8.*
  • scikit-learn
  • scipy