Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dataset summary in CSV and leaderboard links #635

Merged
merged 18 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ help:
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@python prepare_summary_tables.py ../moabb/datasets $(BUILDDIR)
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

apidoc:
Expand Down
34 changes: 34 additions & 0 deletions docs/prepare_summary_tables.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import glob
from argparse import ArgumentParser
from pathlib import Path

import pandas as pd


def prepare_table(df: pd.DataFrame):
no_pwc = df["PapersWithCode leaderboard"].isna()
df.loc[no_pwc, "PapersWithCode leaderboard"] = "No"
df.loc[~no_pwc, "PapersWithCode leaderboard"] = df.loc[
~no_pwc, "PapersWithCode leaderboard"
].apply(lambda x: f"`Yes <{x}>`_")
df["Dataset"] = df["Dataset"].apply(lambda x: f":class:`{x}`")


def main(source_dir: str, target_dir: str):
target_dir = Path(target_dir)
target_dir.mkdir(parents=True, exist_ok=True)
files = glob.glob(str(Path(source_dir) / "*.csv"))
for f in files:
target_file = target_dir / Path(f).name
print(f"Processing {f} -> {target_file}")
df = pd.read_csv(f, index_col=False, header=0, skipinitialspace=True)
prepare_table(df)
df.to_csv(target_file, index=False)


if __name__ == "__main__":
parser = ArgumentParser()
parser.add_argument("source_dir", type=str)
parser.add_argument("target_dir", type=str)
args = parser.parse_args()
main(args.source_dir, args.target_dir)
70 changes: 11 additions & 59 deletions docs/source/dataset_summary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,66 +22,28 @@ Motor Imagery
======================

.. csv-table::
:header: Dataset, #Subj, #Chan, #Classes, #Trials, Trial length, Freq, #Session, #Runs, Total_trials
:file: ../build/summary_imagery.csv
:header-rows: 1
:class: sortable

:class:`AlexMI`,8,16,3,20,3s,512Hz,1,1,480
:class:`BNCI2014_001`,9,22,4,144,4s,250Hz,2,6,62208
:class:`BNCI2014_002`,14,15,2,80,5s,512Hz,1,8,17920
:class:`BNCI2014_004`,9,3,2,360,4.5s,250Hz,5,1,32400
:class:`BNCI2015_001`,12,13,2,200,5s,512Hz,3,1,14400
:class:`BNCI2015_004`,9,30,5,80,7s,256Hz,2,1,7200
:class:`Cho2017`,52,64,2,100,3s,512Hz,1,1,9800
:class:`Lee2019_MI`,54,62,2,100,4s,1000Hz,2,1,11000
:class:`GrosseWentrup2009`,10,128,2,150,7s,500Hz,1,1,3000
:class:`Schirrmeister2017`,14,128,4,120,4s,500Hz,1,2,13440
:class:`Ofner2017`,15,61,7,60,3s,512Hz,1,10,63000
:class:`PhysionetMI`,109,64,4,23,3s,160Hz,1,1,69760
:class:`Shin2017A`,29,30,2,30,10s,200Hz,3,1,5220
:class:`Shin2017B`,29,30,2,30,10s,200Hz,3,1,5220
:class:`Weibo2014`,10,60,7,80,4s,200Hz,1,1,5600
:class:`Zhou2016`,4,14,3,160,5s,250Hz,3,2,11496
:class:`Stieger2021`,62,64,4,450,3s,1000Hz,7 or 11,1,250000

P300/ERP
======================

.. csv-table::
:header: Dataset, #Subj, #Chan, #Trials / class, Trials length, Sampling rate, #Sessions
:file: ../build/summary_p300.csv
:header-rows: 1
:class: sortable

:class:`BNCI2014_008`, 8, 8, 3500 NT / 700 T, 1s, 256Hz, 1
:class:`BNCI2014_009`, 10, 16, 1440 NT / 288 T, 0.8s, 256Hz, 3
:class:`BNCI2015_003`, 10, 8, 1500 NT / 300 T, 0.8s, 256Hz, 1
:class:`BI2012`, 25, 16, 640 NT / 128 T, 1s, 128Hz, 2
:class:`BI2013a`, 24, 16, 3200 NT / 640 T, 1s, 512Hz, 8 for subjects 1-7 else 1
:class:`BI2014a`, 64, 16, 990 NT / 198 T, 1s, 512Hz, up to 3
:class:`BI2014b`, 38, 32, 200 NT / 40 T, 1s, 512Hz, 3
:class:`BI2015a`, 43, 32, 4131 NT / 825 T, 1s, 512Hz, 3
:class:`BI2015b`, 44, 32, 2160 NT / 480 T, 1s, 512Hz, 1
:class:`Cattan2019_VR`, 21, 16, 600 NT / 120 T, 1s, 512Hz, 2
:class:`Huebner2017`, 13, 31, 364 NT / 112 T, 0.9s, 1000Hz, 3
:class:`Huebner2018`, 12, 31, 364 NT / 112 T, 0.9s, 1000Hz, 3
:class:`Sosulski2019`, 13, 31, 7500 NT / 1500 T, 1.2s, 1000Hz, 1
:class:`EPFLP300`, 8, 32, 2753 NT / 551 T, 1s, 2048Hz, 4
:class:`Lee2019_ERP`, 54, 62, 6900 NT / 1380 T, 1s, 1000Hz, 2


