Braindecode 1.3.0.dev175887834__tar.gz → 1.3.0.dev176089716__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.dev175887834/braindecode.egg-info → braindecode-1.3.0.dev176089716}/PKG-INFO +16 -41
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/README.rst +1 -14
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/augmentation/__init__.py +0 -4
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/augmentation/functional.py +0 -101
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/augmentation/transforms.py +0 -74
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/classifier.py +8 -3
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/datasets/__init__.py +0 -4
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/datasets/base.py +3 -18
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/datasets/nmt.py +43 -38
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/datautil/__init__.py +0 -2
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/datautil/serialization.py +2 -1
- braindecode-1.3.0.dev176089716/braindecode/datautil/util.py +41 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/eegneuralnet.py +48 -20
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/__init__.py +1 -8
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/atcnet.py +12 -12
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/attentionbasenet.py +5 -5
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/attn_sleep.py +8 -10
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/bendr.py +2 -2
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/biot.py +25 -27
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/contrawr.py +2 -2
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/ctnet.py +34 -34
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/deep4.py +4 -4
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/deepsleepnet.py +4 -4
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/eegconformer.py +23 -28
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/eeginception_erp.py +1 -1
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/eeginception_mi.py +3 -3
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/eegitnet.py +3 -3
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/eegnet.py +1 -1
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/eegnex.py +1 -1
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/eegsimpleconv.py +1 -1
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/eegtcnet.py +3 -3
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/fbcnet.py +1 -1
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/fblightconvnet.py +1 -1
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/fbmsnet.py +1 -1
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/hybrid.py +1 -1
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/ifnet.py +2 -2
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/labram.py +40 -40
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/medformer.py +15 -15
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/msvtnet.py +10 -10
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/patchedtransformer.py +48 -48
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/sccnet.py +1 -1
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/shallow_fbcsp.py +2 -4
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/signal_jepa.py +4 -4
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/sinc_shallow.py +2 -1
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/sleep_stager_blanco_2020.py +1 -1
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/sleep_stager_chambon_2018.py +1 -1
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/sparcnet.py +4 -4
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/sstdpn.py +2 -2
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/summary.csv +16 -17
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/syncnet.py +1 -1
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/tcn.py +3 -3
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/tidnet.py +1 -1
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/tsinception.py +1 -1
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/usleep.py +3 -3
- braindecode-1.3.0.dev176089716/braindecode/models/util.py +134 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/modules/blocks.py +1 -3
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/preprocessing/__init__.py +0 -5
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/preprocessing/eegprep_preprocess.py +19 -134
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/preprocessing/mne_preprocess.py +25 -56
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/preprocessing/preprocess.py +41 -126
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/preprocessing/util.py +0 -11
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/regressor.py +7 -3
- braindecode-1.3.0.dev176089716/braindecode/version.py +1 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716/braindecode.egg-info}/PKG-INFO +16 -41
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode.egg-info/SOURCES.txt +0 -9
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode.egg-info/requires.txt +10 -22
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/api.rst +0 -12
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/cite.rst +2 -9
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/conf.py +14 -37
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/index.rst +4 -4
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/install/install_pip.rst +1 -7
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/install/install_source.rst +1 -1
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/models/categorization/attention.rst +5 -5
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/models/categorization/lbm.rst +5 -5
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/models/models_categorization.rst +8 -8
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/models/models_table.rst +2 -2
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/whats_new.rst +0 -23
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/pyproject.toml +13 -31
- braindecode-1.3.0.dev175887834/braindecode/datasets/chb_mit.py +0 -172
- braindecode-1.3.0.dev175887834/braindecode/datasets/hub.py +0 -945
- braindecode-1.3.0.dev175887834/braindecode/datasets/hub_validation.py +0 -113
- braindecode-1.3.0.dev175887834/braindecode/datasets/registry.py +0 -120
- braindecode-1.3.0.dev175887834/braindecode/datasets/siena.py +0 -164
- braindecode-1.3.0.dev175887834/braindecode/datasets/utils.py +0 -67
- braindecode-1.3.0.dev175887834/braindecode/datautil/hub_formats.py +0 -180
- braindecode-1.3.0.dev175887834/braindecode/datautil/util.py +0 -155
- braindecode-1.3.0.dev175887834/braindecode/models/config.py +0 -233
- braindecode-1.3.0.dev175887834/braindecode/models/luna.py +0 -836
- braindecode-1.3.0.dev175887834/braindecode/models/util.py +0 -358
- braindecode-1.3.0.dev175887834/braindecode/version.py +0 -1
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/LICENSE.txt +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/MANIFEST.in +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/NOTICE.txt +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/__init__.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/augmentation/base.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/datasets/bbci.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/datasets/bcicomp.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/datasets/bids.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/datasets/experimental.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/datasets/mne.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/datasets/moabb.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/datasets/sleep_physio_challe_18.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/datasets/sleep_physionet.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/datasets/tuh.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/datasets/xy.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/datautil/channel_utils.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/functional/__init__.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/functional/functions.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/functional/initialization.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/base.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/eegminer.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/models/eegsym.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/modules/__init__.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/modules/activation.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/modules/attention.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/modules/convolution.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/modules/filter.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/modules/layers.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/modules/linear.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/modules/parametrization.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/modules/stats.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/modules/util.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/modules/wrapper.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/preprocessing/windowers.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/samplers/__init__.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/samplers/base.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/samplers/ssl.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/training/__init__.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/training/callbacks.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/training/losses.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/training/scoring.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/util.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/visualization/__init__.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/visualization/confusion_matrices.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/visualization/gradients.py +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode.egg-info/dependency_links.txt +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode.egg-info/top_level.txt +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/Makefile +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/_templates/autosummary/class.rst +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/_templates/autosummary/function.rst +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/help.rst +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/install/install.rst +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/models/categorization/channel.rst +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/models/categorization/convolution.rst +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/models/categorization/filterbank.rst +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/models/categorization/gnn.rst +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/models/categorization/interpretable.rst +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/models/categorization/recurrent.rst +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/models/categorization/spd.rst +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/models/models.rst +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/models/models_visualization.rst +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/docs/sg_execution_times.rst +0 -0
- {braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/setup.cfg +0 -0
{braindecode-1.3.0.dev175887834/braindecode.egg-info → braindecode-1.3.0.dev176089716}/PKG-INFO
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: braindecode
|
|
3
|
-
Version: 1.3.0.
|
|
3
|
+
Version: 1.3.0.dev176089716
|
|
4
4
|
Summary: Deep learning software to decode EEG, ECG or MEG signals
|
|
5
|
-
Author-email: Robin Tibor Schirrmeister <robintibor@gmail.com
|
|
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>
|
|
7
7
|
License: BSD-3-Clause
|
|
8
8
|
Project-URL: homepage, https://braindecode.org
|
|
@@ -14,47 +14,42 @@ Classifier: Intended Audience :: Developers
|
|
|
14
14
|
Classifier: Intended Audience :: Science/Research
|
|
15
15
|
Classifier: Topic :: Software Development :: Build Tools
|
|
16
16
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
19
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
-
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
-
Requires-Python: >=3.11
|
|
20
|
+
Requires-Python: >=3.10
|
|
22
21
|
Description-Content-Type: text/x-rst
|
|
23
22
|
License-File: LICENSE.txt
|
|
24
23
|
License-File: NOTICE.txt
|
|
25
|
-
Requires-Dist: mne>=1.
|
|
24
|
+
Requires-Dist: mne>=1.10.0
|
|
26
25
|
Requires-Dist: mne_bids>=0.16
|
|
27
26
|
Requires-Dist: numpy
|
|
28
27
|
Requires-Dist: pandas
|
|
29
28
|
Requires-Dist: scipy
|
|
30
29
|
Requires-Dist: matplotlib
|
|
31
30
|
Requires-Dist: h5py
|
|
32
|
-
Requires-Dist: skorch>=1.
|
|
33
|
-
Requires-Dist: torch
|
|
34
|
-
Requires-Dist: torchaudio
|
|
31
|
+
Requires-Dist: skorch>=1.2.0
|
|
32
|
+
Requires-Dist: torch<3.0,>=2.0
|
|
33
|
+
Requires-Dist: torchaudio<3.0,>=2.0
|
|
35
34
|
Requires-Dist: einops
|
|
36
35
|
Requires-Dist: joblib
|
|
37
|
-
Requires-Dist: torchinfo
|
|
36
|
+
Requires-Dist: torchinfo~=1.8
|
|
38
37
|
Requires-Dist: wfdb
|
|
38
|
+
Requires-Dist: h5py
|
|
39
39
|
Requires-Dist: linear_attention_transformer
|
|
40
40
|
Requires-Dist: docstring_inheritance
|
|
41
|
-
Requires-Dist: rotary_embedding_torch
|
|
42
41
|
Provides-Extra: moabb
|
|
43
|
-
Requires-Dist: moabb>=1.
|
|
42
|
+
Requires-Dist: moabb>=1.2.0; extra == "moabb"
|
|
44
43
|
Provides-Extra: eegprep
|
|
45
|
-
Requires-Dist: eegprep[eeglabio]>=0.
|
|
46
|
-
Provides-Extra:
|
|
47
|
-
Requires-Dist: huggingface_hub[torch]>=0.20.0; extra == "
|
|
48
|
-
Requires-Dist: zarr>=3.0; extra == "hub"
|
|
44
|
+
Requires-Dist: eegprep[eeglabio]>=0.1.1; extra == "eegprep"
|
|
45
|
+
Provides-Extra: hug
|
|
46
|
+
Requires-Dist: huggingface_hub[torch]>=0.20.0; extra == "hug"
|
|
49
47
|
Provides-Extra: tests
|
|
50
48
|
Requires-Dist: pytest; extra == "tests"
|
|
51
49
|
Requires-Dist: pytest-cov; extra == "tests"
|
|
52
50
|
Requires-Dist: codecov; extra == "tests"
|
|
53
51
|
Requires-Dist: pytest_cases; extra == "tests"
|
|
54
52
|
Requires-Dist: mypy; extra == "tests"
|
|
55
|
-
Provides-Extra: typing
|
|
56
|
-
Requires-Dist: exca==0.4; extra == "typing"
|
|
57
|
-
Requires-Dist: numpydantic>=1.7; extra == "typing"
|
|
58
53
|
Provides-Extra: docs
|
|
59
54
|
Requires-Dist: sphinx_gallery; extra == "docs"
|
|
60
55
|
Requires-Dist: sphinx_rtd_theme; extra == "docs"
|
|
@@ -73,21 +68,10 @@ Requires-Dist: seaborn; extra == "docs"
|
|
|
73
68
|
Requires-Dist: pre-commit; extra == "docs"
|
|
74
69
|
Requires-Dist: openneuro-py; extra == "docs"
|
|
75
70
|
Requires-Dist: plotly; extra == "docs"
|
|
76
|
-
Requires-Dist: shap; extra == "docs"
|
|
77
|
-
Requires-Dist: nbformat; extra == "docs"
|
|
78
71
|
Provides-Extra: all
|
|
79
|
-
Requires-Dist: braindecode[moabb]; extra == "all"
|
|
80
|
-
Requires-Dist: braindecode[tests]; extra == "all"
|
|
81
|
-
Requires-Dist: braindecode[docs]; extra == "all"
|
|
82
|
-
Requires-Dist: braindecode[hub]; extra == "all"
|
|
83
|
-
Requires-Dist: braindecode[eegprep]; extra == "all"
|
|
84
|
-
Requires-Dist: braindecode[typing]; extra == "all"
|
|
72
|
+
Requires-Dist: braindecode[docs,eegprep,hug,moabb,tests]; extra == "all"
|
|
85
73
|
Dynamic: license-file
|
|
86
74
|
|
|
87
|
-
.. image:: https://zenodo.org/badge/232335424.svg
|
|
88
|
-
:target: https://doi.org/10.5281/zenodo.8214376
|
|
89
|
-
:alt: DOI
|
|
90
|
-
|
|
91
75
|
.. image:: https://badges.gitter.im/braindecodechat/community.svg
|
|
92
76
|
:alt: Join the chat at https://gitter.im/braindecodechat/community
|
|
93
77
|
:target: https://gitter.im/braindecodechat/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
|
|
@@ -103,7 +87,6 @@ Dynamic: license-file
|
|
|
103
87
|
:target: https://codecov.io/gh/braindecode/braindecode
|
|
104
88
|
:alt: Code Coverage
|
|
105
89
|
|
|
106
|
-
|
|
107
90
|
.. |Braindecode| image:: https://user-images.githubusercontent.com/42702466/177958779-b00628aa-9155-4c51-96d1-d8c345aff575.svg
|
|
108
91
|
.. _braindecode: braindecode.org/
|
|
109
92
|
|
|
@@ -160,15 +143,7 @@ https://gitter.im/braindecodechat/community
|
|
|
160
143
|
Citing
|
|
161
144
|
======
|
|
162
145
|
|
|
163
|
-
If you use
|
|
164
|
-
|
|
165
|
-
.. image:: https://zenodo.org/badge/232335424.svg
|
|
166
|
-
:target: https://doi.org/10.5281/zenodo.8214376
|
|
167
|
-
:alt: DOI
|
|
168
|
-
|
|
169
|
-
Additionally, we highly encourage you to cite the article that originally introduced
|
|
170
|
-
the Braindecode library and has served as a foundational reference for many works
|
|
171
|
-
on deep learning with EEG recordings. Please use the following reference:
|
|
146
|
+
If you use this code in a scientific publication, please cite us as:
|
|
172
147
|
|
|
173
148
|
.. code-block:: bibtex
|
|
174
149
|
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
.. image:: https://zenodo.org/badge/232335424.svg
|
|
2
|
-
:target: https://doi.org/10.5281/zenodo.8214376
|
|
3
|
-
:alt: DOI
|
|
4
|
-
|
|
5
1
|
.. image:: https://badges.gitter.im/braindecodechat/community.svg
|
|
6
2
|
:alt: Join the chat at https://gitter.im/braindecodechat/community
|
|
7
3
|
:target: https://gitter.im/braindecodechat/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
|
|
@@ -17,7 +13,6 @@
|
|
|
17
13
|
:target: https://codecov.io/gh/braindecode/braindecode
|
|
18
14
|
:alt: Code Coverage
|
|
19
15
|
|
|
20
|
-
|
|
21
16
|
.. |Braindecode| image:: https://user-images.githubusercontent.com/42702466/177958779-b00628aa-9155-4c51-96d1-d8c345aff575.svg
|
|
22
17
|
.. _braindecode: braindecode.org/
|
|
23
18
|
|
|
@@ -74,15 +69,7 @@ https://gitter.im/braindecodechat/community
|
|
|
74
69
|
Citing
|
|
75
70
|
======
|
|
76
71
|
|
|
77
|
-
If you use
|
|
78
|
-
|
|
79
|
-
.. image:: https://zenodo.org/badge/232335424.svg
|
|
80
|
-
:target: https://doi.org/10.5281/zenodo.8214376
|
|
81
|
-
:alt: DOI
|
|
82
|
-
|
|
83
|
-
Additionally, we highly encourage you to cite the article that originally introduced
|
|
84
|
-
the Braindecode library and has served as a foundational reference for many works
|
|
85
|
-
on deep learning with EEG recordings. Please use the following reference:
|
|
72
|
+
If you use this code in a scientific publication, please cite us as:
|
|
86
73
|
|
|
87
74
|
.. code-block:: bibtex
|
|
88
75
|
|
|
@@ -5,10 +5,8 @@ Utilities for data augmentation.
|
|
|
5
5
|
from . import functional
|
|
6
6
|
from .base import AugmentedDataLoader, Compose, IdentityTransform, Transform
|
|
7
7
|
from .transforms import (
|
|
8
|
-
AmplitudeScale,
|
|
9
8
|
BandstopFilter,
|
|
10
9
|
ChannelsDropout,
|
|
11
|
-
ChannelsReref,
|
|
12
10
|
ChannelsShuffle,
|
|
13
11
|
ChannelsSymmetry,
|
|
14
12
|
FrequencyShift,
|
|
@@ -48,7 +46,5 @@ __all__ = [
|
|
|
48
46
|
"Mixup",
|
|
49
47
|
"SegmentationReconstruction",
|
|
50
48
|
"MaskEncoding",
|
|
51
|
-
"AmplitudeScale",
|
|
52
|
-
"ChannelsReref",
|
|
53
49
|
"functional",
|
|
54
50
|
]
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# Authors: Cédric Rommel <cedric.rommel@inria.fr>
|
|
2
2
|
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
|
|
3
3
|
# Gustavo Rodrigues <gustavenrique01@gmail.com>
|
|
4
|
-
# Bruna Lopes <brunajaflopes@gmail.com>
|
|
5
4
|
#
|
|
6
5
|
# License: BSD (3-clause)
|
|
7
6
|
|
|
@@ -1195,103 +1194,3 @@ def mask_encoding(
|
|
|
1195
1194
|
X[mask] = 0
|
|
1196
1195
|
|
|
1197
1196
|
return X, y # Return the masked tensor and labels
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
def channels_rereference(
|
|
1201
|
-
X: torch.Tensor,
|
|
1202
|
-
y: torch.Tensor,
|
|
1203
|
-
random_state: int | np.random.RandomState | None = None,
|
|
1204
|
-
) -> tuple[torch.Tensor, torch.Tensor]:
|
|
1205
|
-
"""Randomly re-reference channels in EEG data matrix.
|
|
1206
|
-
|
|
1207
|
-
Part of the augmentations proposed in [1]_
|
|
1208
|
-
|
|
1209
|
-
Parameters
|
|
1210
|
-
----------
|
|
1211
|
-
X : torch.Tensor
|
|
1212
|
-
EEG input example or batch.
|
|
1213
|
-
y : torch.Tensor
|
|
1214
|
-
EEG labels for the example or batch.
|
|
1215
|
-
random_state: int | numpy.random.Generator, optional
|
|
1216
|
-
Seed to be used to instantiate numpy random number generator instance.
|
|
1217
|
-
Defaults to None.
|
|
1218
|
-
|
|
1219
|
-
Returns
|
|
1220
|
-
-------
|
|
1221
|
-
torch.Tensor
|
|
1222
|
-
Transformed inputs.
|
|
1223
|
-
torch.Tensor
|
|
1224
|
-
Transformed labels.
|
|
1225
|
-
|
|
1226
|
-
References
|
|
1227
|
-
----------
|
|
1228
|
-
.. [1] Mohsenvand, M.N., Izadi, M.R. & Maes, P.. (2020). Contrastive
|
|
1229
|
-
Representation Learning for Electroencephalogram Classification. Proceedings
|
|
1230
|
-
of the Machine Learning for Health NeurIPS Workshop, in Proceedings of Machine
|
|
1231
|
-
Learning Research 136:238-253
|
|
1232
|
-
|
|
1233
|
-
"""
|
|
1234
|
-
|
|
1235
|
-
rng = check_random_state(random_state)
|
|
1236
|
-
batch_size, n_channels, _ = X.shape
|
|
1237
|
-
|
|
1238
|
-
ch = rng.randint(0, n_channels, size=batch_size)
|
|
1239
|
-
|
|
1240
|
-
X_ch = X[torch.arange(batch_size), ch, :]
|
|
1241
|
-
X = X - X_ch.unsqueeze(1)
|
|
1242
|
-
X[torch.arange(batch_size), ch, :] = -X_ch
|
|
1243
|
-
|
|
1244
|
-
return X, y
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
def amplitude_scale(
|
|
1248
|
-
X: torch.Tensor,
|
|
1249
|
-
y: torch.Tensor,
|
|
1250
|
-
scale: tuple,
|
|
1251
|
-
random_state: int | np.random.RandomState | None = None,
|
|
1252
|
-
) -> tuple[torch.Tensor, torch.Tensor]:
|
|
1253
|
-
"""Rescale amplitude of each channel based on a random sampled scaling value.
|
|
1254
|
-
|
|
1255
|
-
Part of the augmentations proposed in [1]_
|
|
1256
|
-
|
|
1257
|
-
Parameters
|
|
1258
|
-
----------
|
|
1259
|
-
X : torch.Tensor
|
|
1260
|
-
EEG input example or batch.
|
|
1261
|
-
y : torch.Tensor
|
|
1262
|
-
EEG labels for the example or batch.
|
|
1263
|
-
scale : tuple of floats
|
|
1264
|
-
Interval from which ypu sample the scaling value
|
|
1265
|
-
random_state: int | numpy.random.Generator, optional
|
|
1266
|
-
Seed to be used to instantiate numpy random number generator instance.
|
|
1267
|
-
Defaults to None.
|
|
1268
|
-
|
|
1269
|
-
Returns
|
|
1270
|
-
-------
|
|
1271
|
-
torch.Tensor
|
|
1272
|
-
Transformed inputs.
|
|
1273
|
-
torch.Tensor
|
|
1274
|
-
Transformed labels.
|
|
1275
|
-
|
|
1276
|
-
References
|
|
1277
|
-
----------
|
|
1278
|
-
.. [1] Mohsenvand, M.N., Izadi, M.R. & Maes, P.. (2020). Contrastive
|
|
1279
|
-
Representation Learning for Electroencephalogram Classification. Proceedings
|
|
1280
|
-
of the Machine Learning for Health NeurIPS Workshop, in Proceedings of Machine
|
|
1281
|
-
Learning Research 136:238-253
|
|
1282
|
-
|
|
1283
|
-
"""
|
|
1284
|
-
|
|
1285
|
-
rng = torch.Generator()
|
|
1286
|
-
rng.manual_seed(random_state)
|
|
1287
|
-
batch_size, n_channels, _ = X.shape
|
|
1288
|
-
|
|
1289
|
-
# Parameter for scaling amplitude / channel / trial
|
|
1290
|
-
l, h = scale
|
|
1291
|
-
s = l + (h - l) * torch.rand(
|
|
1292
|
-
batch_size, n_channels, 1, generator=rng, device=X.device, dtype=X.dtype
|
|
1293
|
-
)
|
|
1294
|
-
|
|
1295
|
-
X = s * X
|
|
1296
|
-
|
|
1297
|
-
return X, y
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# Authors: Cédric Rommel <cedric.rommel@inria.fr>
|
|
2
2
|
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
|
|
3
3
|
# Gustavo Rodrigues <gustavenrique01@gmail.com>
|
|
4
|
-
# Bruna Lopes <brunajaflopes@gmail.com>
|
|
5
4
|
#
|
|
6
5
|
# License: BSD (3-clause)
|
|
7
6
|
|
|
@@ -14,11 +13,9 @@ from mne.channels import make_standard_montage
|
|
|
14
13
|
|
|
15
14
|
from .base import Transform
|
|
16
15
|
from .functional import (
|
|
17
|
-
amplitude_scale,
|
|
18
16
|
bandstop_filter,
|
|
19
17
|
channels_dropout,
|
|
20
18
|
channels_permute,
|
|
21
|
-
channels_rereference,
|
|
22
19
|
channels_shuffle,
|
|
23
20
|
frequency_shift,
|
|
24
21
|
ft_surrogate,
|
|
@@ -1274,74 +1271,3 @@ class MaskEncoding(Transform):
|
|
|
1274
1271
|
"segment_length": segment_length,
|
|
1275
1272
|
"n_segments": self.n_segments,
|
|
1276
1273
|
}
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
class ChannelsReref(Transform):
|
|
1280
|
-
"""Randomly re-reference channels in EEG data matrix.
|
|
1281
|
-
|
|
1282
|
-
Part of the augmentations proposed in [1]_
|
|
1283
|
-
|
|
1284
|
-
Parameters
|
|
1285
|
-
----------
|
|
1286
|
-
probability: float
|
|
1287
|
-
Float setting the probability of applying the operation.
|
|
1288
|
-
random_state: int | numpy.random.Generator, optional
|
|
1289
|
-
Seed to be used to instantiate numpy random number generator instance.
|
|
1290
|
-
Used to decide whether or not to transform given the probability
|
|
1291
|
-
argument, to sample which channels to shuffle and to carry the shuffle.
|
|
1292
|
-
Defaults to None.
|
|
1293
|
-
|
|
1294
|
-
References
|
|
1295
|
-
----------
|
|
1296
|
-
.. [1] Mohsenvand, M.N., Izadi, M.R. & Maes, P.. (2020). Contrastive
|
|
1297
|
-
Representation Learning for Electroencephalogram Classification. Proceedings
|
|
1298
|
-
of the Machine Learning for Health NeurIPS Workshop, in Proceedings of Machine
|
|
1299
|
-
Learning Research 136:238-253 Available from https://proceedings.mlr.press/v136/mohsenvand20a.html.
|
|
1300
|
-
|
|
1301
|
-
"""
|
|
1302
|
-
|
|
1303
|
-
operation = staticmethod(channels_rereference) # type: ignore[assignment]
|
|
1304
|
-
|
|
1305
|
-
def __init__(self, probability, random_state=None):
|
|
1306
|
-
super().__init__(probability=probability, random_state=random_state)
|
|
1307
|
-
|
|
1308
|
-
def get_augmentation_params(self, *batch):
|
|
1309
|
-
"""Return transform parameters"""
|
|
1310
|
-
return {
|
|
1311
|
-
"random_state": self.rng,
|
|
1312
|
-
}
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
class AmplitudeScale(Transform):
|
|
1316
|
-
"""Rescale amplitude based on a random sampled scaling value.
|
|
1317
|
-
|
|
1318
|
-
Part of the augmentations proposed in [1]_
|
|
1319
|
-
|
|
1320
|
-
Parameters
|
|
1321
|
-
----------
|
|
1322
|
-
probability: float
|
|
1323
|
-
Float setting the probability of applying the operation.
|
|
1324
|
-
random_state: int | numpy.random.Generator, optional
|
|
1325
|
-
Seed to be used to instantiate numpy random number generator instance.
|
|
1326
|
-
Used to decide whether or not to transform given the probability
|
|
1327
|
-
argument, to sample which channels to shuffle and to carry the shuffle.
|
|
1328
|
-
Defaults to None.
|
|
1329
|
-
|
|
1330
|
-
References
|
|
1331
|
-
----------
|
|
1332
|
-
.. [1] Mohsenvand, M.N., Izadi, M.R. & Maes, P.. (2020). Contrastive
|
|
1333
|
-
Representation Learning for Electroencephalogram Classification. Proceedings
|
|
1334
|
-
of the Machine Learning for Health NeurIPS Workshop, in Proceedings of Machine
|
|
1335
|
-
Learning Research 136:238-253 Available from https://proceedings.mlr.press/v136/mohsenvand20a.html.
|
|
1336
|
-
|
|
1337
|
-
"""
|
|
1338
|
-
|
|
1339
|
-
operation = staticmethod(amplitude_scale) # type: ignore[assignment]
|
|
1340
|
-
|
|
1341
|
-
def __init__(self, probability, interval=(0.5, 2), random_state=None):
|
|
1342
|
-
super().__init__(probability=probability, random_state=random_state)
|
|
1343
|
-
self.scale = interval
|
|
1344
|
-
|
|
1345
|
-
def get_augmentation_params(self, *batch):
|
|
1346
|
-
"""Return transform parameters"""
|
|
1347
|
-
return {"random_state": self.rng, "scale": self.scale}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import warnings
|
|
10
10
|
|
|
11
|
+
import numpy as np
|
|
11
12
|
from skorch import NeuralNet
|
|
12
13
|
from skorch.callbacks import EpochScoring
|
|
13
14
|
from skorch.classifier import NeuralNetClassifier
|
|
@@ -236,9 +237,13 @@ class EEGClassifier(_EEGNeuralNet, NeuralNetClassifier):
|
|
|
236
237
|
num_workers=self.get_iterator(X, training=False).loader.num_workers,
|
|
237
238
|
)
|
|
238
239
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
240
|
+
def _get_n_outputs(self, y, classes):
|
|
241
|
+
classes_y = np.unique(y)
|
|
242
|
+
if classes is not None:
|
|
243
|
+
assert set(classes_y) <= set(classes)
|
|
244
|
+
else:
|
|
245
|
+
classes = classes_y
|
|
246
|
+
return len(classes)
|
|
242
247
|
|
|
243
248
|
# Only add the 'accuracy' callback if we are not in cropped mode.
|
|
244
249
|
@property
|
{braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/datasets/__init__.py
RENAMED
|
@@ -11,11 +11,9 @@ from .base import (
|
|
|
11
11
|
)
|
|
12
12
|
from .bcicomp import BCICompetitionIVDataset4
|
|
13
13
|
from .bids import BIDSDataset, BIDSEpochsDataset
|
|
14
|
-
from .chb_mit import CHBMIT
|
|
15
14
|
from .mne import create_from_mne_epochs, create_from_mne_raw
|
|
16
15
|
from .moabb import BNCI2014_001, HGD, MOABBDataset
|
|
17
16
|
from .nmt import NMT
|
|
18
|
-
from .siena import SIENA
|
|
19
17
|
from .sleep_physio_challe_18 import SleepPhysionetChallenge2018
|
|
20
18
|
from .sleep_physionet import SleepPhysionet
|
|
21
19
|
from .tuh import TUH, TUHAbnormal
|
|
@@ -36,9 +34,7 @@ __all__ = [
|
|
|
36
34
|
"create_from_mne_epochs",
|
|
37
35
|
"TUH",
|
|
38
36
|
"TUHAbnormal",
|
|
39
|
-
"SIENA",
|
|
40
37
|
"NMT",
|
|
41
|
-
"CHBMIT",
|
|
42
38
|
"SleepPhysionet",
|
|
43
39
|
"SleepPhysionetChallenge2018",
|
|
44
40
|
"create_from_X_y",
|
{braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/datasets/base.py
RENAMED
|
@@ -19,7 +19,7 @@ import warnings
|
|
|
19
19
|
from abc import abstractmethod
|
|
20
20
|
from collections.abc import Callable
|
|
21
21
|
from glob import glob
|
|
22
|
-
from typing import
|
|
22
|
+
from typing import Generic, Iterable, no_type_check
|
|
23
23
|
|
|
24
24
|
import mne.io
|
|
25
25
|
import numpy as np
|
|
@@ -28,9 +28,6 @@ from mne.utils.docs import deprecated
|
|
|
28
28
|
from torch.utils.data import ConcatDataset, Dataset
|
|
29
29
|
from typing_extensions import TypeVar
|
|
30
30
|
|
|
31
|
-
from .hub import HubDatasetMixin
|
|
32
|
-
from .registry import register_dataset
|
|
33
|
-
|
|
34
31
|
|
|
35
32
|
def _create_description(description) -> pd.Series:
|
|
36
33
|
if description is not None:
|
|
@@ -100,7 +97,6 @@ class RecordDataset(Dataset[tuple[np.ndarray, int | str, tuple[int, int, int]]])
|
|
|
100
97
|
T = TypeVar("T", bound=RecordDataset)
|
|
101
98
|
|
|
102
99
|
|
|
103
|
-
@register_dataset
|
|
104
100
|
class RawDataset(RecordDataset):
|
|
105
101
|
"""Returns samples from an mne.io.Raw object along with a target.
|
|
106
102
|
|
|
@@ -133,7 +129,6 @@ class RawDataset(RecordDataset):
|
|
|
133
129
|
|
|
134
130
|
# save target name for load/save later
|
|
135
131
|
self.target_name = self._target_name(target_name)
|
|
136
|
-
self.raw_preproc_kwargs: list[dict[str, Any]] = []
|
|
137
132
|
|
|
138
133
|
def __getitem__(self, index):
|
|
139
134
|
X = self.raw[:, index][0]
|
|
@@ -181,12 +176,10 @@ class RawDataset(RecordDataset):
|
|
|
181
176
|
"If you want to type a Braindecode dataset (i.e. RawDataset|EEGWindowsDataset|WindowsDataset), "
|
|
182
177
|
"use the RecordDataset class instead."
|
|
183
178
|
)
|
|
184
|
-
@register_dataset
|
|
185
179
|
class BaseDataset(RawDataset):
|
|
186
180
|
pass
|
|
187
181
|
|
|
188
182
|
|
|
189
|
-
@register_dataset
|
|
190
183
|
class EEGWindowsDataset(RecordDataset):
|
|
191
184
|
"""Returns windows from an mne.Raw object, its window indices, along with a target.
|
|
192
185
|
|
|
@@ -242,7 +235,6 @@ class EEGWindowsDataset(RecordDataset):
|
|
|
242
235
|
].to_numpy()
|
|
243
236
|
if self.targets_from == "metadata":
|
|
244
237
|
self.y = metadata.loc[:, "target"].to_list()
|
|
245
|
-
self.raw_preproc_kwargs: list[dict[str, Any]] = []
|
|
246
238
|
|
|
247
239
|
def __getitem__(self, index: int):
|
|
248
240
|
"""Get a window and its target.
|
|
@@ -293,7 +285,6 @@ class EEGWindowsDataset(RecordDataset):
|
|
|
293
285
|
return len(self.crop_inds)
|
|
294
286
|
|
|
295
287
|
|
|
296
|
-
@register_dataset
|
|
297
288
|
class WindowsDataset(RecordDataset):
|
|
298
289
|
"""Returns windows from an mne.Epochs object along with a target.
|
|
299
290
|
|
|
@@ -343,8 +334,6 @@ class WindowsDataset(RecordDataset):
|
|
|
343
334
|
].to_numpy()
|
|
344
335
|
if self.targets_from == "metadata":
|
|
345
336
|
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]] = []
|
|
348
337
|
|
|
349
338
|
def __getitem__(self, index: int):
|
|
350
339
|
"""Get a window and its target.
|
|
@@ -385,16 +374,12 @@ class WindowsDataset(RecordDataset):
|
|
|
385
374
|
return len(self.windows.events)
|
|
386
375
|
|
|
387
376
|
|
|
388
|
-
|
|
389
|
-
class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
377
|
+
class BaseConcatDataset(ConcatDataset, Generic[T]):
|
|
390
378
|
"""A base class for concatenated datasets.
|
|
391
379
|
|
|
392
380
|
Holds either mne.Raw or mne.Epoch in self.datasets and has
|
|
393
381
|
a pandas DataFrame with additional description.
|
|
394
382
|
|
|
395
|
-
Includes Hugging Face Hub integration via HubDatasetMixin for
|
|
396
|
-
uploading and downloading datasets.
|
|
397
|
-
|
|
398
383
|
Parameters
|
|
399
384
|
----------
|
|
400
385
|
list_of_ds : list
|
|
@@ -809,7 +794,7 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
809
794
|
kwargs = getattr(ds, kwargs_name)
|
|
810
795
|
if kwargs is not None:
|
|
811
796
|
with open(kwargs_file_path, "w") as f:
|
|
812
|
-
json.dump(kwargs, f
|
|
797
|
+
json.dump(kwargs, f)
|
|
813
798
|
|
|
814
799
|
@staticmethod
|
|
815
800
|
def _save_target_name(sub_dir, ds):
|
{braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/datasets/nmt.py
RENAMED
|
@@ -32,7 +32,6 @@ from joblib import Parallel, delayed
|
|
|
32
32
|
from mne.datasets import fetch_dataset
|
|
33
33
|
|
|
34
34
|
from braindecode.datasets.base import BaseConcatDataset, RawDataset
|
|
35
|
-
from braindecode.datasets.utils import _correct_dataset_path
|
|
36
35
|
|
|
37
36
|
NMT_URL = "https://zenodo.org/record/10909103/files/NMT.zip"
|
|
38
37
|
NMT_archive_name = "NMT.zip"
|
|
@@ -97,34 +96,22 @@ class NMT(BaseConcatDataset):
|
|
|
97
96
|
preload=False,
|
|
98
97
|
n_jobs=1,
|
|
99
98
|
):
|
|
100
|
-
#
|
|
101
|
-
if path
|
|
102
|
-
path =
|
|
99
|
+
# correct the path if needed
|
|
100
|
+
if path is not None:
|
|
101
|
+
list_csv = glob.glob(f"{path}/**/Labels.csv", recursive=True)
|
|
102
|
+
if isinstance(list_csv, list) and len(list_csv) > 0:
|
|
103
|
+
path = Path(list_csv[0]).parent
|
|
103
104
|
|
|
104
|
-
|
|
105
|
-
if path is None:
|
|
105
|
+
if path is None or len(list_csv) == 0:
|
|
106
106
|
path = fetch_dataset(
|
|
107
107
|
dataset_params=NMT_dataset_params,
|
|
108
|
-
path=None,
|
|
108
|
+
path=Path(path) if path is not None else None,
|
|
109
109
|
processor="unzip",
|
|
110
110
|
force_update=False,
|
|
111
111
|
)
|
|
112
112
|
# First time we fetch the dataset, we need to move the files to the
|
|
113
113
|
# correct directory.
|
|
114
|
-
path =
|
|
115
|
-
path, NMT_archive_name, "nmt_scalp_eeg_dataset"
|
|
116
|
-
)
|
|
117
|
-
else:
|
|
118
|
-
# Validate that the provided path is a valid NMT dataset
|
|
119
|
-
if not Path(f"{path}/Labels.csv").exists():
|
|
120
|
-
raise ValueError(
|
|
121
|
-
f"The provided path {path} does not contain a valid "
|
|
122
|
-
"NMT dataset (missing Labels.csv). Please ensure the "
|
|
123
|
-
"path points directly to the NMT dataset directory."
|
|
124
|
-
)
|
|
125
|
-
path = _correct_dataset_path(
|
|
126
|
-
path, NMT_archive_name, "nmt_scalp_eeg_dataset"
|
|
127
|
-
)
|
|
114
|
+
path = _correct_path(path)
|
|
128
115
|
|
|
129
116
|
# Get all file paths
|
|
130
117
|
file_paths = glob.glob(
|
|
@@ -189,6 +176,39 @@ class NMT(BaseConcatDataset):
|
|
|
189
176
|
return base_dataset
|
|
190
177
|
|
|
191
178
|
|
|
179
|
+
def _correct_path(path: str):
|
|
180
|
+
"""
|
|
181
|
+
Check if the path is correct and rename the file if needed.
|
|
182
|
+
|
|
183
|
+
Parameters
|
|
184
|
+
----------
|
|
185
|
+
path: basestring
|
|
186
|
+
Path to the file.
|
|
187
|
+
|
|
188
|
+
Returns
|
|
189
|
+
-------
|
|
190
|
+
path: basestring
|
|
191
|
+
Corrected path.
|
|
192
|
+
"""
|
|
193
|
+
if not Path(path).exists():
|
|
194
|
+
unzip_file_name = f"{NMT_archive_name}.unzip"
|
|
195
|
+
if (Path(path).parent / unzip_file_name).exists():
|
|
196
|
+
try:
|
|
197
|
+
os.rename(
|
|
198
|
+
src=Path(path).parent / unzip_file_name,
|
|
199
|
+
dst=Path(path),
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
except PermissionError:
|
|
203
|
+
raise PermissionError(
|
|
204
|
+
f"Please rename {Path(path).parent / unzip_file_name}"
|
|
205
|
+
+ f"manually to {path} and try again."
|
|
206
|
+
)
|
|
207
|
+
path = os.path.join(path, "nmt_scalp_eeg_dataset")
|
|
208
|
+
|
|
209
|
+
return path
|
|
210
|
+
|
|
211
|
+
|
|
192
212
|
def _get_header(*args):
|
|
193
213
|
all_paths = {**_NMT_PATHS}
|
|
194
214
|
return all_paths[args[0]]
|
|
@@ -268,33 +288,18 @@ _NMT_PATHS = {
|
|
|
268
288
|
class _NMTMock(NMT):
|
|
269
289
|
"""Mocked class for testing and examples."""
|
|
270
290
|
|
|
271
|
-
@mock.patch("pathlib.Path.exists", return_value=True)
|
|
272
|
-
@mock.patch("braindecode.datasets.nmt._correct_dataset_path")
|
|
273
|
-
@mock.patch("mne.datasets.fetch_dataset")
|
|
274
|
-
@mock.patch("pandas.read_csv", new=_fake_pd_read_csv)
|
|
275
|
-
@mock.patch("mne.io.read_raw_edf", new=_fake_raw)
|
|
276
291
|
@mock.patch("glob.glob", return_value=_NMT_PATHS.keys())
|
|
292
|
+
@mock.patch("mne.io.read_raw_edf", new=_fake_raw)
|
|
293
|
+
@mock.patch("pandas.read_csv", new=_fake_pd_read_csv)
|
|
277
294
|
def __init__(
|
|
278
295
|
self,
|
|
279
296
|
mock_glob,
|
|
280
|
-
mock_fetch,
|
|
281
|
-
mock_correct_path,
|
|
282
|
-
mock_path_exists,
|
|
283
297
|
path,
|
|
284
298
|
recording_ids=None,
|
|
285
299
|
target_name="pathological",
|
|
286
300
|
preload=False,
|
|
287
301
|
n_jobs=1,
|
|
288
302
|
):
|
|
289
|
-
# Prevent download by providing a dummy path if empty/None
|
|
290
|
-
if not path:
|
|
291
|
-
path = "mocked_nmt_path"
|
|
292
|
-
|
|
293
|
-
# Mock fetch_dataset to return a valid path without downloading
|
|
294
|
-
mock_fetch.return_value = path
|
|
295
|
-
# Mock _correct_dataset_path to return the path as-is
|
|
296
|
-
mock_correct_path.side_effect = lambda p, *args, **kwargs: p
|
|
297
|
-
|
|
298
303
|
with warnings.catch_warnings():
|
|
299
304
|
warnings.filterwarnings("ignore", message="Cannot save date file")
|
|
300
305
|
super().__init__(
|
{braindecode-1.3.0.dev175887834 → braindecode-1.3.0.dev176089716}/braindecode/datautil/__init__.py
RENAMED
|
@@ -11,7 +11,6 @@ from .serialization import (
|
|
|
11
11
|
load_concat_dataset,
|
|
12
12
|
save_concat_dataset,
|
|
13
13
|
)
|
|
14
|
-
from .util import infer_signal_properties
|
|
15
14
|
|
|
16
15
|
|
|
17
16
|
def __getattr__(name):
|
|
@@ -60,5 +59,4 @@ __all__ = [
|
|
|
60
59
|
"_check_save_dir_empty",
|
|
61
60
|
"match_hemisphere_chans",
|
|
62
61
|
"division_channels_idx",
|
|
63
|
-
"infer_signal_properties",
|
|
64
62
|
]
|
|
@@ -138,7 +138,7 @@ def _load_signals(fif_file, preload, is_raw):
|
|
|
138
138
|
with open(pkl_file, "rb") as f:
|
|
139
139
|
signals = pickle.load(f)
|
|
140
140
|
|
|
141
|
-
if all(
|
|
141
|
+
if all(f.exists() for f in signals.filenames):
|
|
142
142
|
if preload:
|
|
143
143
|
signals.load_data()
|
|
144
144
|
return signals
|
|
@@ -302,6 +302,7 @@ def _load_kwargs_json(kwargs_name, sub_dir):
|
|
|
302
302
|
kwargs_file_path = os.path.join(sub_dir, kwargs_file_name)
|
|
303
303
|
if os.path.exists(kwargs_file_path):
|
|
304
304
|
kwargs = json.load(open(kwargs_file_path, "r"))
|
|
305
|
+
kwargs = [tuple(kwarg) for kwarg in kwargs]
|
|
305
306
|
return kwargs
|
|
306
307
|
|
|
307
308
|
|