Braindecode 1.3.2.dev170805792__tar.gz → 1.3.2.dev171423126__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.dev170805792/braindecode.egg-info → braindecode-1.3.2.dev171423126}/PKG-INFO +1 -1
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datasets/base.py +30 -266
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datasets/bids/hub.py +37 -68
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datasets/bids/hub_io.py +44 -21
- braindecode-1.3.2.dev171423126/braindecode/models/deepsleepnet.py +417 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/util.py +1 -1
- braindecode-1.3.2.dev171423126/braindecode/version.py +1 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126/braindecode.egg-info}/PKG-INFO +1 -1
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/whats_new.rst +0 -11
- braindecode-1.3.2.dev170805792/braindecode/models/deepsleepnet.py +0 -477
- braindecode-1.3.2.dev170805792/braindecode/version.py +0 -1
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/LICENSE.txt +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/MANIFEST.in +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/NOTICE.txt +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/README.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/__init__.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/augmentation/__init__.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/augmentation/base.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/augmentation/functional.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/augmentation/transforms.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/classifier.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datasets/__init__.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datasets/bbci.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datasets/bcicomp.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datasets/bids/__init__.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datasets/bids/datasets.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datasets/bids/format.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datasets/bids/hub_format.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datasets/bids/hub_validation.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datasets/bids/iterable.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datasets/chb_mit.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datasets/mne.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datasets/moabb.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datasets/nmt.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datasets/registry.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datasets/siena.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datasets/sleep_physio_challe_18.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datasets/sleep_physionet.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datasets/tuh.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datasets/utils.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datasets/xy.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datautil/__init__.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datautil/channel_utils.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datautil/hub_formats.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datautil/serialization.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datautil/util.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/eegneuralnet.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/functional/__init__.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/functional/functions.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/functional/initialization.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/__init__.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/atcnet.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/attentionbasenet.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/attn_sleep.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/base.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/bendr.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/biot.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/brainmodule.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/cbramod.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/config.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/contrawr.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/ctnet.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/deep4.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/dgcnn.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/eegconformer.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/eeginception_erp.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/eeginception_mi.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/eegitnet.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/eegminer.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/eegnet.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/eegnex.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/eegpt.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/eegsimpleconv.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/eegsym.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/eegtcnet.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/fbcnet.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/fblightconvnet.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/fbmsnet.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/hybrid.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/ifnet.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/labram.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/luna.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/medformer.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/msvtnet.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/patchedtransformer.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/reve.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/sccnet.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/shallow_fbcsp.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/signal_jepa.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/sinc_shallow.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/sleep_stager_blanco_2020.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/sleep_stager_chambon_2018.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/sparcnet.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/sstdpn.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/summary.csv +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/syncnet.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/tcn.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/tidnet.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/tsinception.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/models/usleep.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/modules/__init__.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/modules/activation.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/modules/attention.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/modules/blocks.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/modules/convolution.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/modules/filter.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/modules/layers.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/modules/linear.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/modules/parametrization.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/modules/stats.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/modules/util.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/modules/wrapper.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/preprocessing/__init__.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/preprocessing/eegprep_preprocess.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/preprocessing/mne_preprocess.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/preprocessing/preprocess.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/preprocessing/util.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/preprocessing/windowers.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/regressor.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/samplers/__init__.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/samplers/base.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/samplers/ssl.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/training/__init__.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/training/callbacks.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/training/losses.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/training/scoring.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/util.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/visualization/__init__.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/visualization/confusion_matrices.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/visualization/gradients.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode.egg-info/SOURCES.txt +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode.egg-info/dependency_links.txt +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode.egg-info/requires.txt +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode.egg-info/top_level.txt +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/Makefile +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/_templates/autosummary/class.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/_templates/autosummary/class_in_subdir.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/_templates/autosummary/function.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/_templates/autosummary/function_in_subdir.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/api.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/cite.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/conf.py +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/help.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/index.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/install/install.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/install/install_pip.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/install/install_source.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/models/categorization/attention.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/models/categorization/channel.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/models/categorization/convolution.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/models/categorization/filterbank.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/models/categorization/gnn.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/models/categorization/interpretable.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/models/categorization/lbm.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/models/categorization/recurrent.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/models/categorization/spd.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/models/models.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/models/models_categorization.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/models/models_table.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/models/models_visualization.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/docs/sg_execution_times.rst +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/pyproject.toml +0 -0
- {braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/setup.cfg +0 -0
{braindecode-1.3.2.dev170805792/braindecode.egg-info → braindecode-1.3.2.dev171423126}/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.dev171423126
|
|
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>
|
{braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datasets/base.py
RENAMED
|
@@ -20,24 +20,18 @@ from abc import abstractmethod
|
|
|
20
20
|
from collections import Counter
|
|
21
21
|
from collections.abc import Callable
|
|
22
22
|
from glob import glob
|
|
23
|
-
from pathlib import Path
|
|
24
23
|
from typing import Any, Generic, Iterable, no_type_check
|
|
25
24
|
|
|
26
|
-
import mne
|
|
27
25
|
import mne.io
|
|
28
26
|
import numpy as np
|
|
29
27
|
import pandas as pd
|
|
30
|
-
from mne.utils import _soft_import
|
|
31
28
|
from mne.utils.docs import deprecated
|
|
32
29
|
from torch.utils.data import ConcatDataset, Dataset, IterableDataset
|
|
33
30
|
from typing_extensions import TypeVar
|
|
34
31
|
|
|
35
32
|
from .bids.hub import HubDatasetMixin
|
|
36
|
-
from .bids.hub_io import _restore_nan_from_json
|
|
37
33
|
from .registry import register_dataset
|
|
38
34
|
|
|
39
|
-
zarr = _soft_import("zarr", purpose="lazy loading from Zarr", strict=False)
|
|
40
|
-
|
|
41
35
|
|
|
42
36
|
def _create_description(description) -> pd.Series:
|
|
43
37
|
if description is not None:
|
|
@@ -182,11 +176,14 @@ def _concat_metadata_summary(datasets):
|
|
|
182
176
|
|
|
183
177
|
|
|
184
178
|
def _channel_info(mne_obj):
|
|
185
|
-
"""Extract
|
|
186
|
-
|
|
179
|
+
"""Extract channel summary from an mne object.
|
|
180
|
+
|
|
181
|
+
Returns (n_ch, type_str, sfreq).
|
|
182
|
+
"""
|
|
183
|
+
info = mne_obj.info
|
|
187
184
|
n_ch = info["nchan"]
|
|
188
185
|
sfreq = info["sfreq"]
|
|
189
|
-
ch_types =
|
|
186
|
+
ch_types = mne_obj.get_channel_types()
|
|
190
187
|
type_counts = Counter(ch_types)
|
|
191
188
|
type_str = ", ".join(f"{cnt} {t.upper()}" for t, cnt in sorted(type_counts.items()))
|
|
192
189
|
return n_ch, type_str, sfreq
|
|
@@ -297,88 +294,6 @@ def _build_windowed_repr(
|
|
|
297
294
|
return b
|
|
298
295
|
|
|
299
296
|
|
|
300
|
-
def _zarr_to_memmap(zarr_path, group_name):
|
|
301
|
-
"""Decompress a zarr array to a float64 ``.npy`` memmap (one-time, atomic).
|
|
302
|
-
|
|
303
|
-
Saved as float64 so MNE objects can wrap the memmap zero-copy
|
|
304
|
-
(MNE requires float64 internally). Copy-on-write mode (``'c'``)
|
|
305
|
-
means preprocessing writes go to RAM, the file stays untouched.
|
|
306
|
-
"""
|
|
307
|
-
zarr_p = Path(zarr_path)
|
|
308
|
-
cache_dir = zarr_p.parent / f".{zarr_p.name}_memmap"
|
|
309
|
-
npy_path = cache_dir / f"{group_name}.npy"
|
|
310
|
-
|
|
311
|
-
if not npy_path.exists():
|
|
312
|
-
arr = zarr.open(zarr_path, mode="r")[group_name]["data"]
|
|
313
|
-
cache_dir.mkdir(parents=True, exist_ok=True)
|
|
314
|
-
tmp_path = cache_dir / f"{group_name}.{os.getpid()}.tmp.npy"
|
|
315
|
-
# Write chunk-by-chunk to avoid materializing the full array in RAM
|
|
316
|
-
mm = np.lib.format.open_memmap(
|
|
317
|
-
tmp_path, mode="w+", dtype=np.float64, shape=arr.shape
|
|
318
|
-
)
|
|
319
|
-
chunk0 = arr.chunks[0] if hasattr(arr, "chunks") else arr.shape[0]
|
|
320
|
-
for start in range(0, arr.shape[0], chunk0):
|
|
321
|
-
end = min(start + chunk0, arr.shape[0])
|
|
322
|
-
mm[start:end] = np.asarray(arr[start:end], dtype=np.float64)
|
|
323
|
-
mm.flush()
|
|
324
|
-
del mm
|
|
325
|
-
try:
|
|
326
|
-
tmp_path.rename(npy_path)
|
|
327
|
-
except OSError:
|
|
328
|
-
tmp_path.unlink(missing_ok=True)
|
|
329
|
-
|
|
330
|
-
return npy_path
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
class _ZarrMixin:
|
|
334
|
-
"""Zarr-to-memmap lazy loading with MNE compatibility.
|
|
335
|
-
|
|
336
|
-
Decompresses zarr to float64 ``.npy`` memmaps on first access.
|
|
337
|
-
MNE objects (``raw``/``windows``) are reconstructed lazily on first
|
|
338
|
-
property access, backed by copy-on-write memmaps so preprocessing
|
|
339
|
-
writes go to RAM while the file stays untouched.
|
|
340
|
-
"""
|
|
341
|
-
|
|
342
|
-
_zarr_data = None
|
|
343
|
-
|
|
344
|
-
def _open_zarr(self):
|
|
345
|
-
npy_path = _zarr_to_memmap(self._zarr_path, self._group_name)
|
|
346
|
-
# 'c' = copy-on-write: reads from file, writes to RAM
|
|
347
|
-
self._zarr_data = np.load(npy_path, mmap_mode="c")
|
|
348
|
-
|
|
349
|
-
def _make_mne_info(self):
|
|
350
|
-
"""Reconstruct ``mne.Info`` from stored dict (no data I/O)."""
|
|
351
|
-
return mne.Info.from_json_dict(_restore_nan_from_json(self._info_dict))
|
|
352
|
-
|
|
353
|
-
@classmethod
|
|
354
|
-
def _init_zarr_base(cls, zarr_path, group_name, description, info_dict, transform):
|
|
355
|
-
"""Shared ``_from_zarr`` preamble: create instance with zarr attrs."""
|
|
356
|
-
if zarr is False:
|
|
357
|
-
raise ImportError("zarr is required: pip install braindecode[hub]")
|
|
358
|
-
obj = object.__new__(cls)
|
|
359
|
-
RecordDataset.__init__(obj, description, transform)
|
|
360
|
-
obj._zarr_path = Path(zarr_path)
|
|
361
|
-
obj._group_name = group_name
|
|
362
|
-
obj._info_dict = info_dict
|
|
363
|
-
return obj
|
|
364
|
-
|
|
365
|
-
def __getstate__(self):
|
|
366
|
-
state = self.__dict__.copy()
|
|
367
|
-
state.pop("_zarr_data", None)
|
|
368
|
-
# Drop lazily-constructed mne objects; they'll be rebuilt from memmap
|
|
369
|
-
if hasattr(self, "_zarr_path"):
|
|
370
|
-
state.pop("_raw", None)
|
|
371
|
-
state.pop("_windows", None)
|
|
372
|
-
return state
|
|
373
|
-
|
|
374
|
-
def __setstate__(self, state):
|
|
375
|
-
self.__dict__.update(state)
|
|
376
|
-
if hasattr(self, "_zarr_path"):
|
|
377
|
-
self._open_zarr()
|
|
378
|
-
else:
|
|
379
|
-
self._zarr_data = None
|
|
380
|
-
|
|
381
|
-
|
|
382
297
|
class RecordDataset(Dataset[tuple[np.ndarray, int | str, tuple[int, int, int]]]):
|
|
383
298
|
def __init__(
|
|
384
299
|
self,
|
|
@@ -446,7 +361,7 @@ T = TypeVar("T", bound=RecordDataset)
|
|
|
446
361
|
|
|
447
362
|
|
|
448
363
|
@register_dataset
|
|
449
|
-
class RawDataset(
|
|
364
|
+
class RawDataset(RecordDataset):
|
|
450
365
|
"""Returns samples from an mne.io.Raw object along with a target.
|
|
451
366
|
|
|
452
367
|
Dataset which serves samples from an mne.io.Raw object along with a target.
|
|
@@ -480,43 +395,8 @@ class RawDataset(_ZarrMixin, RecordDataset):
|
|
|
480
395
|
self.target_name = self._target_name(target_name)
|
|
481
396
|
self.raw_preproc_kwargs: list[dict[str, Any]] = []
|
|
482
397
|
|
|
483
|
-
@classmethod
|
|
484
|
-
def _from_zarr(
|
|
485
|
-
cls,
|
|
486
|
-
zarr_path,
|
|
487
|
-
group_name,
|
|
488
|
-
description,
|
|
489
|
-
info_dict,
|
|
490
|
-
target_name=None,
|
|
491
|
-
transform=None,
|
|
492
|
-
):
|
|
493
|
-
"""Create a lazy Zarr-backed RawDataset (internal API)."""
|
|
494
|
-
obj = cls._init_zarr_base(
|
|
495
|
-
zarr_path, group_name, description, info_dict, transform
|
|
496
|
-
)
|
|
497
|
-
obj._raw = None
|
|
498
|
-
obj.target_name = cls._target_name(obj, target_name)
|
|
499
|
-
obj.raw_preproc_kwargs = []
|
|
500
|
-
obj._open_zarr()
|
|
501
|
-
return obj
|
|
502
|
-
|
|
503
|
-
@property
|
|
504
|
-
def raw(self):
|
|
505
|
-
if self._raw is None and self._zarr_data is not None:
|
|
506
|
-
self._raw = mne.io.RawArray(self._zarr_data, self._make_mne_info())
|
|
507
|
-
return self._raw
|
|
508
|
-
|
|
509
|
-
@raw.setter
|
|
510
|
-
def raw(self, value):
|
|
511
|
-
self._raw = value
|
|
512
|
-
|
|
513
398
|
def __getitem__(self, index):
|
|
514
|
-
|
|
515
|
-
X = np.array(self._zarr_data[:, index], dtype="float32")
|
|
516
|
-
if X.ndim == 1:
|
|
517
|
-
X = X[:, np.newaxis]
|
|
518
|
-
else:
|
|
519
|
-
X = self._raw[:, index][0]
|
|
399
|
+
X = self.raw[:, index][0]
|
|
520
400
|
y = None
|
|
521
401
|
if self.target_name is not None:
|
|
522
402
|
y = self.description[self.target_name]
|
|
@@ -527,19 +407,13 @@ class RawDataset(_ZarrMixin, RecordDataset):
|
|
|
527
407
|
return X, y
|
|
528
408
|
|
|
529
409
|
def __len__(self):
|
|
530
|
-
|
|
531
|
-
return len(self._raw)
|
|
532
|
-
return self._zarr_data.shape[1]
|
|
410
|
+
return len(self.raw)
|
|
533
411
|
|
|
534
412
|
def _build_repr(self):
|
|
535
413
|
b = _ReprBuilder(type(self).__name__)
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
else:
|
|
540
|
-
n_ch, type_str, sfreq = _channel_info(self._make_mne_info())
|
|
541
|
-
n_times = self._zarr_data.shape[1]
|
|
542
|
-
duration = n_times / sfreq if sfreq > 0 else 0
|
|
414
|
+
n_ch, type_str, sfreq = _channel_info(self.raw)
|
|
415
|
+
n_times = len(self.raw.times)
|
|
416
|
+
duration = n_times / sfreq
|
|
543
417
|
b.add_header(f"{n_ch} ch ({type_str})", "Channels", f"{n_ch} ({type_str})")
|
|
544
418
|
b.add_header(f"{sfreq:.1f} Hz", "Sfreq", f"{sfreq:.1f} Hz")
|
|
545
419
|
b.add_header(
|
|
@@ -550,8 +424,6 @@ class RawDataset(_ZarrMixin, RecordDataset):
|
|
|
550
424
|
if self.description is not None:
|
|
551
425
|
desc_items = ", ".join(f"{k}={v}" for k, v in self.description.items())
|
|
552
426
|
b.add_row("description", desc_items)
|
|
553
|
-
if self._zarr_data is not None:
|
|
554
|
-
b.add_footnote("Data loaded lazily from Zarr")
|
|
555
427
|
return b
|
|
556
428
|
|
|
557
429
|
def _target_name(self, target_name):
|
|
@@ -592,7 +464,7 @@ class BaseDataset(RawDataset):
|
|
|
592
464
|
|
|
593
465
|
|
|
594
466
|
@register_dataset
|
|
595
|
-
class EEGWindowsDataset(
|
|
467
|
+
class EEGWindowsDataset(RecordDataset):
|
|
596
468
|
"""Returns windows from an mne.Raw object, its window indices, along with a target.
|
|
597
469
|
|
|
598
470
|
Dataset which serves windows from an mne.Epochs object along with their
|
|
@@ -649,47 +521,6 @@ class EEGWindowsDataset(_ZarrMixin, RecordDataset):
|
|
|
649
521
|
self.y = metadata.loc[:, "target"].to_list()
|
|
650
522
|
self.raw_preproc_kwargs: list[dict[str, Any]] = []
|
|
651
523
|
|
|
652
|
-
@classmethod
|
|
653
|
-
def _from_zarr(
|
|
654
|
-
cls,
|
|
655
|
-
zarr_path,
|
|
656
|
-
group_name,
|
|
657
|
-
metadata,
|
|
658
|
-
description,
|
|
659
|
-
info_dict,
|
|
660
|
-
targets_from="metadata",
|
|
661
|
-
last_target_only=True,
|
|
662
|
-
transform=None,
|
|
663
|
-
):
|
|
664
|
-
"""Create a lazy Zarr-backed EEGWindowsDataset (internal API)."""
|
|
665
|
-
obj = cls._init_zarr_base(
|
|
666
|
-
zarr_path, group_name, description, info_dict, transform
|
|
667
|
-
)
|
|
668
|
-
obj._raw = None
|
|
669
|
-
obj.metadata = metadata
|
|
670
|
-
obj.last_target_only = last_target_only
|
|
671
|
-
if targets_from not in ("metadata", "channels"):
|
|
672
|
-
raise ValueError("Wrong value for parameter `targets_from`.")
|
|
673
|
-
obj.targets_from = targets_from
|
|
674
|
-
obj.crop_inds = metadata.loc[
|
|
675
|
-
:, ["i_window_in_trial", "i_start_in_trial", "i_stop_in_trial"]
|
|
676
|
-
].to_numpy()
|
|
677
|
-
if obj.targets_from == "metadata":
|
|
678
|
-
obj.y = metadata.loc[:, "target"].to_list()
|
|
679
|
-
obj.raw_preproc_kwargs = []
|
|
680
|
-
obj._open_zarr()
|
|
681
|
-
return obj
|
|
682
|
-
|
|
683
|
-
@property
|
|
684
|
-
def raw(self):
|
|
685
|
-
if self._raw is None and self._zarr_data is not None:
|
|
686
|
-
self._raw = mne.io.RawArray(self._zarr_data, self._make_mne_info())
|
|
687
|
-
return self._raw
|
|
688
|
-
|
|
689
|
-
@raw.setter
|
|
690
|
-
def raw(self, value):
|
|
691
|
-
self._raw = value
|
|
692
|
-
|
|
693
524
|
def __getitem__(self, index: int):
|
|
694
525
|
"""Get a window and its target.
|
|
695
526
|
|
|
@@ -713,13 +544,11 @@ class EEGWindowsDataset(_ZarrMixin, RecordDataset):
|
|
|
713
544
|
crop_inds = self.crop_inds[index].tolist()
|
|
714
545
|
|
|
715
546
|
i_window_in_trial, i_start, i_stop = crop_inds
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
)
|
|
722
|
-
X = np.array(X, dtype="float32")
|
|
547
|
+
X = self.raw._getitem((slice(None), slice(i_start, i_stop)), return_times=False)
|
|
548
|
+
X = X.astype("float32")
|
|
549
|
+
# ensure we don't give the user the option
|
|
550
|
+
# to accidentally modify the underlying array
|
|
551
|
+
X = X.copy()
|
|
723
552
|
if self.transform is not None:
|
|
724
553
|
X = self.transform(X)
|
|
725
554
|
if self.targets_from == "metadata":
|
|
@@ -730,7 +559,10 @@ class EEGWindowsDataset(_ZarrMixin, RecordDataset):
|
|
|
730
559
|
y = X[misc_mask, -1]
|
|
731
560
|
else:
|
|
732
561
|
y = X[misc_mask, :]
|
|
562
|
+
# ensure we don't give the user the option
|
|
563
|
+
# to accidentally modify the underlying array
|
|
733
564
|
y = y.copy()
|
|
565
|
+
# remove the target channels from raw
|
|
734
566
|
X = X[~misc_mask, :]
|
|
735
567
|
return X, y, crop_inds
|
|
736
568
|
|
|
@@ -738,11 +570,10 @@ class EEGWindowsDataset(_ZarrMixin, RecordDataset):
|
|
|
738
570
|
return len(self.crop_inds)
|
|
739
571
|
|
|
740
572
|
def _build_repr(self):
|
|
741
|
-
mne_obj = self._raw if self._raw is not None else self._make_mne_info()
|
|
742
573
|
return _build_windowed_repr(
|
|
743
574
|
type(self).__name__,
|
|
744
575
|
len(self),
|
|
745
|
-
|
|
576
|
+
self.raw,
|
|
746
577
|
self.crop_inds,
|
|
747
578
|
self.description,
|
|
748
579
|
self.metadata,
|
|
@@ -833,7 +664,7 @@ class EEGWindowsDataset(_ZarrMixin, RecordDataset):
|
|
|
833
664
|
|
|
834
665
|
|
|
835
666
|
@register_dataset
|
|
836
|
-
class WindowsDataset(
|
|
667
|
+
class WindowsDataset(RecordDataset):
|
|
837
668
|
"""Returns windows from an mne.Epochs object along with a target.
|
|
838
669
|
|
|
839
670
|
Dataset which serves windows from an mne.Epochs object along with their
|
|
@@ -886,7 +717,6 @@ class WindowsDataset(_ZarrMixin, RecordDataset):
|
|
|
886
717
|
|
|
887
718
|
metadata = self.windows.metadata
|
|
888
719
|
assert metadata is not None, "WindowsDataset requires windows with metadata."
|
|
889
|
-
self.metadata = metadata
|
|
890
720
|
self.crop_inds = metadata.loc[
|
|
891
721
|
:, ["i_window_in_trial", "i_start_in_trial", "i_stop_in_trial"]
|
|
892
722
|
].to_numpy()
|
|
@@ -895,67 +725,6 @@ class WindowsDataset(_ZarrMixin, RecordDataset):
|
|
|
895
725
|
self.raw_preproc_kwargs: list[dict[str, Any]] = []
|
|
896
726
|
self.window_preproc_kwargs: list[dict[str, Any]] = []
|
|
897
727
|
|
|
898
|
-
@classmethod
|
|
899
|
-
def _from_zarr(
|
|
900
|
-
cls,
|
|
901
|
-
zarr_path,
|
|
902
|
-
group_name,
|
|
903
|
-
metadata,
|
|
904
|
-
description,
|
|
905
|
-
info_dict,
|
|
906
|
-
target_name=None,
|
|
907
|
-
transform=None,
|
|
908
|
-
targets_from="metadata",
|
|
909
|
-
last_target_only=True,
|
|
910
|
-
):
|
|
911
|
-
"""Create a lazy Zarr-backed WindowsDataset (internal API)."""
|
|
912
|
-
obj = cls._init_zarr_base(
|
|
913
|
-
zarr_path, group_name, description, info_dict, transform
|
|
914
|
-
)
|
|
915
|
-
obj._windows = None
|
|
916
|
-
obj.target_name = target_name
|
|
917
|
-
obj._fast_disk = False
|
|
918
|
-
obj.last_target_only = last_target_only
|
|
919
|
-
if targets_from not in ("metadata", "channels"):
|
|
920
|
-
raise ValueError("Wrong value for parameter `targets_from`.")
|
|
921
|
-
obj.targets_from = targets_from
|
|
922
|
-
obj.metadata = metadata
|
|
923
|
-
obj.crop_inds = metadata.loc[
|
|
924
|
-
:, ["i_window_in_trial", "i_start_in_trial", "i_stop_in_trial"]
|
|
925
|
-
].to_numpy()
|
|
926
|
-
if obj.targets_from == "metadata":
|
|
927
|
-
obj.y = metadata.loc[:, "target"].to_list()
|
|
928
|
-
obj.raw_preproc_kwargs = []
|
|
929
|
-
obj.window_preproc_kwargs = []
|
|
930
|
-
obj._open_zarr()
|
|
931
|
-
return obj
|
|
932
|
-
|
|
933
|
-
@property
|
|
934
|
-
def windows(self):
|
|
935
|
-
if self._windows is None and self._zarr_data is not None:
|
|
936
|
-
info = self._make_mne_info()
|
|
937
|
-
targets = self.metadata["target"].values
|
|
938
|
-
event_ids = (
|
|
939
|
-
targets
|
|
940
|
-
if np.issubdtype(targets.dtype, np.integer)
|
|
941
|
-
else np.ones(len(self.metadata), dtype=int)
|
|
942
|
-
)
|
|
943
|
-
events = np.column_stack(
|
|
944
|
-
[
|
|
945
|
-
self.metadata["i_start_in_trial"].values.astype(int),
|
|
946
|
-
np.zeros(len(self.metadata), dtype=int),
|
|
947
|
-
event_ids,
|
|
948
|
-
]
|
|
949
|
-
)
|
|
950
|
-
self._windows = mne.EpochsArray(
|
|
951
|
-
self._zarr_data, info, events=events, metadata=self.metadata
|
|
952
|
-
)
|
|
953
|
-
return self._windows
|
|
954
|
-
|
|
955
|
-
@windows.setter
|
|
956
|
-
def windows(self, value):
|
|
957
|
-
self._windows = value
|
|
958
|
-
|
|
959
728
|
@staticmethod
|
|
960
729
|
def _can_use_fast_get_epoch_from_raw(epochs: mne.BaseEpochs) -> bool:
|
|
961
730
|
"""Check if we can use the fast _get_epoch_from_raw method,
|
|
@@ -987,9 +756,7 @@ class WindowsDataset(_ZarrMixin, RecordDataset):
|
|
|
987
756
|
np.ndarray
|
|
988
757
|
Crop indices.
|
|
989
758
|
"""
|
|
990
|
-
if self.
|
|
991
|
-
X = self._zarr_data[index].astype("float32")
|
|
992
|
-
elif self._fast_disk:
|
|
759
|
+
if self._fast_disk:
|
|
993
760
|
X = self.windows._get_epoch_from_raw(index).astype("float32")
|
|
994
761
|
else:
|
|
995
762
|
X = self.windows.get_data(item=index)[0].astype("float32")
|
|
@@ -1003,6 +770,7 @@ class WindowsDataset(_ZarrMixin, RecordDataset):
|
|
|
1003
770
|
y = X[misc_mask, -1]
|
|
1004
771
|
else:
|
|
1005
772
|
y = X[misc_mask, :]
|
|
773
|
+
# remove the target channels from raw
|
|
1006
774
|
X = X[~misc_mask, :]
|
|
1007
775
|
# necessary to cast as list to get list of three tensors from batch,
|
|
1008
776
|
# otherwise get single 2d-tensor...
|
|
@@ -1010,20 +778,16 @@ class WindowsDataset(_ZarrMixin, RecordDataset):
|
|
|
1010
778
|
return X, y, crop_inds
|
|
1011
779
|
|
|
1012
780
|
def __len__(self) -> int:
|
|
1013
|
-
|
|
1014
|
-
return len(self._windows.events)
|
|
1015
|
-
return len(self.crop_inds)
|
|
781
|
+
return len(self.windows.events)
|
|
1016
782
|
|
|
1017
783
|
def _build_repr(self):
|
|
1018
|
-
mne_obj = self._windows if self._windows is not None else self._make_mne_info()
|
|
1019
|
-
md = self._windows.metadata if self._windows is not None else self.metadata
|
|
1020
784
|
return _build_windowed_repr(
|
|
1021
785
|
type(self).__name__,
|
|
1022
786
|
len(self),
|
|
1023
|
-
|
|
787
|
+
self.windows,
|
|
1024
788
|
self.crop_inds,
|
|
1025
789
|
self.description,
|
|
1026
|
-
|
|
790
|
+
self.windows.metadata,
|
|
1027
791
|
)
|
|
1028
792
|
|
|
1029
793
|
|
|
@@ -1250,8 +1014,8 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1250
1014
|
|
|
1251
1015
|
all_dfs = list()
|
|
1252
1016
|
for ds in self.datasets:
|
|
1253
|
-
if hasattr(ds, "
|
|
1254
|
-
df = ds.
|
|
1017
|
+
if hasattr(ds, "windows"):
|
|
1018
|
+
df = ds.windows.metadata
|
|
1255
1019
|
else:
|
|
1256
1020
|
df = ds.metadata
|
|
1257
1021
|
for k, v in ds.description.items():
|
{braindecode-1.3.2.dev170805792 → braindecode-1.3.2.dev171423126}/braindecode/datasets/bids/hub.py
RENAMED
|
@@ -39,6 +39,7 @@ import mne
|
|
|
39
39
|
import numpy as np
|
|
40
40
|
import pandas as pd
|
|
41
41
|
import scipy
|
|
42
|
+
from mne._fiff.meas_info import Info
|
|
42
43
|
from mne.utils import _soft_import
|
|
43
44
|
|
|
44
45
|
if TYPE_CHECKING:
|
|
@@ -732,6 +733,7 @@ class HubDatasetMixin:
|
|
|
732
733
|
info_dict,
|
|
733
734
|
compressor,
|
|
734
735
|
target_name,
|
|
736
|
+
chunk_size,
|
|
735
737
|
)
|
|
736
738
|
|
|
737
739
|
elif dataset_type == "EEGWindowsDataset":
|
|
@@ -834,7 +836,6 @@ class HubDatasetMixin:
|
|
|
834
836
|
datasets = []
|
|
835
837
|
for i_ds in range(n_datasets):
|
|
836
838
|
grp = root[f"recording_{i_ds}"]
|
|
837
|
-
group_name = f"recording_{i_ds}"
|
|
838
839
|
|
|
839
840
|
if dataset_type == "WindowsDataset":
|
|
840
841
|
# Load using inlined function
|
|
@@ -842,36 +843,24 @@ class HubDatasetMixin:
|
|
|
842
843
|
_load_windows_from_zarr(grp, preload)
|
|
843
844
|
)
|
|
844
845
|
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
event_ids = targets
|
|
851
|
-
else:
|
|
852
|
-
event_ids = np.ones(len(metadata), dtype=int)
|
|
853
|
-
events = np.column_stack(
|
|
854
|
-
[
|
|
855
|
-
metadata["i_start_in_trial"].values.astype(int),
|
|
856
|
-
np.zeros(len(metadata), dtype=int),
|
|
857
|
-
event_ids,
|
|
858
|
-
]
|
|
859
|
-
)
|
|
860
|
-
epochs = mne.EpochsArray(
|
|
861
|
-
data, info, events=events, metadata=metadata
|
|
862
|
-
)
|
|
863
|
-
ds = WindowsDataset(epochs, description)
|
|
864
|
-
if target_name is not None:
|
|
865
|
-
ds.target_name = target_name
|
|
846
|
+
# Convert to MNE objects and create dataset
|
|
847
|
+
info = Info.from_json_dict(info_dict)
|
|
848
|
+
targets = metadata["target"].values
|
|
849
|
+
if np.issubdtype(targets.dtype, np.integer):
|
|
850
|
+
event_ids = targets
|
|
866
851
|
else:
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
metadata
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
852
|
+
event_ids = np.ones(len(metadata), dtype=int)
|
|
853
|
+
events = np.column_stack(
|
|
854
|
+
[
|
|
855
|
+
metadata["i_start_in_trial"].values.astype(int),
|
|
856
|
+
np.zeros(len(metadata), dtype=int),
|
|
857
|
+
event_ids,
|
|
858
|
+
]
|
|
859
|
+
)
|
|
860
|
+
epochs = mne.EpochsArray(data, info, events=events, metadata=metadata)
|
|
861
|
+
ds = WindowsDataset(epochs, description)
|
|
862
|
+
if target_name is not None:
|
|
863
|
+
ds.target_name = target_name
|
|
875
864
|
|
|
876
865
|
elif dataset_type == "EEGWindowsDataset":
|
|
877
866
|
# Load using inlined function
|
|
@@ -884,28 +873,17 @@ class HubDatasetMixin:
|
|
|
884
873
|
last_target_only,
|
|
885
874
|
) = _load_eegwindows_from_zarr(grp, preload)
|
|
886
875
|
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
)
|
|
899
|
-
else:
|
|
900
|
-
ds = EEGWindowsDataset._from_zarr(
|
|
901
|
-
zarr_path=input_path,
|
|
902
|
-
group_name=group_name,
|
|
903
|
-
metadata=metadata,
|
|
904
|
-
description=description,
|
|
905
|
-
info_dict=info_dict,
|
|
906
|
-
targets_from=targets_from,
|
|
907
|
-
last_target_only=last_target_only,
|
|
908
|
-
)
|
|
876
|
+
# Convert to MNE objects and create dataset
|
|
877
|
+
# Data is already in continuous format [n_channels, n_timepoints]
|
|
878
|
+
info = Info.from_json_dict(info_dict)
|
|
879
|
+
raw = mne.io.RawArray(data, info)
|
|
880
|
+
ds = EEGWindowsDataset(
|
|
881
|
+
raw=raw,
|
|
882
|
+
metadata=metadata,
|
|
883
|
+
description=description,
|
|
884
|
+
targets_from=targets_from,
|
|
885
|
+
last_target_only=last_target_only,
|
|
886
|
+
)
|
|
909
887
|
|
|
910
888
|
elif dataset_type == "RawDataset":
|
|
911
889
|
# Load using inlined function
|
|
@@ -913,22 +891,13 @@ class HubDatasetMixin:
|
|
|
913
891
|
grp, preload
|
|
914
892
|
)
|
|
915
893
|
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
ds.target_name = target_name
|
|
924
|
-
else:
|
|
925
|
-
ds = RawDataset._from_zarr(
|
|
926
|
-
zarr_path=input_path,
|
|
927
|
-
group_name=group_name,
|
|
928
|
-
description=description,
|
|
929
|
-
info_dict=info_dict,
|
|
930
|
-
target_name=target_name,
|
|
931
|
-
)
|
|
894
|
+
# Convert to MNE objects and create dataset
|
|
895
|
+
# Data is in continuous format [n_channels, n_timepoints]
|
|
896
|
+
info = Info.from_json_dict(info_dict)
|
|
897
|
+
raw = mne.io.RawArray(data, info)
|
|
898
|
+
ds = RawDataset(raw, description)
|
|
899
|
+
if target_name is not None:
|
|
900
|
+
ds.target_name = target_name
|
|
932
901
|
|
|
933
902
|
else:
|
|
934
903
|
raise ValueError(f"Unsupported dataset_type: {dataset_type}")
|