SSVEP
======================


.. csv-table::
:header: Dataset, #Subj, #Chan, #Classes, #Trials / class, Trials length, Sampling rate, #Sessions
:file: ../build/summary_ssvep.csv
:header-rows: 1
:class: sortable

:class:`Lee2019_SSVEP`,54,62,4,50,4s,1000Hz,2
:class:`Kalunga2016`,12,8,4,16,2s,256Hz,1
:class:`MAMEM1`,10,256,5,12-15,3s,250Hz,1
:class:`MAMEM2`,10,256,5,20-30,3s,250Hz,1
:class:`MAMEM3`,10,14,4,20-30,3s,128Hz,1
:class:`Nakanishi2015`,9,8,12,15,4.15s,256Hz,1
:class:`Wang2016`,34,62,40,6,5s,250Hz,1

c-VEP
======================
Expand All @@ -97,17 +59,10 @@ potentials (c-VEP): A literature review. Journal of Neural Engineering, 18(6), 0
DOI: https://doi.org/10.1088/1741-2552/ac38cf

.. csv-table::
:header: Dataset, #Subj, #Sessions, Sampling rate, #Chan, Trials length, #Trial classes, #Trials / class, #Epochs classes, #Epochs / class, Codes, Presentation rate
:file: ../build/summary_cvep.csv
:header-rows: 1
:class: sortable

:class:`Thielen2015`,12,1,2048Hz,64,4.2s,36,3,2,27216 NT / 27216 T,Gold codes,120Hz
:class:`Thielen2021`,30,1,512Hz,8,31.5s,20,5,2,18900 NT / 18900 T,Gold codes,60Hz
:class:`CastillosCVEP100`, 12,1,500Hz,32,2.2s,4,15/15/15/15,2,3525 NT / 3495 T,m-sequence,60Hz
:class:`CastillosCVEP40`, 12,1,500Hz,32,2.2s,4,15/15/15/15,2,3525 NT / 3495 T,m-sequence,60Hz
:class:`CastillosBurstVEP40`, 12,1,500Hz,32,2.2s,4,15/15/15/15,2,5820 NT / 1200 T,Burst-CVEP,60Hz
:class:`CastillosBurstVEP100`,12,1,500Hz,32,2.2s,4,15/15/15/15,2,5820 NT / 1200 T,Burst-CVEP,60Hz


Resting States
======================

Expand All @@ -116,12 +71,9 @@ For example, recoding the EEG of a subject while s/he is having the eye closed o
is a resting state experiment.

.. csv-table::
:header: Dataset, #Subj, #Chan, #Classes, #Blocks / class, Trials length, Sampling rate, #Sessions
:class: sortable

:class:`Cattan2019_PHMD`,12,16,2,10,60s,512Hz,1
:class:`Hinss2021`,15,62,4,1,2s,250Hz,1
:class:`Rodrigues2017`,20,16,2,5,10s,512Hz,1
:file: ../build/summary_rstate.csv
:header-rows: 1
:class: sortable

Compound Datasets
======================
Expand Down
2 changes: 1 addition & 1 deletion docs/source/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Develop branch

Enhancements
~~~~~~~~~~~~
- None
- Centralize dataset summary tables in CSV files (:gh:`635` by `Pierre Guetschel`_)

