Braindecode 1.3.2.dev177700329__tar.gz → 1.3.2.dev178169072__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.2.dev177700329/braindecode.egg-info → braindecode-1.3.2.dev178169072}/PKG-INFO +7 -37
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/README.rst +6 -36
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datasets/base.py +2 -150
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datasets/bids/hub.py +76 -161
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datasets/bids/hub_io.py +6 -29
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datasets/mne.py +4 -48
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datautil/hub_formats.py +3 -16
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/__init__.py +0 -2
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/base.py +17 -28
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/bendr.py +19 -69
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/eegsym.py +1 -1
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/luna.py +7 -8
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/sstdpn.py +1 -1
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/summary.csv +0 -1
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/util.py +11 -13
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/modules/attention.py +1 -2
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/preprocessing/mne_preprocess.py +1 -2
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/preprocessing/preprocess.py +32 -62
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/preprocessing/windowers.py +78 -312
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/util.py +4 -34
- braindecode-1.3.2.dev178169072/braindecode/version.py +1 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/visualization/gradients.py +7 -7
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072/braindecode.egg-info}/PKG-INFO +7 -37
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode.egg-info/SOURCES.txt +0 -1
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/api.rst +9 -11
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/cite.rst +4 -42
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/conf.py +7 -19
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/models/categorization/gnn.rst +1 -9
- braindecode-1.3.2.dev178169072/docs/models/categorization/spd.rst +35 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/models/models_categorization.rst +60 -60
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/whats_new.rst +5 -58
- braindecode-1.3.2.dev177700329/braindecode/models/dgcnn.py +0 -500
- braindecode-1.3.2.dev177700329/braindecode/version.py +0 -1
- braindecode-1.3.2.dev177700329/docs/models/categorization/spd.rst +0 -103
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/LICENSE.txt +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/MANIFEST.in +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/NOTICE.txt +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/__init__.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/augmentation/__init__.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/augmentation/base.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/augmentation/functional.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/augmentation/transforms.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/classifier.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datasets/__init__.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datasets/bbci.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datasets/bcicomp.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datasets/bids/__init__.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datasets/bids/datasets.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datasets/bids/format.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datasets/bids/hub_format.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datasets/bids/hub_validation.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datasets/bids/iterable.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datasets/chb_mit.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datasets/moabb.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datasets/nmt.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datasets/registry.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datasets/siena.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datasets/sleep_physio_challe_18.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datasets/sleep_physionet.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datasets/tuh.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datasets/utils.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datasets/xy.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datautil/__init__.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datautil/channel_utils.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datautil/serialization.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datautil/util.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/eegneuralnet.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/functional/__init__.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/functional/functions.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/functional/initialization.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/atcnet.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/attentionbasenet.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/attn_sleep.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/biot.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/brainmodule.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/cbramod.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/config.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/contrawr.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/ctnet.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/deep4.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/deepsleepnet.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/eegconformer.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/eeginception_erp.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/eeginception_mi.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/eegitnet.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/eegminer.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/eegnet.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/eegnex.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/eegpt.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/eegsimpleconv.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/eegtcnet.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/fbcnet.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/fblightconvnet.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/fbmsnet.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/hybrid.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/ifnet.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/labram.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/medformer.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/msvtnet.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/patchedtransformer.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/reve.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/sccnet.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/shallow_fbcsp.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/signal_jepa.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/sinc_shallow.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/sleep_stager_blanco_2020.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/sleep_stager_chambon_2018.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/sparcnet.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/syncnet.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/tcn.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/tidnet.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/tsinception.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/models/usleep.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/modules/__init__.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/modules/activation.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/modules/blocks.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/modules/convolution.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/modules/filter.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/modules/layers.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/modules/linear.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/modules/parametrization.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/modules/stats.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/modules/util.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/modules/wrapper.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/preprocessing/__init__.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/preprocessing/eegprep_preprocess.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/preprocessing/util.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/regressor.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/samplers/__init__.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/samplers/base.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/samplers/ssl.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/training/__init__.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/training/callbacks.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/training/losses.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/training/scoring.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/visualization/__init__.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/visualization/confusion_matrices.py +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode.egg-info/dependency_links.txt +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode.egg-info/requires.txt +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode.egg-info/top_level.txt +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/Makefile +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/_templates/autosummary/class.rst +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/_templates/autosummary/class_in_subdir.rst +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/_templates/autosummary/function.rst +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/_templates/autosummary/function_in_subdir.rst +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/help.rst +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/index.rst +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/install/install.rst +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/install/install_pip.rst +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/install/install_source.rst +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/models/categorization/attention.rst +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/models/categorization/channel.rst +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/models/categorization/convolution.rst +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/models/categorization/filterbank.rst +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/models/categorization/interpretable.rst +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/models/categorization/lbm.rst +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/models/categorization/recurrent.rst +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/models/models.rst +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/models/models_table.rst +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/models/models_visualization.rst +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/docs/sg_execution_times.rst +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/pyproject.toml +0 -0
- {braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/setup.cfg +0 -0
{braindecode-1.3.2.dev177700329/braindecode.egg-info → braindecode-1.3.2.dev178169072}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: braindecode
|
|
3
|
-
Version: 1.3.2.
|
|
3
|
+
Version: 1.3.2.dev178169072
|
|
4
4
|
Summary: Deep learning software to decode EEG, ECG or MEG signals
|
|
5
5
|
Author-email: Robin Tibor Schirrmeister <robintibor@gmail.com>, Bruno Aristimunha Pinto <b.aristimunha@gmail.com>, Alexandre Gramfort <agramfort@meta.com>
|
|
6
6
|
Maintainer-email: Alexandre Gramfort <agramfort@meta.com>, Bruno Aristimunha Pinto <b.aristimunha@gmail.com>, Robin Tibor Schirrmeister <robintibor@gmail.com>
|
|
@@ -84,8 +84,8 @@ Requires-Dist: braindecode[eegprep]; extra == "all"
|
|
|
84
84
|
Requires-Dist: braindecode[typing]; extra == "all"
|
|
85
85
|
Dynamic: license-file
|
|
86
86
|
|
|
87
|
-
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.
|
|
88
|
-
:target: https://doi.org/10.5281/zenodo.
|
|
87
|
+
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.8214376.svg
|
|
88
|
+
:target: https://doi.org/10.5281/zenodo.8214376
|
|
89
89
|
:alt: DOI
|
|
90
90
|
|
|
91
91
|
.. image:: https://github.com/braindecode/braindecode/workflows/docs/badge.svg
|
|
@@ -173,43 +173,13 @@ https://github.com/braindecode/braindecode/blob/master/CONTRIBUTING.md
|
|
|
173
173
|
Citing
|
|
174
174
|
########
|
|
175
175
|
|
|
176
|
-
If you use Braindecode in scientific work, please cite the software using the
|
|
177
|
-
|
|
176
|
+
If you use Braindecode in scientific work, please cite the software using the Zenodo DOI
|
|
177
|
+
shown in the badge below:
|
|
178
178
|
|
|
179
|
-
.. image:: https://zenodo.org/badge/
|
|
180
|
-
:target: https://doi.org/10.5281/zenodo.
|
|
179
|
+
.. image:: https://zenodo.org/badge/232335424.svg
|
|
180
|
+
:target: https://doi.org/10.5281/zenodo.8214376
|
|
181
181
|
:alt: DOI
|
|
182
182
|
|
|
183
|
-
You can use the following BibTeX entry:
|
|
184
|
-
|
|
185
|
-
.. code-block:: bibtex
|
|
186
|
-
|
|
187
|
-
@software{braindecode,
|
|
188
|
-
author = {Aristimunha, Bruno and
|
|
189
|
-
Guetschel, Pierre and
|
|
190
|
-
Wimpff, Martin and
|
|
191
|
-
Gemein, Lukas and
|
|
192
|
-
Rommel, Cedric and
|
|
193
|
-
Banville, Hubert and
|
|
194
|
-
Sliwowski, Maciej and
|
|
195
|
-
Wilson, Daniel and
|
|
196
|
-
Brandt, Simon and
|
|
197
|
-
Gnassounou, Théo and
|
|
198
|
-
Paillard, Joseph and
|
|
199
|
-
{Junqueira Lopes}, Bruna and
|
|
200
|
-
Sedlar, Sara and
|
|
201
|
-
Moreau, Thomas and
|
|
202
|
-
Chevallier, Sylvain and
|
|
203
|
-
Gramfort, Alexandre and
|
|
204
|
-
Schirrmeister, Robin Tibor},
|
|
205
|
-
title = {Braindecode: toolbox for decoding raw electrophysiological brain data
|
|
206
|
-
with deep learning models},
|
|
207
|
-
url = {https://github.com/braindecode/braindecode},
|
|
208
|
-
doi = {10.5281/zenodo.17699192},
|
|
209
|
-
publisher = {Zenodo},
|
|
210
|
-
license = {BSD-3-Clause},
|
|
211
|
-
}
|
|
212
|
-
|
|
213
183
|
Additionally, we highly encourage you to cite the article that originally introduced the
|
|
214
184
|
Braindecode library and has served as a foundational reference for many works on deep
|
|
215
185
|
learning with EEG recordings. Please use the following reference:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.
|
|
2
|
-
:target: https://doi.org/10.5281/zenodo.
|
|
1
|
+
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.8214376.svg
|
|
2
|
+
:target: https://doi.org/10.5281/zenodo.8214376
|
|
3
3
|
:alt: DOI
|
|
4
4
|
|
|
5
5
|
.. image:: https://github.com/braindecode/braindecode/workflows/docs/badge.svg
|
|
@@ -87,43 +87,13 @@ https://github.com/braindecode/braindecode/blob/master/CONTRIBUTING.md
|
|
|
87
87
|
Citing
|
|
88
88
|
########
|
|
89
89
|
|
|
90
|
-
If you use Braindecode in scientific work, please cite the software using the
|
|
91
|
-
|
|
90
|
+
If you use Braindecode in scientific work, please cite the software using the Zenodo DOI
|
|
91
|
+
shown in the badge below:
|
|
92
92
|
|
|
93
|
-
.. image:: https://zenodo.org/badge/
|
|
94
|
-
:target: https://doi.org/10.5281/zenodo.
|
|
93
|
+
.. image:: https://zenodo.org/badge/232335424.svg
|
|
94
|
+
:target: https://doi.org/10.5281/zenodo.8214376
|
|
95
95
|
:alt: DOI
|
|
96
96
|
|
|
97
|
-
You can use the following BibTeX entry:
|
|
98
|
-
|
|
99
|
-
.. code-block:: bibtex
|
|
100
|
-
|
|
101
|
-
@software{braindecode,
|
|
102
|
-
author = {Aristimunha, Bruno and
|
|
103
|
-
Guetschel, Pierre and
|
|
104
|
-
Wimpff, Martin and
|
|
105
|
-
Gemein, Lukas and
|
|
106
|
-
Rommel, Cedric and
|
|
107
|
-
Banville, Hubert and
|
|
108
|
-
Sliwowski, Maciej and
|
|
109
|
-
Wilson, Daniel and
|
|
110
|
-
Brandt, Simon and
|
|
111
|
-
Gnassounou, Théo and
|
|
112
|
-
Paillard, Joseph and
|
|
113
|
-
{Junqueira Lopes}, Bruna and
|
|
114
|
-
Sedlar, Sara and
|
|
115
|
-
Moreau, Thomas and
|
|
116
|
-
Chevallier, Sylvain and
|
|
117
|
-
Gramfort, Alexandre and
|
|
118
|
-
Schirrmeister, Robin Tibor},
|
|
119
|
-
title = {Braindecode: toolbox for decoding raw electrophysiological brain data
|
|
120
|
-
with deep learning models},
|
|
121
|
-
url = {https://github.com/braindecode/braindecode},
|
|
122
|
-
doi = {10.5281/zenodo.17699192},
|
|
123
|
-
publisher = {Zenodo},
|
|
124
|
-
license = {BSD-3-Clause},
|
|
125
|
-
}
|
|
126
|
-
|
|
127
97
|
Additionally, we highly encourage you to cite the article that originally introduced the
|
|
128
98
|
Braindecode library and has served as a foundational reference for many works on deep
|
|
129
99
|
learning with EEG recordings. Please use the following reference:
|
{braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datasets/base.py
RENAMED
|
@@ -579,89 +579,6 @@ class EEGWindowsDataset(RecordDataset):
|
|
|
579
579
|
self.metadata,
|
|
580
580
|
)
|
|
581
581
|
|
|
582
|
-
def to_epochs_dataset(self) -> WindowsDataset:
|
|
583
|
-
"""Converts this :class:`EEGWindowsDataset` to :class:`WindowsDataset` with ``mne.Epochs``.
|
|
584
|
-
|
|
585
|
-
In Braindecode, the data can either be stored as ``mne.io.Raw`` (in :class:`EEGWindowsDataset`)
|
|
586
|
-
or as ``mne.Epochs`` (in :class:`WindowsDataset`). This function converts from the first type to the second,
|
|
587
|
-
which can be useful for reducing disk space when you want to save a dataset.
|
|
588
|
-
|
|
589
|
-
Returns
|
|
590
|
-
-------
|
|
591
|
-
WindowsDataset
|
|
592
|
-
A new :class:`WindowsDataset` with ``mne.Epochs``.
|
|
593
|
-
|
|
594
|
-
Raises
|
|
595
|
-
------
|
|
596
|
-
ValueError
|
|
597
|
-
If the dataset is not compatible with conversion. This includes:
|
|
598
|
-
- If targets are not obtained from metadata
|
|
599
|
-
- If windows have inconsistent sizes or there are no windows to convert
|
|
600
|
-
- If raw.first_samp!=0 (not supported for simplicity)
|
|
601
|
-
"""
|
|
602
|
-
# Check the targets:
|
|
603
|
-
if self.targets_from != "metadata":
|
|
604
|
-
raise ValueError(
|
|
605
|
-
"to_epochs_dataset only works if targets are obtained from metadata."
|
|
606
|
-
)
|
|
607
|
-
|
|
608
|
-
# Check and get window sizes:
|
|
609
|
-
i_start_in_trial = self.crop_inds[:, 1]
|
|
610
|
-
i_stop_in_trial = self.crop_inds[:, 2]
|
|
611
|
-
sizes = np.unique(i_stop_in_trial - i_start_in_trial)
|
|
612
|
-
if len(sizes) > 1:
|
|
613
|
-
raise ValueError("Windows have inconsistent sizes.")
|
|
614
|
-
if len(sizes) != 1:
|
|
615
|
-
raise ValueError("No windows to convert.")
|
|
616
|
-
input_window_seconds = (sizes[0] - 1) / self.raw.info["sfreq"]
|
|
617
|
-
|
|
618
|
-
# Check raw.first_samp:
|
|
619
|
-
if self.raw.first_samp != 0:
|
|
620
|
-
raise ValueError(
|
|
621
|
-
f"to_epochs_dataset only works if raw.first_samp is 0, found {self.raw.first_samp=}"
|
|
622
|
-
)
|
|
623
|
-
|
|
624
|
-
# Create events and epochs:
|
|
625
|
-
events = np.zeros((len(self), 3), dtype=int)
|
|
626
|
-
events[:, 0] = i_start_in_trial
|
|
627
|
-
events[:, 2] = 1
|
|
628
|
-
epochs = mne.Epochs(
|
|
629
|
-
raw=self.raw,
|
|
630
|
-
events=events,
|
|
631
|
-
event_id={"window": 1},
|
|
632
|
-
tmin=0,
|
|
633
|
-
tmax=input_window_seconds,
|
|
634
|
-
metadata=self.metadata.copy(),
|
|
635
|
-
baseline=None,
|
|
636
|
-
)
|
|
637
|
-
# we skip dropping bads to be consistent with EEGWindowsDataset:
|
|
638
|
-
epochs._bad_dropped = True
|
|
639
|
-
|
|
640
|
-
# Populate new WindowsDataset:
|
|
641
|
-
windows = WindowsDataset(
|
|
642
|
-
epochs,
|
|
643
|
-
description=self.description,
|
|
644
|
-
transform=self.transform,
|
|
645
|
-
targets_from=self.targets_from,
|
|
646
|
-
last_target_only=self.last_target_only,
|
|
647
|
-
)
|
|
648
|
-
|
|
649
|
-
window_kwargs = list(getattr(self, "window_kwargs", []))
|
|
650
|
-
window_kwargs.append((self.to_epochs_dataset.__name__, {}))
|
|
651
|
-
setattr(windows, "window_kwargs", window_kwargs)
|
|
652
|
-
if hasattr(self, "raw_preproc_kwargs"):
|
|
653
|
-
setattr(
|
|
654
|
-
windows, "raw_preproc_kwargs", list(getattr(self, "raw_preproc_kwargs"))
|
|
655
|
-
)
|
|
656
|
-
if hasattr(self, "window_preproc_kwargs"):
|
|
657
|
-
setattr(
|
|
658
|
-
windows,
|
|
659
|
-
"window_preproc_kwargs",
|
|
660
|
-
list(getattr(self, "window_preproc_kwargs")),
|
|
661
|
-
)
|
|
662
|
-
|
|
663
|
-
return windows
|
|
664
|
-
|
|
665
582
|
|
|
666
583
|
@register_dataset
|
|
667
584
|
class WindowsDataset(RecordDataset):
|
|
@@ -700,15 +617,6 @@ class WindowsDataset(RecordDataset):
|
|
|
700
617
|
last_target_only: bool = True,
|
|
701
618
|
):
|
|
702
619
|
super().__init__(description, transform)
|
|
703
|
-
self._fast_disk = self._can_use_fast_get_epoch_from_raw(windows)
|
|
704
|
-
if not (self._fast_disk or windows.preload):
|
|
705
|
-
warnings.warn(
|
|
706
|
-
"The provided mne.Epochs object does not meet the requirements for "
|
|
707
|
-
"fast epoch access. This may lead to slow data loading from disk. "
|
|
708
|
-
"Consider preloading the epochs or checking the conditions in "
|
|
709
|
-
"WindowsDataset._can_use_fast_get_epoch_from_raw.",
|
|
710
|
-
UserWarning,
|
|
711
|
-
)
|
|
712
620
|
self.windows = windows
|
|
713
621
|
self.last_target_only = last_target_only
|
|
714
622
|
if targets_from not in ("metadata", "channels"):
|
|
@@ -725,20 +633,6 @@ class WindowsDataset(RecordDataset):
|
|
|
725
633
|
self.raw_preproc_kwargs: list[dict[str, Any]] = []
|
|
726
634
|
self.window_preproc_kwargs: list[dict[str, Any]] = []
|
|
727
635
|
|
|
728
|
-
@staticmethod
|
|
729
|
-
def _can_use_fast_get_epoch_from_raw(epochs: mne.BaseEpochs) -> bool:
|
|
730
|
-
"""Check if we can use the fast _get_epoch_from_raw method,
|
|
731
|
-
or if we need to use the slow get_data method."""
|
|
732
|
-
return (
|
|
733
|
-
not epochs.preload
|
|
734
|
-
and epochs._bad_dropped
|
|
735
|
-
and epochs.detrend is None
|
|
736
|
-
and not epochs._do_baseline # baseline is None
|
|
737
|
-
and (epochs._decim == 1)
|
|
738
|
-
and epochs._offset is None
|
|
739
|
-
and epochs._projector is None
|
|
740
|
-
)
|
|
741
|
-
|
|
742
636
|
def __getitem__(self, index: int):
|
|
743
637
|
"""Get a window and its target.
|
|
744
638
|
|
|
@@ -756,10 +650,7 @@ class WindowsDataset(RecordDataset):
|
|
|
756
650
|
np.ndarray
|
|
757
651
|
Crop indices.
|
|
758
652
|
"""
|
|
759
|
-
|
|
760
|
-
X = self.windows._get_epoch_from_raw(index).astype("float32")
|
|
761
|
-
else:
|
|
762
|
-
X = self.windows.get_data(item=index)[0].astype("float32")
|
|
653
|
+
X = self.windows.get_data(item=index)[0].astype("float32")
|
|
763
654
|
if self.transform is not None:
|
|
764
655
|
X = self.transform(X)
|
|
765
656
|
if self.targets_from == "metadata":
|
|
@@ -815,9 +706,7 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
815
706
|
|
|
816
707
|
def __init__(
|
|
817
708
|
self,
|
|
818
|
-
list_of_ds:
|
|
819
|
-
list[T] | list[BaseConcatDataset[T]] | list[T | BaseConcatDataset[T]]
|
|
820
|
-
),
|
|
709
|
+
list_of_ds: list[T | BaseConcatDataset[T]],
|
|
821
710
|
target_transform: Callable | None = None,
|
|
822
711
|
*,
|
|
823
712
|
lazy: bool = False,
|
|
@@ -1394,40 +1283,3 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1394
1283
|
|
|
1395
1284
|
def _repr_html_(self):
|
|
1396
1285
|
return self._build_repr().to_html()
|
|
1397
|
-
|
|
1398
|
-
def to_epochs_dataset(self) -> BaseConcatDataset[WindowsDataset]:
|
|
1399
|
-
"""Converts this :class:`BaseConcatDataset` such that all datasets are :class:`WindowsDataset` with ``mne.Epochs``.
|
|
1400
|
-
|
|
1401
|
-
In Braindecode, the data can either be stored as ``mne.io.Raw`` (in :class:`EEGWindowsDataset`)
|
|
1402
|
-
or as ``mne.Epochs`` (in :class:`WindowsDataset`). This function converts all the underlying datasets to
|
|
1403
|
-
:class:`WindowsDataset` with ``mne.Epochs``.
|
|
1404
|
-
This can be useful for reducing disk space when you want to save a dataset.
|
|
1405
|
-
|
|
1406
|
-
Returns
|
|
1407
|
-
-------
|
|
1408
|
-
BaseConcatDataset[WindowsDataset]
|
|
1409
|
-
A new :class:`BaseConcatDataset` where all datasets are :class:`WindowsDataset` with ``mne.Epochs``.
|
|
1410
|
-
|
|
1411
|
-
Raises
|
|
1412
|
-
------
|
|
1413
|
-
ValueError
|
|
1414
|
-
If any of the underlying datasets is a :class:`RawDataset` or any other type that is not
|
|
1415
|
-
:class:`EEGWindowsDataset` or :class:`WindowsDataset`, as they cannot be converted to epochs.
|
|
1416
|
-
"""
|
|
1417
|
-
datasets = self.datasets
|
|
1418
|
-
if not all(
|
|
1419
|
-
isinstance(ds, (EEGWindowsDataset, WindowsDataset)) for ds in datasets
|
|
1420
|
-
):
|
|
1421
|
-
raise ValueError(
|
|
1422
|
-
"All datasets must be EEGWindowsDataset or WindowsDataset to convert to WindowsDataset."
|
|
1423
|
-
)
|
|
1424
|
-
new_datasets: list[WindowsDataset] = []
|
|
1425
|
-
for ds in datasets:
|
|
1426
|
-
if isinstance(ds, EEGWindowsDataset):
|
|
1427
|
-
new_ds = ds.to_epochs_dataset()
|
|
1428
|
-
new_datasets.append(new_ds)
|
|
1429
|
-
elif isinstance(ds, WindowsDataset):
|
|
1430
|
-
new_datasets.append(ds)
|
|
1431
|
-
return BaseConcatDataset(
|
|
1432
|
-
new_datasets, target_transform=self.target_transform, lazy=self._lazy
|
|
1433
|
-
)
|
{braindecode-1.3.2.dev177700329 → braindecode-1.3.2.dev178169072}/braindecode/datasets/bids/hub.py
RENAMED
|
@@ -27,7 +27,6 @@ The format follows a BIDS-inspired sourcedata structure:
|
|
|
27
27
|
#
|
|
28
28
|
# License: BSD (3-clause)
|
|
29
29
|
|
|
30
|
-
import contextlib
|
|
31
30
|
import json
|
|
32
31
|
import logging
|
|
33
32
|
import tempfile
|
|
@@ -70,8 +69,6 @@ huggingface_hub = _soft_import(
|
|
|
70
69
|
|
|
71
70
|
log = logging.getLogger(__name__)
|
|
72
71
|
|
|
73
|
-
_LOCK_FILE = "format_info.json"
|
|
74
|
-
|
|
75
72
|
|
|
76
73
|
class HubDatasetMixin:
|
|
77
74
|
"""
|
|
@@ -87,6 +84,7 @@ class HubDatasetMixin:
|
|
|
87
84
|
>>> dataset = NMT(path=path, preload=True)
|
|
88
85
|
>>> dataset.push_to_hub(
|
|
89
86
|
... repo_id="username/nmt-dataset",
|
|
87
|
+
... commit_message="Add NMT dataset"
|
|
90
88
|
... )
|
|
91
89
|
>>>
|
|
92
90
|
>>> # Load dataset from Hub
|
|
@@ -98,14 +96,13 @@ class HubDatasetMixin:
|
|
|
98
96
|
def push_to_hub(
|
|
99
97
|
self,
|
|
100
98
|
repo_id: str,
|
|
99
|
+
commit_message: Optional[str] = None,
|
|
101
100
|
private: bool = False,
|
|
102
101
|
token: Optional[str] = None,
|
|
102
|
+
create_pr: bool = False,
|
|
103
103
|
compression: str = "blosc",
|
|
104
104
|
compression_level: int = 5,
|
|
105
105
|
pipeline_name: str = "braindecode",
|
|
106
|
-
chunk_size: int = 5_000_000,
|
|
107
|
-
local_cache_dir: str | Path | None = None,
|
|
108
|
-
**kwargs,
|
|
109
106
|
) -> str:
|
|
110
107
|
"""
|
|
111
108
|
Upload the dataset to the Hugging Face Hub in BIDS-like Zarr format.
|
|
@@ -119,41 +116,20 @@ class HubDatasetMixin:
|
|
|
119
116
|
----------
|
|
120
117
|
repo_id : str
|
|
121
118
|
Repository ID on the Hugging Face Hub (e.g., "username/dataset-name").
|
|
119
|
+
commit_message : str | None
|
|
120
|
+
Commit message. If None, a default message is generated.
|
|
122
121
|
private : bool, default=False
|
|
123
122
|
Whether to create a private repository.
|
|
124
123
|
token : str | None
|
|
125
124
|
Hugging Face API token. If None, uses cached token.
|
|
125
|
+
create_pr : bool, default=False
|
|
126
|
+
Whether to create a Pull Request instead of directly committing.
|
|
126
127
|
compression : str, default="blosc"
|
|
127
128
|
Compression algorithm for Zarr. Options: "blosc", "zstd", "gzip", None.
|
|
128
129
|
compression_level : int, default=5
|
|
129
130
|
Compression level (0-9). Level 5 provides optimal balance.
|
|
130
131
|
pipeline_name : str, default="braindecode"
|
|
131
132
|
Name of the processing pipeline for BIDS sourcedata.
|
|
132
|
-
chunk_size : int, default=5_000_000
|
|
133
|
-
Number of samples per chunk in Zarr along the time/window dimension.
|
|
134
|
-
Larger chunk sizes create fewer but larger chunks/files. This parameter
|
|
135
|
-
is used for both continuous data (e.g., RawDataset, EEGWindowsDataset)
|
|
136
|
-
and pre-cut windows (WindowsDataset). For WindowsDataset, multiple
|
|
137
|
-
windows may be stored in a single chunk depending on their duration
|
|
138
|
-
and the chosen ``chunk_size``.
|
|
139
|
-
local_cache_dir : str | Path | None
|
|
140
|
-
Local directory to use for temporary files during upload. If None, uses
|
|
141
|
-
the system temp directory and cleans it up after upload. If provided,
|
|
142
|
-
the directory is used as a persistent cache:
|
|
143
|
-
|
|
144
|
-
- If the directory is empty (or does not exist), the cache is built
|
|
145
|
-
there and a lock file (``format_info.json``) is written once
|
|
146
|
-
the cache is complete, before the upload starts. The file
|
|
147
|
-
contains the zarr conversion parameters as JSON.
|
|
148
|
-
- If the lock file is present and its JSON parameters match the
|
|
149
|
-
current call, cache creation is skipped and the upload resumes
|
|
150
|
-
directly (useful for retrying interrupted uploads).
|
|
151
|
-
- If the lock file is present but its JSON parameters differ from
|
|
152
|
-
the current call, a ``ValueError`` is raised.
|
|
153
|
-
- If the directory is non-empty but the lock file is absent, a
|
|
154
|
-
``ValueError`` is raised listing the files found.
|
|
155
|
-
**kwargs
|
|
156
|
-
Additional arguments passed to huggingface_hub.upload_large_folder().
|
|
157
133
|
|
|
158
134
|
Returns
|
|
159
135
|
-------
|
|
@@ -173,6 +149,7 @@ class HubDatasetMixin:
|
|
|
173
149
|
>>> # Upload with BIDS-like structure
|
|
174
150
|
>>> url = dataset.push_to_hub(
|
|
175
151
|
... repo_id="myusername/nmt-dataset",
|
|
152
|
+
... commit_message="Upload NMT EEG dataset"
|
|
176
153
|
... )
|
|
177
154
|
"""
|
|
178
155
|
if huggingface_hub is False or zarr is False:
|
|
@@ -182,12 +159,13 @@ class HubDatasetMixin:
|
|
|
182
159
|
)
|
|
183
160
|
|
|
184
161
|
# Create API instance
|
|
185
|
-
|
|
162
|
+
_ = huggingface_hub.HfApi(token=token)
|
|
186
163
|
|
|
187
164
|
# Create repository if it doesn't exist
|
|
188
165
|
try:
|
|
189
|
-
|
|
166
|
+
huggingface_hub.create_repo(
|
|
190
167
|
repo_id=repo_id,
|
|
168
|
+
token=token,
|
|
191
169
|
private=private,
|
|
192
170
|
repo_type="dataset",
|
|
193
171
|
exist_ok=True,
|
|
@@ -195,68 +173,74 @@ class HubDatasetMixin:
|
|
|
195
173
|
except Exception as e:
|
|
196
174
|
raise RuntimeError(f"Failed to create repository: {e}")
|
|
197
175
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
"pipeline_name": pipeline_name,
|
|
202
|
-
"compression": compression,
|
|
203
|
-
"compression_level": compression_level,
|
|
204
|
-
"chunk_size": chunk_size,
|
|
205
|
-
"braindecode_version": braindecode.__version__,
|
|
206
|
-
**format_info,
|
|
207
|
-
}
|
|
176
|
+
# Create a temporary directory for upload
|
|
177
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
178
|
+
tmp_path = Path(tmpdir)
|
|
208
179
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
180
|
+
# Create BIDS-like sourcedata structure
|
|
181
|
+
log.info("Creating BIDS-like sourcedata structure...")
|
|
182
|
+
bids_layout = hub_format.BIDSSourcedataLayout(
|
|
183
|
+
tmp_path, pipeline_name=pipeline_name
|
|
184
|
+
)
|
|
185
|
+
sourcedata_dir = bids_layout.create_structure()
|
|
186
|
+
|
|
187
|
+
# Save dataset_description.json
|
|
188
|
+
bids_layout.save_dataset_description()
|
|
189
|
+
|
|
190
|
+
# Save participants.tsv
|
|
191
|
+
descriptions = [ds.description for ds in self.datasets]
|
|
192
|
+
bids_layout.save_participants(descriptions)
|
|
193
|
+
|
|
194
|
+
# Save BIDS sidecar files for each recording
|
|
195
|
+
self._save_bids_sidecar_files(bids_layout)
|
|
196
|
+
|
|
197
|
+
# Convert dataset to Zarr format inside sourcedata
|
|
198
|
+
log.info("Converting dataset to Zarr format...")
|
|
199
|
+
dataset_path = sourcedata_dir / "dataset.zarr"
|
|
200
|
+
|
|
201
|
+
self._convert_to_zarr_inline(
|
|
202
|
+
dataset_path,
|
|
203
|
+
compression,
|
|
204
|
+
compression_level,
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
# Save dataset metadata (README.md)
|
|
208
|
+
self._save_dataset_card(tmp_path)
|
|
209
|
+
|
|
210
|
+
# Save format info
|
|
211
|
+
format_info_path = tmp_path / "format_info.json"
|
|
212
|
+
with open(format_info_path, "w", encoding="utf-8") as f:
|
|
213
|
+
format_info = self._get_format_info_inline()
|
|
214
|
+
json.dump(
|
|
215
|
+
{
|
|
216
|
+
"format": "zarr",
|
|
217
|
+
"pipeline_name": pipeline_name,
|
|
218
|
+
"compression": compression,
|
|
219
|
+
"compression_level": compression_level,
|
|
220
|
+
"braindecode_version": braindecode.__version__,
|
|
221
|
+
**format_info,
|
|
222
|
+
},
|
|
223
|
+
f,
|
|
224
|
+
indent=2,
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
# Default commit message
|
|
228
|
+
if commit_message is None:
|
|
229
|
+
commit_message = (
|
|
230
|
+
f"Upload EEG dataset in BIDS-like "
|
|
231
|
+
f"Zarr format ({len(self.datasets)} recordings)"
|
|
232
|
+
)
|
|
251
233
|
|
|
252
234
|
# Upload folder to Hub
|
|
253
235
|
log.info(f"Uploading to Hugging Face Hub ({repo_id})...")
|
|
254
236
|
try:
|
|
255
|
-
url =
|
|
237
|
+
url = huggingface_hub.upload_folder(
|
|
256
238
|
repo_id=repo_id,
|
|
257
239
|
folder_path=str(tmp_path),
|
|
258
240
|
repo_type="dataset",
|
|
259
|
-
|
|
241
|
+
commit_message=commit_message,
|
|
242
|
+
token=token,
|
|
243
|
+
create_pr=create_pr,
|
|
260
244
|
)
|
|
261
245
|
log.info(f"Dataset uploaded successfully to {repo_id}")
|
|
262
246
|
log.info(f"URL: https://huggingface.co/datasets/{repo_id}")
|
|
@@ -264,55 +248,6 @@ class HubDatasetMixin:
|
|
|
264
248
|
except Exception as e:
|
|
265
249
|
raise RuntimeError(f"Failed to upload dataset: {e}")
|
|
266
250
|
|
|
267
|
-
def _build_local_cache(
|
|
268
|
-
self,
|
|
269
|
-
tmp_path,
|
|
270
|
-
format_info_lock,
|
|
271
|
-
):
|
|
272
|
-
"""Build the local cache directory with the dataset in Zarr format and BIDS-like structure.
|
|
273
|
-
This folder will be uploaded to the Hub"""
|
|
274
|
-
compression = format_info_lock["compression"]
|
|
275
|
-
compression_level = format_info_lock["compression_level"]
|
|
276
|
-
pipeline_name = format_info_lock["pipeline_name"]
|
|
277
|
-
chunk_size = format_info_lock["chunk_size"]
|
|
278
|
-
|
|
279
|
-
# Create BIDS-like sourcedata structure
|
|
280
|
-
log.info("Creating BIDS-like sourcedata structure...")
|
|
281
|
-
bids_layout = hub_format.BIDSSourcedataLayout(
|
|
282
|
-
tmp_path, pipeline_name=pipeline_name
|
|
283
|
-
)
|
|
284
|
-
sourcedata_dir = bids_layout.create_structure()
|
|
285
|
-
|
|
286
|
-
# Save dataset_description.json
|
|
287
|
-
bids_layout.save_dataset_description()
|
|
288
|
-
|
|
289
|
-
# Save participants.tsv
|
|
290
|
-
descriptions = [ds.description for ds in self.datasets]
|
|
291
|
-
bids_layout.save_participants(descriptions)
|
|
292
|
-
|
|
293
|
-
# Save BIDS sidecar files for each recording
|
|
294
|
-
self._save_bids_sidecar_files(bids_layout)
|
|
295
|
-
|
|
296
|
-
# Convert dataset to Zarr format inside sourcedata
|
|
297
|
-
log.info("Converting dataset to Zarr format...")
|
|
298
|
-
dataset_path = sourcedata_dir / "dataset.zarr"
|
|
299
|
-
|
|
300
|
-
self._convert_to_zarr_inline(
|
|
301
|
-
dataset_path,
|
|
302
|
-
compression,
|
|
303
|
-
compression_level,
|
|
304
|
-
chunk_size,
|
|
305
|
-
)
|
|
306
|
-
|
|
307
|
-
# Save dataset metadata (README.md)
|
|
308
|
-
self._save_dataset_card(tmp_path)
|
|
309
|
-
|
|
310
|
-
# Save format info
|
|
311
|
-
# This marks the cache as complete
|
|
312
|
-
format_info_path = tmp_path / _LOCK_FILE
|
|
313
|
-
with open(format_info_path, "w", encoding="utf-8") as f:
|
|
314
|
-
json.dump(format_info_lock, f, indent=2)
|
|
315
|
-
|
|
316
251
|
def _save_dataset_card(self, path: Path, bids_inspired: bool = True) -> None:
|
|
317
252
|
"""Generate and save a dataset card (README.md) with metadata.
|
|
318
253
|
|
|
@@ -530,7 +465,7 @@ class HubDatasetMixin:
|
|
|
530
465
|
)
|
|
531
466
|
|
|
532
467
|
# Load format info
|
|
533
|
-
format_info_path = Path(dataset_dir) /
|
|
468
|
+
format_info_path = Path(dataset_dir) / "format_info.json"
|
|
534
469
|
if format_info_path.exists():
|
|
535
470
|
with open(format_info_path, "r") as f:
|
|
536
471
|
format_info = json.load(f)
|
|
@@ -660,7 +595,6 @@ class HubDatasetMixin:
|
|
|
660
595
|
output_path: Path,
|
|
661
596
|
compression: str,
|
|
662
597
|
compression_level: int,
|
|
663
|
-
chunk_size: int = 5_000_000,
|
|
664
598
|
) -> None:
|
|
665
599
|
"""Convert dataset to Zarr format (inline implementation)."""
|
|
666
600
|
|
|
@@ -726,14 +660,7 @@ class HubDatasetMixin:
|
|
|
726
660
|
|
|
727
661
|
# Save using inlined function
|
|
728
662
|
_save_windows_to_zarr(
|
|
729
|
-
grp,
|
|
730
|
-
data,
|
|
731
|
-
metadata,
|
|
732
|
-
description,
|
|
733
|
-
info_dict,
|
|
734
|
-
compressor,
|
|
735
|
-
target_name,
|
|
736
|
-
chunk_size,
|
|
663
|
+
grp, data, metadata, description, info_dict, compressor, target_name
|
|
737
664
|
)
|
|
738
665
|
|
|
739
666
|
elif dataset_type == "EEGWindowsDataset":
|
|
@@ -755,7 +682,6 @@ class HubDatasetMixin:
|
|
|
755
682
|
targets_from,
|
|
756
683
|
last_target_only,
|
|
757
684
|
compressor,
|
|
758
|
-
chunk_size,
|
|
759
685
|
)
|
|
760
686
|
|
|
761
687
|
elif dataset_type == "RawDataset":
|
|
@@ -767,13 +693,7 @@ class HubDatasetMixin:
|
|
|
767
693
|
|
|
768
694
|
# Save using inlined function
|
|
769
695
|
_save_raw_to_zarr(
|
|
770
|
-
grp,
|
|
771
|
-
raw,
|
|
772
|
-
description,
|
|
773
|
-
info_dict,
|
|
774
|
-
target_name,
|
|
775
|
-
compressor,
|
|
776
|
-
chunk_size,
|
|
696
|
+
grp, raw, description, info_dict, target_name, compressor
|
|
777
697
|
)
|
|
778
698
|
|
|
779
699
|
def _get_format_info_inline(self):
|
|
@@ -845,16 +765,11 @@ class HubDatasetMixin:
|
|
|
845
765
|
|
|
846
766
|
# Convert to MNE objects and create dataset
|
|
847
767
|
info = Info.from_json_dict(info_dict)
|
|
848
|
-
targets = metadata["target"].values
|
|
849
|
-
if np.issubdtype(targets.dtype, np.integer):
|
|
850
|
-
event_ids = targets
|
|
851
|
-
else:
|
|
852
|
-
event_ids = np.ones(len(metadata), dtype=int)
|
|
853
768
|
events = np.column_stack(
|
|
854
769
|
[
|
|
855
|
-
metadata["i_start_in_trial"].values
|
|
770
|
+
metadata["i_start_in_trial"].values,
|
|
856
771
|
np.zeros(len(metadata), dtype=int),
|
|
857
|
-
|
|
772
|
+
metadata["target"].values,
|
|
858
773
|
]
|
|
859
774
|
)
|
|
860
775
|
epochs = mne.EpochsArray(data, info, events=events, metadata=metadata)
|