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

Release candidate for v1.0.0 #502

Merged
merged 25 commits into from
Oct 19, 2023
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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
14 changes: 7 additions & 7 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ jobs:
python-version: ["3.9"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Create local data folder
run: |
@@ -44,10 +44,10 @@ jobs:

- name: Install dependencies
if: steps.cached-dataset-docs.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root --with docs,deeplearning
run: poetry install --no-interaction --no-root --with docs --extras deeplearning

- name: Install library
run: poetry install --no-interaction --with docs,deeplearning
run: poetry install --no-interaction --with docs --extras deeplearning

- name: Build docs
run: |
@@ -69,7 +69,7 @@ jobs:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Create local data folder
run: |
@@ -85,7 +85,7 @@ jobs:
docs/build

- name: Checkout moabb.github.io
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: "NeuroTechX/moabb.github.io"
path: moabb-ghio
@@ -101,7 +101,7 @@ jobs:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Create local data folder
run: |
@@ -117,7 +117,7 @@ jobs:
docs/build

- name: Checkout gh pages
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: gh-pages
path: moabb-ghpages
6 changes: 3 additions & 3 deletions .github/workflows/test-devel.yml
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ jobs:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
@@ -46,11 +46,11 @@ jobs:
if: |
(runner.os != 'Windows') &&
(steps.cached-poetry-dependencies.outputs.cache-hit != 'true')
run: poetry install --no-interaction --no-root --with deeplearning
run: poetry install --no-interaction --no-root --extras deeplearning

- name: Install library (Linux/OSX)
if: ${{ runner.os != 'Windows' }}
run: poetry install --no-interaction --with deeplearning
run: poetry install --no-interaction --extras deeplearning

- name: Install library (Windows)
if: ${{ runner.os == 'Windows' }}
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ jobs:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
@@ -46,11 +46,11 @@ jobs:
if: |
(runner.os != 'Windows') &&
(steps.cached-poetry-dependencies.outputs.cache-hit != 'true')
run: poetry install --no-interaction --no-root --with deeplearning
run: poetry install --no-interaction --no-root --extras deeplearning

- name: Install library (Linux/OSX)
if: ${{ runner.os != 'Windows' }}
run: poetry install --no-interaction --with deeplearning
run: poetry install --no-interaction --extras deeplearning

- name: Install library (Windows)
if: ${{ runner.os == 'Windows' }}
2 changes: 1 addition & 1 deletion bash/meta_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mne
#if you want used a specific branch instead of branch devolop
#if you want used a specific branch instead of branch develop
#changing the branch name git+REPOSITORY_LINK@BRANCH#egg=MOABB
git+https://github.com/NeuroTechX/moabb#egg=moabb
gdown
27 changes: 23 additions & 4 deletions docs/source/whats_new.rst
Original file line number Diff line number Diff line change
@@ -18,6 +18,24 @@ Develop branch
Enhancements
~~~~~~~~~~~~

- None

Bugs
~~~~

- None

API changes
~~~~~~~~~~~

- None


Version - 1.0.0 (Stable - PyPi)
---------------------------------

Enhancements
~~~~~~~~~~~~

- Adding extra thank you section in the documentation (:gh:`390` by `Bruno Aristimunha`_)
- Adding new script to get the meta information of the datasets (:gh:`389` by `Bruno Aristimunha`_)
@@ -59,7 +77,7 @@ Bugs

- Restore 3 subject from Cho2017 (:gh:`392` by `Igor Carrara`_ and `Sylvain Chevallier`_)
- Correct downloading with VirtualReality BrainInvaders dataset (:gh:`393` by `Gregoire Cattan`_)
- Rename event `substraction` to `subtraction` in :func:`moabb.datasets.Shin2017B` (:gh:`397` by `Pierre Guetschel`_)
- Rename event `subtraction` in :func:`moabb.datasets.Shin2017B` (:gh:`397` by `Pierre Guetschel`_)
- Save parameters of :func:`moabb.datasets.PhysionetMI` (:gh:`403` by `Pierre Guetschel`_)
- Fixing issue with parallel evaluation (:gh:`401` by `Bruno Aristimunha`_ and `Igor Carrara`_)
- Fixing SSLError from BCI competition IV (:gh:`404` by `Bruno Aristimunha`_)
@@ -81,15 +99,16 @@ Bugs
- Removing joblib Parallel (:gh:`488` by `Igor Carrara`_)
- Fix case when events specified via ``raw.annotations`` but no events (:gh:`491` by `Pierre Guetschel`_)
- Fix bug in downloading Shin2017A dataset (:gh:`493` by `Igor Carrara`_)
- Fix the cropped option in the dataset preprocessing (:gh:`502` by `Bruno Aristimunha`_)

API changes
~~~~~~~~~~~

- None


Version - 0.5.0 (Stable - PyPi)
---------------------------------
Version - 0.5.0
---------------

Enhancements
~~~~~~~~~~~~
@@ -316,7 +335,7 @@ Bugs
- Use stim_channels or check annotation when loading files in Paradigm (:gh:`72` by `Jan Sosulski`_)
- Correct MNE issues (:gh:`76` by `Sylvain Chevallier`_)
- Fix capitalization in channel names of cho dataset (:gh:`90` by `Jan Sosulski`_)
- Correct failling CI tests (:gh:`100` by `Sylvain Chevallier`_)
- Correct failing CI tests (:gh:`100` by `Sylvain Chevallier`_)
- Fix EPFL dataset flat signal sections and wrong scaling (:gh:`104` and :gh:`96` by `Jan Sosulski`_)
- Fix schirrmeister dataset for Python3.8 (:gh:`105` by `Robin Schirrmeister`_)
- Correct event detection problem and duplicate event error (:gh:`106` by `Sylvain Chevallier`_)
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions moabb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# flake8: noqa
__version__ = "0.5.0"
__version__ = "1.0.0"

from .benchmark import benchmark
from .utils import set_download_dir, set_log_level, setup_seed
from .utils import make_process_pipelines, set_download_dir, set_log_level, setup_seed
4 changes: 2 additions & 2 deletions moabb/analysis/results.py
Original file line number Diff line number Diff line change
@@ -120,9 +120,9 @@ def add(self, results, pipelines, process_pipeline): # noqa: C901
"""Add results."""

def to_list(res):
if type(res) is dict:
if isinstance(res, dict):
return [res]
elif type(res) is not list:
elif not isinstance(res, list):
raise ValueError(
"Results are given as neither dict nor"
"list but {}".format(type(res).__name__)
8 changes: 7 additions & 1 deletion moabb/datasets/base.py
Original file line number Diff line number Diff line change
@@ -44,6 +44,12 @@ class CacheConfig:
will be automatically downloaded to the specified folder.
verbose:
Verbosity level. See mne.verbose.

Notes
-----

.. versionadded:: 1.0.0

"""

save_raw: bool = False
@@ -272,7 +278,7 @@ def get_data(
process_pipeline=None,
):
"""
Return the data correspoonding to a list of subjects.
Return the data corresponding to a list of subjects.

The returned data is a dictionary with the following structure::

8 changes: 7 additions & 1 deletion moabb/datasets/bids_interface.py
Original file line number Diff line number Diff line change
@@ -75,6 +75,12 @@ class BIDSInterfaceBase(abc.ABC):
The processing pipeline used to convert the data.
verbose : str
The verbosity level.

Notes
-----

.. versionadded:: 1.0.0

"""

dataset: "BaseDataset"
@@ -300,7 +306,7 @@ def _write_file(self, bids_path, raw):
if raw.info.get("subject_info", None) is None:
# specify subject info as required by BIDS
raw.info["subject_info"] = {
"his_id": self.subject,
"his_id": subject_moabb_to_bids(self.subject),
}
if raw.info.get("device_info", None) is None:
# specify device info as required by BIDS
2 changes: 1 addition & 1 deletion moabb/datasets/bnci.py
Original file line number Diff line number Diff line change
@@ -1229,7 +1229,7 @@ class BNCI2015_004(MNEBNCI):
ground were placed at the left and right mastoid, respectively. The g.tec
GAMMAsys system with g.LADYbird active electrodes and two g.USBamp
biosignal
amplifiers (Guger Technolgies, Graz, Austria) was used for recording. EEG
amplifiers (Guger Technologies, Graz, Austria) was used for recording. EEG
was band pass filtered 0.5-100 Hz (notch filter at 50 Hz) and sampled at a
rate of 256 Hz.

2 changes: 1 addition & 1 deletion moabb/datasets/phmd_ml.py
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ class Cattan2019_PHMD(BaseDataset):
Notes
-----

.. versionadded:: 0.6.0
.. versionadded:: 1.0.0

References
----------
6 changes: 3 additions & 3 deletions moabb/datasets/preprocessing.py
Original file line number Diff line number Diff line change
@@ -125,8 +125,8 @@ def transform(self, raw, y=None):
if (
"Target" in event_id
and "NonTarget" in event_id
and type(event_id["Target"]) is list
and type(event_id["NonTarget"]) is list
and isinstance(event_id["Target"], list)
and isinstance(event_id["NonTarget"], list)
):
event_id_new = dict(Target=1, NonTarget=0)
events = mne.merge_events(events, event_id["Target"], 1)
@@ -254,7 +254,7 @@ def get_filter_pipeline(fmin, fmax):

def get_crop_pipeline(tmin, tmax):
return FunctionTransformer(
methodcaller("crop", tmin=tmax, tmax=tmin, verbose=False),
methodcaller("crop", tmin=tmin, tmax=tmax, verbose=False),
)


2 changes: 1 addition & 1 deletion moabb/evaluations/evaluations.py
Original file line number Diff line number Diff line change
@@ -107,7 +107,7 @@ def __init__(
raise ValueError(
"When passing data_size, please also indicate number of permutations"
)
if type(n_perms) is int:
if isinstance(n_perms, int):
self.n_perms = np.full_like(self.data_size["value"], n_perms, dtype=int)
elif len(self.n_perms) != len(self.data_size["value"]):
raise ValueError(
6 changes: 6 additions & 0 deletions moabb/paradigms/cvep.py
Original file line number Diff line number Diff line change
@@ -61,6 +61,12 @@ class BaseCVEP(BaseParadigm):

resample: float | None (default None)
If not None, resample the eeg data with the sampling rate provided.

Notes
-----

.. versionadded:: 1.0.0

"""

def __init__(
6 changes: 6 additions & 0 deletions moabb/paradigms/fixed_interval_windows.py
Original file line number Diff line number Diff line change
@@ -45,6 +45,12 @@ class BaseFixedIntervalWindowsProcessing(BaseProcessing):

marker: int (default -1)
Marker to use for the events created.

Notes
-----

.. versionadded:: 1.0.0

"""

def __init__(
10 changes: 9 additions & 1 deletion moabb/pipelines/__init__.py
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
"""

# flake8: noqa
from mne.utils import warn

from .classification import SSVEP_CCA, SSVEP_TRCA, SSVEP_MsetCCA
from .features import FM, AugmentedDataset, ExtendedSSVEPSignal, LogVariance
@@ -22,7 +23,14 @@
)
from .utils_deep_model import EEGNet, TCN_block
except ModuleNotFoundError as err:
print("Tensorflow not install, you could not use those pipelines")
warn(
"Tensorflow is not installed. "
"You won't be able to use these MOABB pipelines if you attempt to do "
"so.",
category=ModuleNotFoundError,
module="moabb.pipelines",
)


try:
from .utils_pytorch import (
2 changes: 2 additions & 0 deletions moabb/pipelines/classification.py
Original file line number Diff line number Diff line change
@@ -51,8 +51,10 @@ def __init__(self, interval, freqs, n_harmonics=3):
self.slen = interval[1] - interval[0]
self.freqs = freqs
self.n_harmonics = n_harmonics
self.classes_ = []
self.one_hot = {}
for i, k in enumerate(freqs.keys()):
self.classes_.append(i)
self.one_hot[k] = i

def fit(self, X, y, sample_weight=None):
13 changes: 7 additions & 6 deletions moabb/tests/datasets.py
Original file line number Diff line number Diff line change
@@ -308,12 +308,13 @@ def test_warning_if_parameters_false(self):
with self.assertWarns(UserWarning):
Cattan2019_VR(virtual_reality=False, screen_display=False)

def test_data_path(self):
ds = Cattan2019_VR(virtual_reality=True, screen_display=True)
data_path = ds.data_path(1)
assert len(data_path) == 2
assert "subject_01_VR.mat" in data_path[0]
assert "subject_01_PC.mat" in data_path[1]
# Access to Zenodo could fail on CI
# def test_data_path(self):
# ds = Cattan2019_VR(virtual_reality=True, screen_display=True)
# data_path = ds.data_path(1)
# assert len(data_path) == 2
# assert "subject_01_VR.mat" in data_path[0]
# assert "subject_01_PC.mat" in data_path[1]

def test_get_block_repetition(self):
ds = FakeVirtualRealityDataset()
2,069 changes: 1,137 additions & 932 deletions poetry.lock

Large diffs are not rendered by default.

37 changes: 21 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "moabb"
version = "0.5.0"
version = "1.0.0"
description = "Mother of All BCI Benchmarks"
authors = ["Alexandre Barachant", "Vinay Jayaram"]
maintainers = ["Sylvain Chevallier <sylvain.chevallier@universite-paris-saclay.fr>"]
@@ -10,47 +10,50 @@ documentation = "https://neurotechx.github.io/moabb"
keywords = ["eeg", "datasets", "reproducibility", "bci", "benchmark"]
license = "BSD-3-Clause"


[tool.poetry.dependencies]
python = ">=3.8, <3.12"
numpy = "^1.22"
scipy = "^1.9.3"
mne = "^1.4"
pandas = "^1.5.2"
h5py = "^3.7.0"
h5py = "<=3.8.0"
scikit-learn = "^1.2.0"
matplotlib = "^3.6.2"
seaborn = "^0.12.1"
pyriemann = "^0.3"
pyriemann = "^0.5"
PyYAML = "^6.0"
pooch = "^1.6.0"
requests = "^2.28.1"
urllib3 = "^1.26.15"
tqdm = "^4.64.1"
coverage = "^7.0.1"
memory-profiler = "^0.61.0"
edflib-python = "^1.0.6"
pytest = "^7.4.0"
mne-bids = "^0.13"

[tool.poetry.group.carbonemission]
optional = true
# Optional dependencies for carbon emission
codecarbon = { version = "^2.1.4", optional = true }

[tool.poetry.group.carbonemission.dependencies]
codecarbon = "^2.1.4" # for carbon emission
# Optional dependencies for deep learning
tensorflow = { version = ">=2.10,<2.13", optional = true }
keras = { version = ">=1.11.0", optional = true }
scikeras = { git = "https://github.com/adriangb/scikeras", optional = true }
braindecode = { version = "^0.7", optional = true }
torch = { version = "^1.13.1", optional = true }
libclang = { version = "^15.0", optional = true }

[tool.poetry.group.deeplearning]
optional = true

[tool.poetry.group.deeplearning.dependencies]
tensorflow = "^2.10"
keras = ">=1.11.0"
scikeras = { git = "https://github.com/adriangb/scikeras"}
braindecode = "^0.7"
torch = "^1.13.1"
libclang = "^15.0"
[tool.poetry.extras]
carbonemission = ["codecarbon"]
deeplearning = ["tensorflow", "keras", "scikeras", "braindecode", "torch", "libclang"]


[tool.poetry.group.docs]
optional = true


[tool.poetry.group.docs.dependencies]
Sphinx = "^5.3.0"
sphinx-gallery = "^0.11.1"
@@ -68,10 +71,12 @@ sphinx-rtd-theme = "^1.2.0"
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"


[tool.black]
line-length = 90
target-version = ["py38"]


[tool.isort]
src_paths = ["moabb"]
profile = "black"
670 changes: 0 additions & 670 deletions requirements.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -90,7 +90,7 @@ def __init__(self):
# ------------------
#
# We are now going to merge the two CompoundDataset into a single one.
# The implementation is straigh forward. Instead of providing a list of subjects,
# The implementation is straight forward. Instead of providing a list of subjects,
# you should provide a list of CompoundDataset.
# subjects_list = [CustomDataset1(), CustomDataset2()]