Bugs
~~~~
Expand Down
27 changes: 0 additions & 27 deletions moabb/datasets/Lee2019.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,6 @@ def data_path(
class Lee2019_MI(Lee2019):
"""BMI/OpenBMI dataset for MI.

.. admonition:: Dataset summary


========== ======= ======= ========== ================= ============ =============== ===========
Name #Subj #Chan #Classes #Trials / class Trials len Sampling rate #Sessions
========== ======= ======= ========== ================= ============ =============== ===========
Lee2019_MI 54 62 2 100 4s 1000Hz 2
========== ======= ======= ========== ================= ============ =============== ===========

Dataset from Lee et al 2019 [1]_.

**Dataset Description**
Expand Down Expand Up @@ -290,15 +281,6 @@ class Lee2019_MI(Lee2019):
class Lee2019_ERP(Lee2019):
"""BMI/OpenBMI dataset for P300.

.. admonition:: Dataset summary


=========== ======= ======= ================= =============== =============== ===========
Name #Subj #Chan #Trials / class Trials length Sampling rate #Sessions
=========== ======= ======= ================= =============== =============== ===========
Lee2019_ERP 54 62 6900 NT / 1380 T 1s 1000Hz 2
=========== ======= ======= ================= =============== =============== ===========

Dataset from Lee et al 2019 [1]_.

**Dataset Description**
Expand Down Expand Up @@ -380,15 +362,6 @@ class Lee2019_ERP(Lee2019):
class Lee2019_SSVEP(Lee2019):
"""BMI/OpenBMI dataset for SSVEP.

.. admonition:: Dataset summary


============= ======= ======= ========== ================= =============== =============== ===========
Name #Subj #Chan #Classes #Trials / class Trials length Sampling rate #Sessions
============= ======= ======= ========== ================= =============== =============== ===========
Lee2019_SSVEP 54 62 4 50 4s 1000Hz 2
============= ======= ======= ========== ================= =============== =============== ===========

Dataset from Lee et al 2019 [1]_.

**Dataset Description**
Expand Down
9 changes: 0 additions & 9 deletions moabb/datasets/Weibo2014.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,6 @@ def get_subjects(sub_inds, sub_names, ind):
class Weibo2014(BaseDataset):
"""Motor Imagery dataset from Weibo et al 2014.

.. admonition:: Dataset summary


========= ======= ======= ========== ================= ============ =============== ===========
Name #Subj #Chan #Classes #Trials / class Trials len Sampling rate #Sessions
========= ======= ======= ========== ================= ============ =============== ===========
Weibo2014 10 60 7 80 4s 200Hz 1
========= ======= ======= ========== ================= ============ =============== ===========

Dataset from the article *Evaluation of EEG oscillatory patterns and
cognitive process during simple and compound limb motor imagery* [1]_.

Expand Down
9 changes: 0 additions & 9 deletions moabb/datasets/Zhou2016.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,6 @@ def local_data_path(base_path, subject):
class Zhou2016(BaseDataset):
"""Motor Imagery dataset from Zhou et al 2016.

.. admonition:: Dataset summary


======== ======= ======= ========== ================= ============ =============== ===========
Name #Subj #Chan #Classes #Trials / class Trials len Sampling rate #Sessions
======== ======= ======= ========== ================= ============ =============== ===========
Zhou2016 4 14 3 160 5s 250Hz 3
======== ======= ======= ========== ================= ============ =============== ===========

Dataset from the article *A Fully Automated Trial Selection Method for
Optimization of Motor Imagery Based Brain-Computer Interface* [1]_.
This dataset contains data recorded on 4 subjects performing 3 type of
Expand Down
9 changes: 0 additions & 9 deletions moabb/datasets/alex_mi.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,6 @@
class AlexMI(BaseDataset):
"""Alex Motor Imagery dataset.

.. admonition:: Dataset summary


====== ======= ======= ========== ================= ============ =============== ===========
Name #Subj #Chan #Classes #Trials / class Trials len Sampling rate #Sessions
====== ======= ======= ========== ================= ============ =============== ===========
AlexMI 8 16 3 20 3s 512Hz 1
====== ======= ======= ========== ================= ============ =============== ===========

Motor imagery dataset from the PhD dissertation of A. Barachant [1]_.

This Dataset contains EEG recordings from 8 subjects, performing 2 task of
Expand Down
11 changes: 0 additions & 11 deletions moabb/datasets/alphawaves.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@
class Rodrigues2017(BaseDataset):
"""Alphawaves dataset

.. admonition:: Dataset summary


=============== ======= ======= ========== =============== ============ =============== ===========
Name #Subj #Chan #Classes #Blocks/class Trials len Sampling rate #Sessions
=============== ======= ======= ========== =============== ============ =============== ===========
Rodrigues2017 20 16 2 5 10s 512Hz 1
=============== ======= ======= ========== =============== ============ =============== ===========


Dataset containing EEG recordings of subjects in a simple
resting-state eyes open/closed experimental protocol. Data were recorded
during a pilot experiment taking place in the GIPSA-lab, Grenoble,
Expand Down Expand Up @@ -139,7 +129,6 @@ def _get_single_subject_data(self, subject):
def data_path(
self, subject, path=None, force_update=False, update_path=None, verbose=None
):

if subject not in self.subject_list:
raise (ValueError("Invalid subject number"))

Expand Down
Loading
Loading