Braindecode 1.3.0.dev174649439__tar.gz → 1.3.0.dev175189654__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {braindecode-1.3.0.dev174649439/braindecode.egg-info → braindecode-1.3.0.dev175189654}/PKG-INFO +12 -2
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/augmentation/base.py +1 -1
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/datasets/__init__.py +12 -4
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/datasets/base.py +131 -152
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/datasets/bcicomp.py +4 -4
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/datasets/bids.py +3 -3
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/datasets/experimental.py +2 -2
- braindecode-1.3.0.dev175189654/braindecode/datasets/hub.py +962 -0
- braindecode-1.3.0.dev175189654/braindecode/datasets/hub_validation.py +113 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/datasets/mne.py +3 -5
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/datasets/moabb.py +17 -7
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/datasets/nmt.py +2 -2
- braindecode-1.3.0.dev175189654/braindecode/datasets/registry.py +120 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/datasets/sleep_physio_challe_18.py +2 -2
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/datasets/sleep_physionet.py +2 -2
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/datasets/tuh.py +2 -2
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/datasets/xy.py +2 -2
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/datautil/__init__.py +11 -1
- braindecode-1.3.0.dev175189654/braindecode/datautil/channel_utils.py +114 -0
- braindecode-1.3.0.dev175189654/braindecode/datautil/hub_formats.py +180 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/datautil/serialization.py +7 -8
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/eegneuralnet.py +2 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/functional/functions.py +6 -2
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/functional/initialization.py +2 -3
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/__init__.py +18 -1
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/atcnet.py +27 -28
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/attentionbasenet.py +39 -32
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/attn_sleep.py +2 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/base.py +280 -2
- braindecode-1.3.0.dev175189654/braindecode/models/bendr.py +469 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/biot.py +2 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/contrawr.py +2 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/ctnet.py +8 -3
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/deepsleepnet.py +28 -19
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/eegconformer.py +2 -2
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/eeginception_erp.py +31 -25
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/eegitnet.py +2 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/eegminer.py +2 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/eegnet.py +1 -1
- braindecode-1.3.0.dev175189654/braindecode/models/eegsym.py +917 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/eegtcnet.py +2 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/fbcnet.py +5 -1
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/fblightconvnet.py +2 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/fbmsnet.py +20 -6
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/ifnet.py +2 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/labram.py +193 -87
- braindecode-1.3.0.dev175189654/braindecode/models/luna.py +836 -0
- braindecode-1.3.0.dev175189654/braindecode/models/medformer.py +758 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/msvtnet.py +2 -0
- braindecode-1.3.0.dev175189654/braindecode/models/patchedtransformer.py +640 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/signal_jepa.py +111 -27
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/sinc_shallow.py +12 -9
- braindecode-1.3.0.dev175189654/braindecode/models/sstdpn.py +869 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/summary.csv +6 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/syncnet.py +2 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/tcn.py +2 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/usleep.py +26 -21
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/util.py +89 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/modules/attention.py +10 -10
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/modules/blocks.py +3 -3
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/modules/filter.py +2 -9
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/modules/layers.py +18 -17
- braindecode-1.3.0.dev175189654/braindecode/preprocessing/__init__.py +271 -0
- braindecode-1.3.0.dev175189654/braindecode/preprocessing/eegprep_preprocess.py +1317 -0
- braindecode-1.3.0.dev175189654/braindecode/preprocessing/mne_preprocess.py +240 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/preprocessing/preprocess.py +146 -51
- braindecode-1.3.0.dev175189654/braindecode/preprocessing/util.py +177 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/preprocessing/windowers.py +26 -20
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/samplers/base.py +8 -8
- braindecode-1.3.0.dev175189654/braindecode/version.py +1 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654/braindecode.egg-info}/PKG-INFO +12 -2
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode.egg-info/SOURCES.txt +13 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode.egg-info/requires.txt +13 -1
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/api.rst +132 -13
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/conf.py +27 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/index.rst +1 -1
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/install/install_pip.rst +7 -1
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/install/install_source.rst +1 -1
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/models/categorization/attention.rst +2 -2
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/models/categorization/channel.rst +2 -2
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/models/categorization/convolution.rst +2 -2
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/models/categorization/filterbank.rst +3 -3
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/models/categorization/gnn.rst +3 -6
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/models/categorization/interpretable.rst +3 -3
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/models/categorization/lbm.rst +2 -2
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/models/categorization/recurrent.rst +3 -3
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/models/categorization/spd.rst +3 -3
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/whats_new.rst +29 -1
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/pyproject.toml +11 -1
- braindecode-1.3.0.dev174649439/braindecode/preprocessing/__init__.py +0 -37
- braindecode-1.3.0.dev174649439/braindecode/preprocessing/mne_preprocess.py +0 -77
- braindecode-1.3.0.dev174649439/braindecode/version.py +0 -1
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/LICENSE.txt +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/MANIFEST.in +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/NOTICE.txt +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/README.rst +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/__init__.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/augmentation/__init__.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/augmentation/functional.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/augmentation/transforms.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/classifier.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/datasets/bbci.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/datautil/util.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/functional/__init__.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/deep4.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/eeginception_mi.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/eegnex.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/eegsimpleconv.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/hybrid.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/sccnet.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/shallow_fbcsp.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/sleep_stager_blanco_2020.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/sleep_stager_chambon_2018.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/sparcnet.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/tidnet.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/models/tsinception.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/modules/__init__.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/modules/activation.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/modules/convolution.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/modules/linear.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/modules/parametrization.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/modules/stats.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/modules/util.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/modules/wrapper.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/regressor.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/samplers/__init__.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/samplers/ssl.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/training/__init__.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/training/callbacks.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/training/losses.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/training/scoring.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/util.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/visualization/__init__.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/visualization/confusion_matrices.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/visualization/gradients.py +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode.egg-info/dependency_links.txt +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode.egg-info/top_level.txt +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/Makefile +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/_templates/autosummary/class.rst +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/_templates/autosummary/function.rst +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/cite.rst +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/help.rst +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/install/install.rst +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/models/models.rst +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/models/models_categorization.rst +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/models/models_table.rst +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/models/models_visualization.rst +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/docs/sg_execution_times.rst +0 -0
- {braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/setup.cfg +0 -0
{braindecode-1.3.0.dev174649439/braindecode.egg-info → braindecode-1.3.0.dev175189654}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: braindecode
|
|
3
|
-
Version: 1.3.0.
|
|
3
|
+
Version: 1.3.0.dev175189654
|
|
4
4
|
Summary: Deep learning software to decode EEG, ECG or MEG signals
|
|
5
5
|
Author-email: Robin Tibor Schirrmeister <robintibor@gmail.com>
|
|
6
6
|
Maintainer-email: Alexandre Gramfort <agramfort@meta.com>, Bruno Aristimunha Pinto <b.aristimunha@gmail.com>, Robin Tibor Schirrmeister <robintibor@gmail.com>
|
|
@@ -38,8 +38,14 @@ Requires-Dist: wfdb
|
|
|
38
38
|
Requires-Dist: h5py
|
|
39
39
|
Requires-Dist: linear_attention_transformer
|
|
40
40
|
Requires-Dist: docstring_inheritance
|
|
41
|
+
Requires-Dist: rotary_embedding_torch
|
|
41
42
|
Provides-Extra: moabb
|
|
42
43
|
Requires-Dist: moabb>=1.2.0; extra == "moabb"
|
|
44
|
+
Provides-Extra: eegprep
|
|
45
|
+
Requires-Dist: eegprep[eeglabio]>=0.1.1; extra == "eegprep"
|
|
46
|
+
Provides-Extra: hub
|
|
47
|
+
Requires-Dist: huggingface_hub[torch]>=0.20.0; extra == "hub"
|
|
48
|
+
Requires-Dist: zarr<3.0,>=2.18; extra == "hub"
|
|
43
49
|
Provides-Extra: tests
|
|
44
50
|
Requires-Dist: pytest; extra == "tests"
|
|
45
51
|
Requires-Dist: pytest-cov; extra == "tests"
|
|
@@ -65,7 +71,11 @@ Requires-Dist: pre-commit; extra == "docs"
|
|
|
65
71
|
Requires-Dist: openneuro-py; extra == "docs"
|
|
66
72
|
Requires-Dist: plotly; extra == "docs"
|
|
67
73
|
Provides-Extra: all
|
|
68
|
-
Requires-Dist: braindecode[
|
|
74
|
+
Requires-Dist: braindecode[moabb]; extra == "all"
|
|
75
|
+
Requires-Dist: braindecode[hub]; extra == "all"
|
|
76
|
+
Requires-Dist: braindecode[tests]; extra == "all"
|
|
77
|
+
Requires-Dist: braindecode[docs]; extra == "all"
|
|
78
|
+
Requires-Dist: braindecode[eegprep]; extra == "all"
|
|
69
79
|
Dynamic: license-file
|
|
70
80
|
|
|
71
81
|
.. image:: https://badges.gitter.im/braindecodechat/community.svg
|
{braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/augmentation/base.py
RENAMED
|
@@ -189,7 +189,7 @@ class AugmentedDataLoader(DataLoader):
|
|
|
189
189
|
|
|
190
190
|
Parameters
|
|
191
191
|
----------
|
|
192
|
-
dataset :
|
|
192
|
+
dataset : RecordDataset
|
|
193
193
|
The dataset containing the signals.
|
|
194
194
|
transforms : list | Transform, optional
|
|
195
195
|
Transform or sequence of Transform to be applied to each batch.
|
{braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/datasets/__init__.py
RENAMED
|
@@ -2,11 +2,17 @@
|
|
|
2
2
|
Loader code for some datasets.
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from .base import
|
|
5
|
+
from .base import (
|
|
6
|
+
BaseConcatDataset,
|
|
7
|
+
EEGWindowsDataset,
|
|
8
|
+
RawDataset,
|
|
9
|
+
RecordDataset,
|
|
10
|
+
WindowsDataset,
|
|
11
|
+
)
|
|
6
12
|
from .bcicomp import BCICompetitionIVDataset4
|
|
7
13
|
from .bids import BIDSDataset, BIDSEpochsDataset
|
|
8
14
|
from .mne import create_from_mne_epochs, create_from_mne_raw
|
|
9
|
-
from .moabb import
|
|
15
|
+
from .moabb import BNCI2014_001, HGD, MOABBDataset
|
|
10
16
|
from .nmt import NMT
|
|
11
17
|
from .sleep_physio_challe_18 import SleepPhysionetChallenge2018
|
|
12
18
|
from .sleep_physionet import SleepPhysionet
|
|
@@ -15,13 +21,15 @@ from .xy import create_from_X_y
|
|
|
15
21
|
|
|
16
22
|
__all__ = [
|
|
17
23
|
"WindowsDataset",
|
|
18
|
-
"
|
|
24
|
+
"EEGWindowsDataset",
|
|
25
|
+
"RecordDataset",
|
|
26
|
+
"RawDataset",
|
|
19
27
|
"BaseConcatDataset",
|
|
20
28
|
"BIDSDataset",
|
|
21
29
|
"BIDSEpochsDataset",
|
|
22
30
|
"MOABBDataset",
|
|
23
31
|
"HGD",
|
|
24
|
-
"
|
|
32
|
+
"BNCI2014_001",
|
|
25
33
|
"create_from_mne_raw",
|
|
26
34
|
"create_from_mne_epochs",
|
|
27
35
|
"TUH",
|
{braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/datasets/base.py
RENAMED
|
@@ -16,14 +16,20 @@ import json
|
|
|
16
16
|
import os
|
|
17
17
|
import shutil
|
|
18
18
|
import warnings
|
|
19
|
+
from abc import abstractmethod
|
|
19
20
|
from collections.abc import Callable
|
|
20
21
|
from glob import glob
|
|
21
|
-
from typing import Iterable, no_type_check
|
|
22
|
+
from typing import Any, Generic, Iterable, no_type_check
|
|
22
23
|
|
|
23
24
|
import mne.io
|
|
24
25
|
import numpy as np
|
|
25
26
|
import pandas as pd
|
|
27
|
+
from mne.utils.docs import deprecated
|
|
26
28
|
from torch.utils.data import ConcatDataset, Dataset
|
|
29
|
+
from typing_extensions import TypeVar
|
|
30
|
+
|
|
31
|
+
from .hub import HubDatasetMixin
|
|
32
|
+
from .registry import register_dataset
|
|
27
33
|
|
|
28
34
|
|
|
29
35
|
def _create_description(description) -> pd.Series:
|
|
@@ -37,7 +43,65 @@ def _create_description(description) -> pd.Series:
|
|
|
37
43
|
return description
|
|
38
44
|
|
|
39
45
|
|
|
40
|
-
class
|
|
46
|
+
class RecordDataset(Dataset[tuple[np.ndarray, int | str, tuple[int, int, int]]]):
|
|
47
|
+
def __init__(
|
|
48
|
+
self,
|
|
49
|
+
description: dict | pd.Series | None = None,
|
|
50
|
+
transform: Callable | None = None,
|
|
51
|
+
):
|
|
52
|
+
self._description = _create_description(description)
|
|
53
|
+
self.transform = transform
|
|
54
|
+
|
|
55
|
+
@abstractmethod
|
|
56
|
+
def __len__(self) -> int:
|
|
57
|
+
pass
|
|
58
|
+
|
|
59
|
+
@property
|
|
60
|
+
def description(self) -> pd.Series:
|
|
61
|
+
return self._description
|
|
62
|
+
|
|
63
|
+
def set_description(self, description: dict | pd.Series, overwrite: bool = False):
|
|
64
|
+
"""Update (add or overwrite) the dataset description.
|
|
65
|
+
|
|
66
|
+
Parameters
|
|
67
|
+
----------
|
|
68
|
+
description: dict | pd.Series
|
|
69
|
+
Description in the form key: value.
|
|
70
|
+
overwrite: bool
|
|
71
|
+
Has to be True if a key in description already exists in the
|
|
72
|
+
dataset description.
|
|
73
|
+
"""
|
|
74
|
+
description = _create_description(description)
|
|
75
|
+
if self.description is None:
|
|
76
|
+
self._description = description
|
|
77
|
+
else:
|
|
78
|
+
for key, value in description.items():
|
|
79
|
+
# if the key is already in the existing description, drop it
|
|
80
|
+
if key in self._description:
|
|
81
|
+
assert overwrite, (
|
|
82
|
+
f"'{key}' already in description. Please "
|
|
83
|
+
f"rename or set overwrite to True."
|
|
84
|
+
)
|
|
85
|
+
self._description.pop(key)
|
|
86
|
+
self._description = pd.concat([self.description, description])
|
|
87
|
+
|
|
88
|
+
@property
|
|
89
|
+
def transform(self) -> Callable | None:
|
|
90
|
+
return self._transform
|
|
91
|
+
|
|
92
|
+
@transform.setter
|
|
93
|
+
def transform(self, value: Callable | None):
|
|
94
|
+
if value is not None and not callable(value):
|
|
95
|
+
raise ValueError("Transform needs to be a callable.")
|
|
96
|
+
self._transform = value
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
# Type of the datasets contained in BaseConcatDataset
|
|
100
|
+
T = TypeVar("T", bound=RecordDataset)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
@register_dataset
|
|
104
|
+
class RawDataset(RecordDataset):
|
|
41
105
|
"""Returns samples from an mne.io.Raw object along with a target.
|
|
42
106
|
|
|
43
107
|
Dataset which serves samples from an mne.io.Raw object along with a target.
|
|
@@ -64,12 +128,12 @@ class BaseDataset(Dataset):
|
|
|
64
128
|
target_name: str | tuple[str, ...] | None = None,
|
|
65
129
|
transform: Callable | None = None,
|
|
66
130
|
):
|
|
131
|
+
super().__init__(description, transform)
|
|
67
132
|
self.raw = raw
|
|
68
|
-
self._description = _create_description(description)
|
|
69
|
-
self.transform = transform
|
|
70
133
|
|
|
71
134
|
# save target name for load/save later
|
|
72
135
|
self.target_name = self._target_name(target_name)
|
|
136
|
+
self.raw_preproc_kwargs: list[dict[str, Any]] = []
|
|
73
137
|
|
|
74
138
|
def __getitem__(self, index):
|
|
75
139
|
X = self.raw[:, index][0]
|
|
@@ -85,45 +149,6 @@ class BaseDataset(Dataset):
|
|
|
85
149
|
def __len__(self):
|
|
86
150
|
return len(self.raw)
|
|
87
151
|
|
|
88
|
-
@property
|
|
89
|
-
def transform(self):
|
|
90
|
-
return self._transform
|
|
91
|
-
|
|
92
|
-
@transform.setter
|
|
93
|
-
def transform(self, value):
|
|
94
|
-
if value is not None and not callable(value):
|
|
95
|
-
raise ValueError("Transform needs to be a callable.")
|
|
96
|
-
self._transform = value
|
|
97
|
-
|
|
98
|
-
@property
|
|
99
|
-
def description(self) -> pd.Series:
|
|
100
|
-
return self._description
|
|
101
|
-
|
|
102
|
-
def set_description(self, description: dict | pd.Series, overwrite: bool = False):
|
|
103
|
-
"""Update (add or overwrite) the dataset description.
|
|
104
|
-
|
|
105
|
-
Parameters
|
|
106
|
-
----------
|
|
107
|
-
description: dict | pd.Series
|
|
108
|
-
Description in the form key: value.
|
|
109
|
-
overwrite: bool
|
|
110
|
-
Has to be True if a key in description already exists in the
|
|
111
|
-
dataset description.
|
|
112
|
-
"""
|
|
113
|
-
description = _create_description(description)
|
|
114
|
-
for key, value in description.items():
|
|
115
|
-
# if the key is already in the existing description, drop it
|
|
116
|
-
if self._description is not None and key in self._description:
|
|
117
|
-
assert overwrite, (
|
|
118
|
-
f"'{key}' already in description. Please "
|
|
119
|
-
f"rename or set overwrite to True."
|
|
120
|
-
)
|
|
121
|
-
self._description.pop(key)
|
|
122
|
-
if self._description is None:
|
|
123
|
-
self._description = description
|
|
124
|
-
else:
|
|
125
|
-
self._description = pd.concat([self.description, description])
|
|
126
|
-
|
|
127
152
|
def _target_name(self, target_name):
|
|
128
153
|
if target_name is not None and not isinstance(target_name, (str, tuple, list)):
|
|
129
154
|
raise ValueError("target_name has to be None, str, tuple or list")
|
|
@@ -150,7 +175,19 @@ class BaseDataset(Dataset):
|
|
|
150
175
|
return target_name if len(target_name) > 1 else target_name[0]
|
|
151
176
|
|
|
152
177
|
|
|
153
|
-
|
|
178
|
+
@deprecated(
|
|
179
|
+
"The BaseDataset class is deprecated. "
|
|
180
|
+
"If you want to instantiate a dataset containing raws, use RawDataset instead. "
|
|
181
|
+
"If you want to type a Braindecode dataset (i.e. RawDataset|EEGWindowsDataset|WindowsDataset), "
|
|
182
|
+
"use the RecordDataset class instead."
|
|
183
|
+
)
|
|
184
|
+
@register_dataset
|
|
185
|
+
class BaseDataset(RawDataset):
|
|
186
|
+
pass
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
@register_dataset
|
|
190
|
+
class EEGWindowsDataset(RecordDataset):
|
|
154
191
|
"""Returns windows from an mne.Raw object, its window indices, along with a target.
|
|
155
192
|
|
|
156
193
|
Dataset which serves windows from an mne.Epochs object along with their
|
|
@@ -161,12 +198,12 @@ class EEGWindowsDataset(BaseDataset):
|
|
|
161
198
|
required to serve information about the windowing (e.g., useful for cropped
|
|
162
199
|
training).
|
|
163
200
|
See `braindecode.datautil.windowers` to directly create a `WindowsDataset`
|
|
164
|
-
from a `
|
|
201
|
+
from a `RawDataset` object.
|
|
165
202
|
|
|
166
203
|
Parameters
|
|
167
204
|
----------
|
|
168
205
|
windows : mne.Raw or mne.Epochs (Epochs is outdated)
|
|
169
|
-
Windows obtained through the application of a windower to a
|
|
206
|
+
Windows obtained through the application of a windower to a ``RawDataset``
|
|
170
207
|
(see `braindecode.datautil.windowers`).
|
|
171
208
|
description : dict | pandas.Series | None
|
|
172
209
|
Holds additional info about the windows.
|
|
@@ -185,18 +222,17 @@ class EEGWindowsDataset(BaseDataset):
|
|
|
185
222
|
|
|
186
223
|
def __init__(
|
|
187
224
|
self,
|
|
188
|
-
raw: mne.io.BaseRaw
|
|
225
|
+
raw: mne.io.BaseRaw,
|
|
189
226
|
metadata: pd.DataFrame,
|
|
190
227
|
description: dict | pd.Series | None = None,
|
|
191
228
|
transform: Callable | None = None,
|
|
192
229
|
targets_from: str = "metadata",
|
|
193
230
|
last_target_only: bool = True,
|
|
194
231
|
):
|
|
232
|
+
super().__init__(description, transform)
|
|
195
233
|
self.raw = raw
|
|
196
234
|
self.metadata = metadata
|
|
197
|
-
self._description = _create_description(description)
|
|
198
235
|
|
|
199
|
-
self.transform = transform
|
|
200
236
|
self.last_target_only = last_target_only
|
|
201
237
|
if targets_from not in ("metadata", "channels"):
|
|
202
238
|
raise ValueError("Wrong value for parameter `targets_from`.")
|
|
@@ -206,6 +242,7 @@ class EEGWindowsDataset(BaseDataset):
|
|
|
206
242
|
].to_numpy()
|
|
207
243
|
if self.targets_from == "metadata":
|
|
208
244
|
self.y = metadata.loc[:, "target"].to_list()
|
|
245
|
+
self.raw_preproc_kwargs: list[dict[str, Any]] = []
|
|
209
246
|
|
|
210
247
|
def __getitem__(self, index: int):
|
|
211
248
|
"""Get a window and its target.
|
|
@@ -255,44 +292,9 @@ class EEGWindowsDataset(BaseDataset):
|
|
|
255
292
|
def __len__(self):
|
|
256
293
|
return len(self.crop_inds)
|
|
257
294
|
|
|
258
|
-
@property
|
|
259
|
-
def transform(self):
|
|
260
|
-
return self._transform
|
|
261
|
-
|
|
262
|
-
@transform.setter
|
|
263
|
-
def transform(self, value):
|
|
264
|
-
if value is not None and not callable(value):
|
|
265
|
-
raise ValueError("Transform needs to be a callable.")
|
|
266
|
-
self._transform = value
|
|
267
|
-
|
|
268
|
-
@property
|
|
269
|
-
def description(self) -> pd.Series:
|
|
270
|
-
return self._description
|
|
271
|
-
|
|
272
|
-
def set_description(self, description: dict | pd.Series, overwrite: bool = False):
|
|
273
|
-
"""Update (add or overwrite) the dataset description.
|
|
274
|
-
|
|
275
|
-
Parameters
|
|
276
|
-
----------
|
|
277
|
-
description: dict | pd.Series
|
|
278
|
-
Description in the form key: value.
|
|
279
|
-
overwrite: bool
|
|
280
|
-
Has to be True if a key in description already exists in the
|
|
281
|
-
dataset description.
|
|
282
|
-
"""
|
|
283
|
-
description = _create_description(description)
|
|
284
|
-
for key, value in description.items():
|
|
285
|
-
# if they key is already in the existing description, drop it
|
|
286
|
-
if key in self._description:
|
|
287
|
-
assert overwrite, (
|
|
288
|
-
f"'{key}' already in description. Please "
|
|
289
|
-
f"rename or set overwrite to True."
|
|
290
|
-
)
|
|
291
|
-
self._description.pop(key)
|
|
292
|
-
self._description = pd.concat([self.description, description])
|
|
293
|
-
|
|
294
295
|
|
|
295
|
-
|
|
296
|
+
@register_dataset
|
|
297
|
+
class WindowsDataset(RecordDataset):
|
|
296
298
|
"""Returns windows from an mne.Epochs object along with a target.
|
|
297
299
|
|
|
298
300
|
Dataset which serves windows from an mne.Epochs object along with their
|
|
@@ -303,12 +305,12 @@ class WindowsDataset(BaseDataset):
|
|
|
303
305
|
required to serve information about the windowing (e.g., useful for cropped
|
|
304
306
|
training).
|
|
305
307
|
See `braindecode.datautil.windowers` to directly create a `WindowsDataset`
|
|
306
|
-
from a
|
|
308
|
+
from a ``RawDataset`` object.
|
|
307
309
|
|
|
308
310
|
Parameters
|
|
309
311
|
----------
|
|
310
312
|
windows : mne.Epochs
|
|
311
|
-
Windows obtained through the application of a windower to a
|
|
313
|
+
Windows obtained through the application of a windower to a RawDataset
|
|
312
314
|
(see `braindecode.datautil.windowers`).
|
|
313
315
|
description : dict | pandas.Series | None
|
|
314
316
|
Holds additional info about the windows.
|
|
@@ -327,19 +329,22 @@ class WindowsDataset(BaseDataset):
|
|
|
327
329
|
targets_from: str = "metadata",
|
|
328
330
|
last_target_only: bool = True,
|
|
329
331
|
):
|
|
332
|
+
super().__init__(description, transform)
|
|
330
333
|
self.windows = windows
|
|
331
|
-
self._description = _create_description(description)
|
|
332
|
-
self.transform = transform
|
|
333
334
|
self.last_target_only = last_target_only
|
|
334
335
|
if targets_from not in ("metadata", "channels"):
|
|
335
336
|
raise ValueError("Wrong value for parameter `targets_from`.")
|
|
336
337
|
self.targets_from = targets_from
|
|
337
338
|
|
|
338
|
-
|
|
339
|
+
metadata = self.windows.metadata
|
|
340
|
+
assert metadata is not None, "WindowsDataset requires windows with metadata."
|
|
341
|
+
self.crop_inds = metadata.loc[
|
|
339
342
|
:, ["i_window_in_trial", "i_start_in_trial", "i_stop_in_trial"]
|
|
340
343
|
].to_numpy()
|
|
341
344
|
if self.targets_from == "metadata":
|
|
342
|
-
self.y =
|
|
345
|
+
self.y = metadata.loc[:, "target"].to_list()
|
|
346
|
+
self.raw_preproc_kwargs: list[dict[str, Any]] = []
|
|
347
|
+
self.window_preproc_kwargs: list[dict[str, Any]] = []
|
|
343
348
|
|
|
344
349
|
def __getitem__(self, index: int):
|
|
345
350
|
"""Get a window and its target.
|
|
@@ -379,68 +384,41 @@ class WindowsDataset(BaseDataset):
|
|
|
379
384
|
def __len__(self) -> int:
|
|
380
385
|
return len(self.windows.events)
|
|
381
386
|
|
|
382
|
-
@property
|
|
383
|
-
def transform(self):
|
|
384
|
-
return self._transform
|
|
385
|
-
|
|
386
|
-
@transform.setter
|
|
387
|
-
def transform(self, value):
|
|
388
|
-
if value is not None and not callable(value):
|
|
389
|
-
raise ValueError("Transform needs to be a callable.")
|
|
390
|
-
self._transform = value
|
|
391
|
-
|
|
392
|
-
@property
|
|
393
|
-
def description(self) -> pd.Series:
|
|
394
|
-
return self._description
|
|
395
|
-
|
|
396
|
-
def set_description(self, description: dict | pd.Series, overwrite: bool = False):
|
|
397
|
-
"""Update (add or overwrite) the dataset description.
|
|
398
|
-
|
|
399
|
-
Parameters
|
|
400
|
-
----------
|
|
401
|
-
description: dict | pd.Series
|
|
402
|
-
Description in the form key: value.
|
|
403
|
-
overwrite: bool
|
|
404
|
-
Has to be True if a key in description already exists in the
|
|
405
|
-
dataset description.
|
|
406
|
-
"""
|
|
407
|
-
description = _create_description(description)
|
|
408
|
-
for key, value in description.items():
|
|
409
|
-
# if they key is already in the existing description, drop it
|
|
410
|
-
if key in self._description:
|
|
411
|
-
assert overwrite, (
|
|
412
|
-
f"'{key}' already in description. Please "
|
|
413
|
-
f"rename or set overwrite to True."
|
|
414
|
-
)
|
|
415
|
-
self._description.pop(key)
|
|
416
|
-
self._description = pd.concat([self.description, description])
|
|
417
387
|
|
|
418
|
-
|
|
419
|
-
class BaseConcatDataset(ConcatDataset):
|
|
388
|
+
@register_dataset
|
|
389
|
+
class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
420
390
|
"""A base class for concatenated datasets.
|
|
421
391
|
|
|
422
392
|
Holds either mne.Raw or mne.Epoch in self.datasets and has
|
|
423
393
|
a pandas DataFrame with additional description.
|
|
424
394
|
|
|
395
|
+
Includes Hugging Face Hub integration via HubDatasetMixin for
|
|
396
|
+
uploading and downloading datasets.
|
|
397
|
+
|
|
425
398
|
Parameters
|
|
426
399
|
----------
|
|
427
400
|
list_of_ds : list
|
|
428
|
-
list of
|
|
401
|
+
list of RecordDataset
|
|
429
402
|
target_transform : callable | None
|
|
430
403
|
Optional function to call on targets before returning them.
|
|
431
404
|
|
|
432
405
|
"""
|
|
433
406
|
|
|
407
|
+
datasets: list[T]
|
|
408
|
+
|
|
434
409
|
def __init__(
|
|
435
410
|
self,
|
|
436
|
-
list_of_ds: list[
|
|
437
|
-
| None = None,
|
|
411
|
+
list_of_ds: list[T | BaseConcatDataset[T]],
|
|
438
412
|
target_transform: Callable | None = None,
|
|
439
413
|
):
|
|
440
414
|
# if we get a list of BaseConcatDataset, get all the individual datasets
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
415
|
+
flattened_list_of_ds: list[T] = []
|
|
416
|
+
for ds in list_of_ds:
|
|
417
|
+
if isinstance(ds, BaseConcatDataset):
|
|
418
|
+
flattened_list_of_ds.extend(ds.datasets)
|
|
419
|
+
else:
|
|
420
|
+
flattened_list_of_ds.append(ds)
|
|
421
|
+
super().__init__(flattened_list_of_ds)
|
|
444
422
|
|
|
445
423
|
self.target_transform = target_transform
|
|
446
424
|
|
|
@@ -703,22 +681,23 @@ class BaseConcatDataset(ConcatDataset):
|
|
|
703
681
|
ds.set_description({key: value_}, overwrite=overwrite)
|
|
704
682
|
|
|
705
683
|
def save(self, path: str, overwrite: bool = False, offset: int = 0):
|
|
706
|
-
"""Save datasets to files by creating one subdirectory for each dataset
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
0
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
1
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
684
|
+
"""Save datasets to files by creating one subdirectory for each dataset::
|
|
685
|
+
|
|
686
|
+
path/
|
|
687
|
+
0/
|
|
688
|
+
0-raw.fif | 0-epo.fif
|
|
689
|
+
description.json
|
|
690
|
+
raw_preproc_kwargs.json (if raws were preprocessed)
|
|
691
|
+
window_kwargs.json (if this is a windowed dataset)
|
|
692
|
+
window_preproc_kwargs.json (if windows were preprocessed)
|
|
693
|
+
target_name.json (if target_name is not None and dataset is raw)
|
|
694
|
+
1/
|
|
695
|
+
1-raw.fif | 1-epo.fif
|
|
696
|
+
description.json
|
|
697
|
+
raw_preproc_kwargs.json (if raws were preprocessed)
|
|
698
|
+
window_kwargs.json (if this is a windowed dataset)
|
|
699
|
+
window_preproc_kwargs.json (if windows were preprocessed)
|
|
700
|
+
target_name.json (if target_name is not None and dataset is raw)
|
|
722
701
|
|
|
723
702
|
Parameters
|
|
724
703
|
----------
|
|
@@ -830,7 +809,7 @@ class BaseConcatDataset(ConcatDataset):
|
|
|
830
809
|
kwargs = getattr(ds, kwargs_name)
|
|
831
810
|
if kwargs is not None:
|
|
832
811
|
with open(kwargs_file_path, "w") as f:
|
|
833
|
-
json.dump(kwargs, f)
|
|
812
|
+
json.dump(kwargs, f, indent=2)
|
|
834
813
|
|
|
835
814
|
@staticmethod
|
|
836
815
|
def _save_target_name(sub_dir, ds):
|
{braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/datasets/bcicomp.py
RENAMED
|
@@ -16,7 +16,7 @@ import numpy as np
|
|
|
16
16
|
from mne.utils import verbose
|
|
17
17
|
from scipy.io import loadmat
|
|
18
18
|
|
|
19
|
-
from braindecode.datasets import BaseConcatDataset,
|
|
19
|
+
from braindecode.datasets import BaseConcatDataset, RawDataset
|
|
20
20
|
|
|
21
21
|
DATASET_URL = (
|
|
22
22
|
"https://stacks.stanford.edu/file/druid:zk881ps0522/"
|
|
@@ -73,8 +73,8 @@ class BCICompetitionIVDataset4(BaseConcatDataset):
|
|
|
73
73
|
file_name=file_path.split("/")[-1],
|
|
74
74
|
session="test",
|
|
75
75
|
)
|
|
76
|
-
datasets.append(
|
|
77
|
-
datasets.append(
|
|
76
|
+
datasets.append(RawDataset(raw_train, description=desc_train))
|
|
77
|
+
datasets.append(RawDataset(raw_test, description=desc_test))
|
|
78
78
|
super().__init__(datasets)
|
|
79
79
|
|
|
80
80
|
@staticmethod
|
|
@@ -85,7 +85,7 @@ class BCICompetitionIVDataset4(BaseConcatDataset):
|
|
|
85
85
|
----------
|
|
86
86
|
path (None | str) – Location of where to look for the data storing location.
|
|
87
87
|
If None, the environment variable or config parameter
|
|
88
|
-
MNE_DATASETS_(dataset)_PATH is used. If it doesn
|
|
88
|
+
MNE_DATASETS_(dataset)_PATH is used. If it doesn't exist, the “~/mne_data”
|
|
89
89
|
directory is used. If the dataset is not found under the given path, the data
|
|
90
90
|
will be automatically downloaded to the specified folder.
|
|
91
91
|
force_update (bool) – Force update of the dataset even if a local copy exists.
|
{braindecode-1.3.0.dev174649439 → braindecode-1.3.0.dev175189654}/braindecode/datasets/bids.py
RENAMED
|
@@ -19,7 +19,7 @@ import numpy as np
|
|
|
19
19
|
import pandas as pd
|
|
20
20
|
from joblib import Parallel, delayed
|
|
21
21
|
|
|
22
|
-
from .base import BaseConcatDataset,
|
|
22
|
+
from .base import BaseConcatDataset, RawDataset, WindowsDataset
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
def _description_from_bids_path(bids_path: mne_bids.BIDSPath) -> dict[str, Any]:
|
|
@@ -186,12 +186,12 @@ class BIDSDataset(BaseConcatDataset):
|
|
|
186
186
|
)
|
|
187
187
|
super().__init__(all_base_ds)
|
|
188
188
|
|
|
189
|
-
def _get_dataset(self, bids_path: mne_bids.BIDSPath) ->
|
|
189
|
+
def _get_dataset(self, bids_path: mne_bids.BIDSPath) -> RawDataset:
|
|
190
190
|
description = _description_from_bids_path(bids_path)
|
|
191
191
|
raw = mne_bids.read_raw_bids(bids_path, verbose=False)
|
|
192
192
|
if self.preload:
|
|
193
193
|
raw.load_data()
|
|
194
|
-
return
|
|
194
|
+
return RawDataset(raw, description)
|
|
195
195
|
|
|
196
196
|
|
|
197
197
|
class BIDSEpochsDataset(BIDSDataset):
|
|
@@ -25,14 +25,14 @@ class BIDSIterableDataset(IterableDataset):
|
|
|
25
25
|
|
|
26
26
|
Examples
|
|
27
27
|
--------
|
|
28
|
-
>>> from braindecode.datasets import
|
|
28
|
+
>>> from braindecode.datasets import RecordDataset, BaseConcatDataset
|
|
29
29
|
>>> from braindecode.datasets.bids import BIDSIterableDataset, _description_from_bids_path
|
|
30
30
|
>>> from braindecode.preprocessing import create_fixed_length_windows
|
|
31
31
|
>>>
|
|
32
32
|
>>> def my_reader_fn(path):
|
|
33
33
|
... raw = mne_bids.read_raw_bids(path)
|
|
34
34
|
... desc = _description_from_bids_path(path)
|
|
35
|
-
... ds =
|
|
35
|
+
... ds = RawDataset(raw, description=desc)
|
|
36
36
|
... windows_ds = create_fixed_length_windows(
|
|
37
37
|
... BaseConcatDataset([ds]),
|
|
38
38
|
... window_size_samples=400,
|