Skip to content

bertrandlalo/timeflux_ssvep

Repository files navigation

Online SSVEP in Riemanian manifold

Pre-requisite

Follow Timeflux Getting Started Instructions.

Installation

You have the choice between virtual env or conda env:

  • conda env

       conda env create -f  environment.yaml
       conda activate ssvep-env
    
  • virtual env

       python3 -m venv venv
       source venv/bin/activate
       pip install -r requirements.txt
    

Usage

  • Script to get HDF5 (todo: parse args to allow user to choose params)

      python make_hdf5.py
    
    • this should download data from MOABB and convert them in HDF5 timeflux-replayable data that will be stored in folder ./data
    • By default, train_runs=('run_0',), ie. the first run will be considered as calibration data and the rest as test data. You can change those if you wish.
  • Replay the data and online SSVEP fit_predict with Timeflux

      timeflux -d graphs/main.yaml
    
    • This will replay data from one subject 'in real time' (by default, subject 12) /!\ takes between 9 and 18 minutes to run - as long as the experiment /!\
    • If you want to try an choose the subject to replay, set variable FILE in your environment, or launch the command with -e FILE={subject-number-between-1-and-12}.
      For example, to replay data from subject #1, run :
      timeflux -e FILE=1 -d graphs/main.yaml
    
    • This should display events and predictions in the console.

    • The output events will be dumped in a csv with name set line 14 of file graphs/dump.yaml : predictions_{FILE}.csv.

    • Output looks like :

    label data timestamp
    train_starts {} 2020-01-01 00:01:08.703125
    flickering_starts {'target': '13Hz'} 2020-01-01 00:01:08.707031250
    flickering_starts {'target': '13Hz'} 2020-01-01 00:01:17.707031250
    flickering_starts {'target': '17Hz'} 2020-01-01 00:01:53.707031250
    flickering_starts {'target': '21Hz'} 2020-01-01 00:02:02.707031250
    ... ... ...
    train_stops {} 2020-01-01 00:05:53.621093750
    flickering_starts {'target': '13Hz'} 2020-01-01 00:06:39.941406250
    predict {'result': '13Hz'} 2020-01-01 00:06:38.941406250
    flickering_starts {'target': '13Hz'} 2020-01-01 00:06:48.941406250
    predict {'result': '13Hz'} 2020-01-01 00:06:47.941406250

    Timeflux CLI

  • Notebooks

      jupyter notebook
    
    • "Online-Offline.ipynb" illustrate the sklearn pipeline offline
    • "Timeflux prediction.ipynb" loads the csv output file from Timeflux with events and predictions and plot a confusion matrix

References

Results

Subject 1 Subject 2 Subject 3 Subject 4 Subject 5 Subject 6 Subject 7 Subject 8 Subject 9 Subject 10 Subject 11 Subject 12

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published