Braindecode 1.8.0.dev1058__tar.gz → 1.8.0.dev1122__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.8.0.dev1058/braindecode.egg-info → braindecode-1.8.0.dev1122}/PKG-INFO +1 -1
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datasets/bids/hub.py +25 -90
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datasets/bids/hub_io.py +5 -67
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/base.py +1 -40
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/preprocessing/windowers.py +27 -100
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/samplers/base.py +2 -40
- braindecode-1.8.0.dev1122/braindecode/version.py +1 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122/braindecode.egg-info}/PKG-INFO +1 -1
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/whats_new.rst +1 -46
- braindecode-1.8.0.dev1058/braindecode/version.py +0 -1
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/LICENSE.txt +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/MANIFEST.in +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/NOTICE.txt +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/README.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/__init__.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/augmentation/__init__.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/augmentation/base.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/augmentation/functional.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/augmentation/transforms.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/classifier.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datasets/__init__.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datasets/base.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datasets/bbci.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datasets/bcicomp.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datasets/bids/__init__.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datasets/bids/datasets.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datasets/bids/format.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datasets/bids/hub_format.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datasets/bids/hub_validation.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datasets/bids/iterable.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datasets/chb_mit.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datasets/collate.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datasets/mne.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datasets/moabb.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datasets/nmt.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datasets/registry.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datasets/siena.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datasets/sleep_physio_challe_18.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datasets/sleep_physionet.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datasets/tuh.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datasets/utils.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datasets/xy.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datautil/__init__.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datautil/channel_utils.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datautil/hub_formats.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datautil/serialization.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/datautil/util.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/eegneuralnet.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/functional/__init__.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/functional/functions.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/functional/initialization.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/__init__.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/atcnet.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/attentionbasenet.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/attn_sleep.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/bendr.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/biot.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/brainmodule.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/cbramod.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/codebrain.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/config.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/contrawr.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/ctnet.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/dance.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/deep4.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/deepsleepnet.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/dgcnn.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/eegconformer.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/eegdino.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/eeginception_erp.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/eeginception_mi.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/eegitnet.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/eegminer.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/eegnet.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/eegnex.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/eegpt.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/eegsimpleconv.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/eegsym.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/eegtcnet.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/emg2qwerty.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/fbcnet.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/fblightconvnet.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/fbmsnet.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/hybrid.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/ifnet.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/interpolated.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/labram.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/luna.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/medformer.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/meta_neuromotor.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/msvtnet.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/mvpformer.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/patchedtransformer.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/reve.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/sccnet.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/shallow_fbcsp.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/signal_jepa.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/sinc_shallow.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/sleep_stager_blanco_2020.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/sleep_stager_chambon_2018.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/sparcnet.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/sstdpn.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/steegformer.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/summary.csv +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/syncnet.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/tcformer.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/tcn.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/tidnet.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/tsinception.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/usleep.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/util.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/models/zuna.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/modules/__init__.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/modules/activation.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/modules/attention.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/modules/blocks.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/modules/convolution.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/modules/dance_modules.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/modules/filter.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/modules/interpolation.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/modules/layers.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/modules/linear.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/modules/parametrization.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/modules/stats.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/modules/util.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/modules/wrapper.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/preprocessing/__init__.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/preprocessing/eegprep_preprocess.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/preprocessing/mne_preprocess.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/preprocessing/preprocess.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/preprocessing/util.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/regressor.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/samplers/__init__.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/samplers/ssl.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/training/__init__.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/training/callbacks.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/training/losses.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/training/scoring.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/util.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/visualization/__init__.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/visualization/attribution.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/visualization/confusion_matrices.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/visualization/frequency.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/visualization/metrics.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/visualization/sanity.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/visualization/topology.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode.egg-info/SOURCES.txt +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode.egg-info/dependency_links.txt +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode.egg-info/requires.txt +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode.egg-info/top_level.txt +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/Makefile +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/_templates/autosummary/class.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/_templates/autosummary/class_in_subdir.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/_templates/autosummary/function.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/_templates/autosummary/function_in_subdir.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/api.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/cite.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/conf.py +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/help.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/index.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/install/install.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/install/install_pip.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/install/install_source.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/models/categorization/attention.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/models/categorization/channel.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/models/categorization/convolution.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/models/categorization/filterbank.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/models/categorization/gnn.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/models/categorization/interpretable.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/models/categorization/lbm.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/models/categorization/recurrent.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/models/categorization/spd.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/models/models.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/models/models_categorization.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/models/models_table.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/models/models_visualization.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/docs/sg_execution_times.rst +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/pyproject.toml +0 -0
- {braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: braindecode
|
|
3
|
-
Version: 1.8.0.
|
|
3
|
+
Version: 1.8.0.dev1122
|
|
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>
|
|
@@ -28,7 +28,6 @@ The format follows a BIDS-inspired sourcedata structure:
|
|
|
28
28
|
# License: BSD (3-clause)
|
|
29
29
|
|
|
30
30
|
import contextlib
|
|
31
|
-
import copy
|
|
32
31
|
import json
|
|
33
32
|
import logging
|
|
34
33
|
import tempfile
|
|
@@ -57,7 +56,6 @@ from .hub_io import (
|
|
|
57
56
|
_load_eegwindows_from_zarr,
|
|
58
57
|
_load_raw_from_zarr,
|
|
59
58
|
_load_windows_from_zarr,
|
|
60
|
-
_prepare_info_for_json,
|
|
61
59
|
_save_eegwindows_to_zarr,
|
|
62
60
|
_save_raw_to_zarr,
|
|
63
61
|
_save_windows_to_zarr,
|
|
@@ -74,33 +72,6 @@ log = logging.getLogger(__name__)
|
|
|
74
72
|
_LOCK_FILE = "format_info.json"
|
|
75
73
|
|
|
76
74
|
|
|
77
|
-
def _normalize_kwargs_for_json(value, field_name):
|
|
78
|
-
"""Return one preprocessing-kwargs value as native strict JSON."""
|
|
79
|
-
|
|
80
|
-
def _convert(obj):
|
|
81
|
-
if isinstance(obj, np.ndarray):
|
|
82
|
-
return _convert(obj.tolist())
|
|
83
|
-
if isinstance(obj, dict):
|
|
84
|
-
return {key: _convert(item) for key, item in obj.items()}
|
|
85
|
-
if isinstance(obj, (list, tuple)):
|
|
86
|
-
return [_convert(item) for item in obj]
|
|
87
|
-
if isinstance(obj, np.generic):
|
|
88
|
-
return _convert(obj.item())
|
|
89
|
-
return obj
|
|
90
|
-
|
|
91
|
-
try:
|
|
92
|
-
converted = _convert(value)
|
|
93
|
-
if isinstance(converted, str):
|
|
94
|
-
raise ValueError(
|
|
95
|
-
"a root string is ambiguous with the legacy encoded format"
|
|
96
|
-
)
|
|
97
|
-
return json.loads(json.dumps(converted, allow_nan=False))
|
|
98
|
-
except (OverflowError, RecursionError, TypeError, ValueError) as error:
|
|
99
|
-
raise ValueError(
|
|
100
|
-
f"{field_name} must contain only finite JSON-serializable values"
|
|
101
|
-
) from error
|
|
102
|
-
|
|
103
|
-
|
|
104
75
|
class HubDatasetMixin:
|
|
105
76
|
"""
|
|
106
77
|
Mixin class for Hugging Face Hub integration with EEG datasets.
|
|
@@ -714,57 +685,14 @@ class HubDatasetMixin:
|
|
|
714
685
|
f"{output_path} already exists. Set overwrite=True to replace it."
|
|
715
686
|
)
|
|
716
687
|
|
|
688
|
+
# Create zarr store (zarr v3 API)
|
|
689
|
+
root = zarr.open(str(output_path), mode="w")
|
|
690
|
+
|
|
717
691
|
# Validate uniformity across all datasets using shared validation
|
|
718
692
|
dataset_type, _, _ = hub_validation.validate_dataset_uniformity(self.datasets)
|
|
719
693
|
|
|
720
|
-
#
|
|
721
|
-
|
|
722
|
-
prepared_infos = []
|
|
723
|
-
for ds in self.datasets:
|
|
724
|
-
if dataset_type == "WindowsDataset":
|
|
725
|
-
info = ds.windows.info
|
|
726
|
-
elif dataset_type in ("EEGWindowsDataset", "RawDataset"):
|
|
727
|
-
info = ds.raw.info
|
|
728
|
-
prepared_infos.append(_prepare_info_for_json(info.to_json_dict()))
|
|
729
|
-
|
|
730
|
-
prepared_kwargs = {}
|
|
731
|
-
for kwarg_name in [
|
|
732
|
-
"raw_preproc_kwargs",
|
|
733
|
-
"window_kwargs",
|
|
734
|
-
"window_preproc_kwargs",
|
|
735
|
-
]:
|
|
736
|
-
expected_present = hasattr(self.datasets[0], kwarg_name)
|
|
737
|
-
expected_value = None
|
|
738
|
-
expected_token = None
|
|
739
|
-
for i_ds, ds in enumerate(self.datasets):
|
|
740
|
-
present = hasattr(ds, kwarg_name)
|
|
741
|
-
if present != expected_present:
|
|
742
|
-
raise ValueError(
|
|
743
|
-
f"{kwarg_name} on dataset {i_ds} has inconsistent presence; "
|
|
744
|
-
"the Zarr format stores one global value"
|
|
745
|
-
)
|
|
746
|
-
if not present:
|
|
747
|
-
continue
|
|
748
|
-
value = _normalize_kwargs_for_json(
|
|
749
|
-
getattr(ds, kwarg_name), f"{kwarg_name} on dataset {i_ds}"
|
|
750
|
-
)
|
|
751
|
-
value_token = json.dumps(
|
|
752
|
-
value, sort_keys=True, separators=(",", ":"), allow_nan=False
|
|
753
|
-
)
|
|
754
|
-
if i_ds == 0:
|
|
755
|
-
expected_value = value
|
|
756
|
-
expected_token = value_token
|
|
757
|
-
elif value_token != expected_token:
|
|
758
|
-
raise ValueError(
|
|
759
|
-
f"{kwarg_name} on dataset {i_ds} differs from dataset 0; "
|
|
760
|
-
"the Zarr format stores one global value"
|
|
761
|
-
)
|
|
762
|
-
if expected_present:
|
|
763
|
-
prepared_kwargs[kwarg_name] = expected_value
|
|
764
|
-
|
|
765
|
-
# Create compressor and zarr store (zarr v3 API) only after preflight.
|
|
766
|
-
compressor = _create_compressor(compression, compression_level)
|
|
767
|
-
root = zarr.open(str(output_path), mode="w")
|
|
694
|
+
# Keep reference to first dataset for preprocessing kwargs
|
|
695
|
+
first_ds = self.datasets[0]
|
|
768
696
|
|
|
769
697
|
# Store global metadata
|
|
770
698
|
root.attrs["n_datasets"] = len(self.datasets)
|
|
@@ -778,10 +706,21 @@ class HubDatasetMixin:
|
|
|
778
706
|
root.attrs["zarr_version"] = zarr.__version__
|
|
779
707
|
root.attrs["scipy_version"] = scipy.__version__
|
|
780
708
|
|
|
781
|
-
# Save preprocessing kwargs
|
|
782
|
-
# typically set by windowing functions on individual datasets
|
|
783
|
-
for kwarg_name
|
|
784
|
-
|
|
709
|
+
# Save preprocessing kwargs (check first dataset, assuming uniform preprocessing)
|
|
710
|
+
# These are typically set by windowing functions on individual datasets
|
|
711
|
+
for kwarg_name in [
|
|
712
|
+
"raw_preproc_kwargs",
|
|
713
|
+
"window_kwargs",
|
|
714
|
+
"window_preproc_kwargs",
|
|
715
|
+
]:
|
|
716
|
+
# Check first dataset for these attributes
|
|
717
|
+
if hasattr(first_ds, kwarg_name):
|
|
718
|
+
kwargs = getattr(first_ds, kwarg_name)
|
|
719
|
+
if kwargs:
|
|
720
|
+
root.attrs[kwarg_name] = json.dumps(kwargs)
|
|
721
|
+
|
|
722
|
+
# Create compressor
|
|
723
|
+
compressor = _create_compressor(compression, compression_level)
|
|
785
724
|
|
|
786
725
|
# Save each recording
|
|
787
726
|
for i_ds, ds in enumerate(self.datasets):
|
|
@@ -792,7 +731,7 @@ class HubDatasetMixin:
|
|
|
792
731
|
data = ds.windows.get_data()
|
|
793
732
|
metadata = ds.windows.metadata
|
|
794
733
|
description = ds.description
|
|
795
|
-
info_dict =
|
|
734
|
+
info_dict = ds.windows.info.to_json_dict()
|
|
796
735
|
target_name = ds.target_name if hasattr(ds, "target_name") else None
|
|
797
736
|
|
|
798
737
|
# Save using inlined function
|
|
@@ -811,7 +750,7 @@ class HubDatasetMixin:
|
|
|
811
750
|
raw = ds.raw
|
|
812
751
|
metadata = ds.metadata
|
|
813
752
|
description = ds.description
|
|
814
|
-
info_dict =
|
|
753
|
+
info_dict = ds.raw.info.to_json_dict()
|
|
815
754
|
targets_from = ds.targets_from
|
|
816
755
|
last_target_only = ds.last_target_only
|
|
817
756
|
|
|
@@ -832,7 +771,7 @@ class HubDatasetMixin:
|
|
|
832
771
|
# Get continuous raw data from RawDataset
|
|
833
772
|
raw = ds.raw
|
|
834
773
|
description = ds.description
|
|
835
|
-
info_dict =
|
|
774
|
+
info_dict = ds.raw.info.to_json_dict()
|
|
836
775
|
target_name = ds.target_name if hasattr(ds, "target_name") else None
|
|
837
776
|
|
|
838
777
|
# Save using inlined function
|
|
@@ -1017,14 +956,10 @@ class HubDatasetMixin:
|
|
|
1017
956
|
"window_preproc_kwargs",
|
|
1018
957
|
]:
|
|
1019
958
|
if kwarg_name in root.attrs:
|
|
1020
|
-
kwargs = root.attrs[kwarg_name]
|
|
1021
|
-
if isinstance(kwargs, str):
|
|
1022
|
-
# Stores written by older braindecode versions kept
|
|
1023
|
-
# these attributes as double-encoded JSON strings.
|
|
1024
|
-
kwargs = json.loads(kwargs)
|
|
959
|
+
kwargs = json.loads(root.attrs[kwarg_name])
|
|
1025
960
|
# Set on each individual dataset (where they were originally stored)
|
|
1026
961
|
for ds in datasets:
|
|
1027
|
-
setattr(ds, kwarg_name,
|
|
962
|
+
setattr(ds, kwarg_name, kwargs)
|
|
1028
963
|
|
|
1029
964
|
return concat_ds
|
|
1030
965
|
|
|
@@ -8,7 +8,6 @@ These functions keep the Zarr serialization details isolated from hub.py.
|
|
|
8
8
|
from __future__ import annotations
|
|
9
9
|
|
|
10
10
|
import json
|
|
11
|
-
from numbers import Real
|
|
12
11
|
from pathlib import Path
|
|
13
12
|
|
|
14
13
|
import numpy as np
|
|
@@ -18,78 +17,17 @@ from mne.utils import _soft_import
|
|
|
18
17
|
zarr = _soft_import("zarr", purpose="hugging face integration", strict=False)
|
|
19
18
|
|
|
20
19
|
|
|
21
|
-
def _is_non_bool_real(value):
|
|
22
|
-
return not isinstance(value, (bool, np.bool_)) and isinstance(
|
|
23
|
-
value, (Real, np.integer, np.floating)
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def _prepare_info_for_json(obj, path="info", *, _in_numeric_sequence=False):
|
|
28
|
-
"""Normalize an MNE Info value to strict JSON without losing sequence NaNs."""
|
|
29
|
-
if isinstance(obj, np.ndarray):
|
|
30
|
-
obj = obj.tolist()
|
|
31
|
-
|
|
32
|
-
if isinstance(obj, dict):
|
|
33
|
-
return {
|
|
34
|
-
key: _prepare_info_for_json(value, f"{path}.{key}")
|
|
35
|
-
for key, value in obj.items()
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if isinstance(obj, (list, tuple)):
|
|
39
|
-
values = list(obj)
|
|
40
|
-
has_none = any(value is None for value in values)
|
|
41
|
-
has_number = any(_is_non_bool_real(value) for value in values)
|
|
42
|
-
all_none = bool(values) and all(value is None for value in values)
|
|
43
|
-
if all_none or (has_none and has_number):
|
|
44
|
-
raise ValueError(
|
|
45
|
-
f"{path} is ambiguous: numeric sequences cannot contain JSON null"
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
is_numeric_sequence = bool(values) and all(
|
|
49
|
-
_is_non_bool_real(value) for value in values
|
|
50
|
-
)
|
|
51
|
-
return [
|
|
52
|
-
_prepare_info_for_json(
|
|
53
|
-
value,
|
|
54
|
-
f"{path}[{index}]",
|
|
55
|
-
_in_numeric_sequence=is_numeric_sequence,
|
|
56
|
-
)
|
|
57
|
-
for index, value in enumerate(values)
|
|
58
|
-
]
|
|
59
|
-
|
|
60
|
-
if isinstance(obj, (bool, np.bool_)):
|
|
61
|
-
return bool(obj)
|
|
62
|
-
if isinstance(obj, (int, np.integer)):
|
|
63
|
-
return int(obj)
|
|
64
|
-
if _is_non_bool_real(obj):
|
|
65
|
-
value = float(obj)
|
|
66
|
-
if np.isnan(value):
|
|
67
|
-
if _in_numeric_sequence:
|
|
68
|
-
return None
|
|
69
|
-
raise ValueError(f"{path} contains unsupported NaN")
|
|
70
|
-
if np.isposinf(value):
|
|
71
|
-
raise ValueError(f"{path} contains positive infinity")
|
|
72
|
-
if np.isneginf(value):
|
|
73
|
-
raise ValueError(f"{path} contains negative infinity")
|
|
74
|
-
return value
|
|
75
|
-
if obj is None or isinstance(obj, str):
|
|
76
|
-
return obj
|
|
77
|
-
raise ValueError(f"{path} contains a non-JSON-serializable value")
|
|
78
|
-
|
|
79
|
-
|
|
80
20
|
def _restore_nan_from_json(obj):
|
|
81
|
-
"""Restore NaN values from None in
|
|
21
|
+
"""Restore NaN values from None in legacy zarr stores.
|
|
82
22
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
23
|
+
Datasets saved before zarr v3 native NaN support used
|
|
24
|
+
``_sanitize_for_json`` to convert NaN/Inf → None. This restores them
|
|
25
|
+
on load so ``mne.Info.from_json_dict`` gets proper NaN arrays.
|
|
86
26
|
"""
|
|
87
27
|
if isinstance(obj, dict):
|
|
88
28
|
return {k: _restore_nan_from_json(v) for k, v in obj.items()}
|
|
89
29
|
if isinstance(obj, list):
|
|
90
|
-
if len(obj) > 0 and all(
|
|
91
|
-
value is None or _is_non_bool_real(value) for value in obj
|
|
92
|
-
):
|
|
30
|
+
if len(obj) > 0 and all(isinstance(x, (int, float, type(None))) for x in obj):
|
|
93
31
|
return [np.nan if x is None else x for x in obj]
|
|
94
32
|
return [_restore_nan_from_json(v) for v in obj]
|
|
95
33
|
return obj
|
|
@@ -198,34 +198,7 @@ class EEGModuleMixin(_BaseHubMixin, metaclass=_BraindecodeDocstringMeta):
|
|
|
198
198
|
See :ref:`load-pretrained-models` for a complete tutorial.
|
|
199
199
|
"""
|
|
200
200
|
|
|
201
|
-
#: Attributes that :func:`torch.jit.script` must not introspect. The
|
|
202
|
-
#: signal-related properties raise :class:`ValueError` when their value was
|
|
203
|
-
#: neither given nor inferable, and ``mapping`` carries a postponed
|
|
204
|
-
#: annotation TorchScript cannot resolve. Either one aborts scripting
|
|
205
|
-
#: before ``forward`` is ever compiled.
|
|
206
|
-
__jit_ignored_attributes__ = [
|
|
207
|
-
*sorted(_EEG_PARAMS),
|
|
208
|
-
"_chs_info",
|
|
209
|
-
"input_shape",
|
|
210
|
-
"mapping",
|
|
211
|
-
]
|
|
212
|
-
#: Rich MNE channel dictionaries are intentionally unavailable in scripted
|
|
213
|
-
#: forwards; they remain unchanged on eager models and in saved configs.
|
|
214
|
-
__jit_unused_properties__ = ["chs_info"]
|
|
215
|
-
|
|
216
201
|
def __init_subclass__(cls, **kwargs):
|
|
217
|
-
# TorchScript only honours ``__jit_ignored_attributes__`` for
|
|
218
|
-
# properties defined directly on the concrete class: it collects them
|
|
219
|
-
# with ``vars(type(module))``, which skips inherited ones. Rebinding
|
|
220
|
-
# the very same property objects on each subclass makes them visible
|
|
221
|
-
# there without changing any runtime behaviour.
|
|
222
|
-
for name in cls.__jit_ignored_attributes__:
|
|
223
|
-
if name in cls.__dict__:
|
|
224
|
-
continue
|
|
225
|
-
prop = getattr(cls, name, None)
|
|
226
|
-
if isinstance(prop, property):
|
|
227
|
-
setattr(cls, name, prop)
|
|
228
|
-
|
|
229
202
|
# Append model-specific Hub integration notes to the docstring.
|
|
230
203
|
# This runs before the metaclass __init__, so the Hub notes will
|
|
231
204
|
# be included in the docstring that the metaclass processes.
|
|
@@ -313,12 +286,6 @@ class EEGModuleMixin(_BaseHubMixin, metaclass=_BraindecodeDocstringMeta):
|
|
|
313
286
|
self._chs_info = chs_info # type: ignore[assignment]
|
|
314
287
|
self._n_outputs = n_outputs # type: ignore[assignment]
|
|
315
288
|
self._n_chans = n_chans # type: ignore[assignment]
|
|
316
|
-
# TorchScript cannot represent the rich MNE dictionaries in _chs_info.
|
|
317
|
-
# Keep the original eager state above and expose only the derived scalar
|
|
318
|
-
# to scripted signal-property getters.
|
|
319
|
-
self._n_chans_for_jit = (
|
|
320
|
-
len(chs_info) if n_chans is None and chs_info is not None else n_chans
|
|
321
|
-
)
|
|
322
289
|
self._n_times = n_times # type: ignore[assignment]
|
|
323
290
|
self._sfreq = sfreq # type: ignore[assignment]
|
|
324
291
|
|
|
@@ -343,12 +310,6 @@ class EEGModuleMixin(_BaseHubMixin, metaclass=_BraindecodeDocstringMeta):
|
|
|
343
310
|
|
|
344
311
|
@property
|
|
345
312
|
def n_chans(self) -> int:
|
|
346
|
-
if torch.jit.is_scripting():
|
|
347
|
-
if self._n_chans_for_jit is None:
|
|
348
|
-
raise ValueError(
|
|
349
|
-
"n_chans could not be inferred. Either specify n_chans or chs_info."
|
|
350
|
-
)
|
|
351
|
-
return self._n_chans_for_jit
|
|
352
313
|
if self._n_chans is None and self._chs_info is not None:
|
|
353
314
|
return len(self._chs_info)
|
|
354
315
|
elif self._n_chans is None:
|
|
@@ -358,7 +319,7 @@ class EEGModuleMixin(_BaseHubMixin, metaclass=_BraindecodeDocstringMeta):
|
|
|
358
319
|
return self._n_chans
|
|
359
320
|
|
|
360
321
|
@property
|
|
361
|
-
def chs_info(self) -> list[
|
|
322
|
+
def chs_info(self) -> list[str]:
|
|
362
323
|
if self._chs_info is None:
|
|
363
324
|
raise ValueError("chs_info not specified.")
|
|
364
325
|
return self._chs_info
|
{braindecode-1.8.0.dev1058 → braindecode-1.8.0.dev1122}/braindecode/preprocessing/windowers.py
RENAMED
|
@@ -194,43 +194,6 @@ def _get_use_mne_epochs(use_mne_epochs, reject, picks, flat, drop_bad_windows):
|
|
|
194
194
|
return use_mne_epochs
|
|
195
195
|
|
|
196
196
|
|
|
197
|
-
_LastWindowStrategy = Literal["overlap", "drop"]
|
|
198
|
-
_VALID_LAST_WINDOW_STRATEGIES = ("overlap", "drop")
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
def _resolve_on_last_window(
|
|
202
|
-
drop_last_window: bool | None,
|
|
203
|
-
on_last_window: _LastWindowStrategy | None,
|
|
204
|
-
*,
|
|
205
|
-
default: _LastWindowStrategy | None,
|
|
206
|
-
) -> _LastWindowStrategy | None:
|
|
207
|
-
"""Resolve the replacement spelling without changing placement semantics."""
|
|
208
|
-
if drop_last_window is not None and on_last_window is not None:
|
|
209
|
-
raise ValueError(
|
|
210
|
-
"Cannot specify both `drop_last_window` and `on_last_window`. "
|
|
211
|
-
"Use `on_last_window` only, as `drop_last_window` is deprecated."
|
|
212
|
-
)
|
|
213
|
-
if (
|
|
214
|
-
on_last_window is not None
|
|
215
|
-
and on_last_window not in _VALID_LAST_WINDOW_STRATEGIES
|
|
216
|
-
):
|
|
217
|
-
raise ValueError(
|
|
218
|
-
"on_last_window must be one of 'overlap' or 'drop', "
|
|
219
|
-
f"got {on_last_window!r}."
|
|
220
|
-
)
|
|
221
|
-
if drop_last_window is not None:
|
|
222
|
-
warnings.warn(
|
|
223
|
-
"`drop_last_window` is deprecated and will be removed in version 2.0. "
|
|
224
|
-
"Use `on_last_window='drop'` if True or "
|
|
225
|
-
"`on_last_window='overlap'` if False. "
|
|
226
|
-
"See https://github.com/braindecode/braindecode/pull/1058 for feedback.",
|
|
227
|
-
DeprecationWarning,
|
|
228
|
-
stacklevel=3,
|
|
229
|
-
)
|
|
230
|
-
return "drop" if drop_last_window else "overlap"
|
|
231
|
-
return default if on_last_window is None else on_last_window
|
|
232
|
-
|
|
233
|
-
|
|
234
197
|
# XXX it's called concat_ds...
|
|
235
198
|
def create_windows_from_events(
|
|
236
199
|
concat_ds: BaseConcatDataset[RawDataset],
|
|
@@ -238,7 +201,7 @@ def create_windows_from_events(
|
|
|
238
201
|
trial_stop_offset_samples: int | dict[str, int] = 0,
|
|
239
202
|
window_size_samples: int | None = None,
|
|
240
203
|
window_stride_samples: int | dict[str, int] | None = None,
|
|
241
|
-
drop_last_window: bool
|
|
204
|
+
drop_last_window: bool = False,
|
|
242
205
|
mapping: dict[str, int] | None = None,
|
|
243
206
|
preload: bool = False,
|
|
244
207
|
drop_bad_windows: bool | None = None,
|
|
@@ -251,8 +214,6 @@ def create_windows_from_events(
|
|
|
251
214
|
on_overlapping_events: Literal["raise", "warn", "ignore"] = "raise",
|
|
252
215
|
n_jobs: int = 1,
|
|
253
216
|
verbose: bool | str | int | None = "error",
|
|
254
|
-
*,
|
|
255
|
-
on_last_window: _LastWindowStrategy | None = None,
|
|
256
217
|
) -> BaseConcatDataset[WindowsDataset | EEGWindowsDataset]:
|
|
257
218
|
"""Create windows based on events in mne.Raw.
|
|
258
219
|
|
|
@@ -295,11 +256,10 @@ def create_windows_from_events(
|
|
|
295
256
|
trial_start_offset_samples and trial_stop_offset_samples.
|
|
296
257
|
If a dict, keys must match the keys of ``mapping`` and different
|
|
297
258
|
strides are applied per event type.
|
|
298
|
-
drop_last_window: bool
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
version 2.0.
|
|
259
|
+
drop_last_window: bool
|
|
260
|
+
If False, an additional overlapping window that ends at
|
|
261
|
+
trial_stop_offset_samples will be extracted around each event when the
|
|
262
|
+
last window does not end exactly at trial_stop_offset_samples.
|
|
303
263
|
mapping: dict(str: int)
|
|
304
264
|
Mapping from event description to numerical target value. Must be
|
|
305
265
|
provided when any of ``trial_start_offset_samples``,
|
|
@@ -344,25 +304,12 @@ def create_windows_from_events(
|
|
|
344
304
|
Number of jobs to use to parallelize the windowing.
|
|
345
305
|
verbose: bool | str | int | None
|
|
346
306
|
Control verbosity of the logging output when calling mne.Epochs.
|
|
347
|
-
on_last_window: {'overlap', 'drop'} | None
|
|
348
|
-
Behavior when the final regular window does not end exactly at the
|
|
349
|
-
trial boundary. ``'overlap'`` adds a final overlapping window ending
|
|
350
|
-
at the boundary; ``'drop'`` does not. Defaults to ``'overlap'`` when
|
|
351
|
-
neither this parameter nor ``drop_last_window`` is supplied.
|
|
352
307
|
|
|
353
308
|
Returns
|
|
354
309
|
-------
|
|
355
310
|
windows_datasets: BaseConcatDataset[WindowsDataset | EEGWindowsDataset]
|
|
356
311
|
Concatenated datasets of WindowsDataset containing the extracted windows.
|
|
357
312
|
"""
|
|
358
|
-
on_last_window = _resolve_on_last_window(
|
|
359
|
-
drop_last_window,
|
|
360
|
-
on_last_window,
|
|
361
|
-
default="overlap",
|
|
362
|
-
)
|
|
363
|
-
assert on_last_window is not None
|
|
364
|
-
drop_last_window_for_internal = on_last_window == "drop"
|
|
365
|
-
|
|
366
313
|
_check_windowing_arguments(
|
|
367
314
|
trial_start_offset_samples,
|
|
368
315
|
trial_stop_offset_samples,
|
|
@@ -444,7 +391,7 @@ def create_windows_from_events(
|
|
|
444
391
|
trial_stop_offset_samples,
|
|
445
392
|
window_size_samples,
|
|
446
393
|
window_stride_samples,
|
|
447
|
-
|
|
394
|
+
drop_last_window,
|
|
448
395
|
mapping,
|
|
449
396
|
preload,
|
|
450
397
|
drop_bad_windows,
|
|
@@ -482,8 +429,6 @@ def create_fixed_length_windows(
|
|
|
482
429
|
use_mne_epochs: bool | None = None,
|
|
483
430
|
n_jobs: int = 1,
|
|
484
431
|
verbose: bool | str | int | None = "error",
|
|
485
|
-
*,
|
|
486
|
-
on_last_window: _LastWindowStrategy | None = None,
|
|
487
432
|
) -> BaseConcatDataset[WindowsDataset | EEGWindowsDataset]:
|
|
488
433
|
"""Windower that creates sliding windows.
|
|
489
434
|
|
|
@@ -503,10 +448,9 @@ def create_fixed_length_windows(
|
|
|
503
448
|
Stride between windows in samples. If None, set to be equal to winddow_size_samples, so
|
|
504
449
|
windows will not overlap.
|
|
505
450
|
drop_last_window: bool | None
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
version 2.0.
|
|
451
|
+
Whether or not have a last overlapping window, when windows do not
|
|
452
|
+
equally divide the continuous signal. Must be set to a bool if window size and stride are
|
|
453
|
+
not None.
|
|
510
454
|
mapping: dict(str: int)
|
|
511
455
|
Mapping from event description to target value.
|
|
512
456
|
preload: bool
|
|
@@ -546,15 +490,6 @@ def create_fixed_length_windows(
|
|
|
546
490
|
Number of jobs to use to parallelize the windowing.
|
|
547
491
|
verbose: bool | str | int | None
|
|
548
492
|
Control verbosity of the logging output when calling mne.Epochs.
|
|
549
|
-
on_last_window: {'overlap', 'drop'} | None
|
|
550
|
-
Behavior when the final regular window does not end exactly at the
|
|
551
|
-
recording boundary. ``'overlap'`` adds a final overlapping window
|
|
552
|
-
ending at the boundary; ``'drop'`` does not. A policy is required when
|
|
553
|
-
both an explicit window size and stride are supplied. A size without a
|
|
554
|
-
stride defaults to non-overlapping windows and ``'drop'``. With no
|
|
555
|
-
explicit size or stride, the policy is immaterial and normalizes to
|
|
556
|
-
the existing single full-recording window. ``'overlap'`` is
|
|
557
|
-
incompatible with ``lazy_metadata=True``.
|
|
558
493
|
|
|
559
494
|
Returns
|
|
560
495
|
-------
|
|
@@ -563,24 +498,16 @@ def create_fixed_length_windows(
|
|
|
563
498
|
EEGWindowsDataset objects with the extracted windows, depending on
|
|
564
499
|
the value of ``use_mne_epochs``.
|
|
565
500
|
"""
|
|
566
|
-
|
|
567
|
-
drop_last_window,
|
|
568
|
-
on_last_window,
|
|
569
|
-
default=None,
|
|
570
|
-
)
|
|
571
|
-
stop_offset_samples, window_stride_samples, on_last_window = (
|
|
501
|
+
stop_offset_samples, window_stride_samples, drop_last_window = (
|
|
572
502
|
_check_and_set_fixed_length_window_arguments(
|
|
573
503
|
start_offset_samples,
|
|
574
504
|
stop_offset_samples,
|
|
575
505
|
window_size_samples,
|
|
576
506
|
window_stride_samples,
|
|
577
|
-
|
|
507
|
+
drop_last_window,
|
|
578
508
|
lazy_metadata,
|
|
579
509
|
)
|
|
580
510
|
)
|
|
581
|
-
drop_last_window_for_internal = (
|
|
582
|
-
None if on_last_window is None else on_last_window == "drop"
|
|
583
|
-
)
|
|
584
511
|
|
|
585
512
|
if drop_bad_windows is not None:
|
|
586
513
|
warnings.warn(
|
|
@@ -612,7 +539,7 @@ def create_fixed_length_windows(
|
|
|
612
539
|
stop_offset_samples,
|
|
613
540
|
window_size_samples,
|
|
614
541
|
window_stride_samples,
|
|
615
|
-
|
|
542
|
+
drop_last_window,
|
|
616
543
|
mapping,
|
|
617
544
|
preload,
|
|
618
545
|
drop_bad_windows,
|
|
@@ -1317,17 +1244,17 @@ def _check_and_set_fixed_length_window_arguments(
|
|
|
1317
1244
|
stop_offset_samples,
|
|
1318
1245
|
window_size_samples,
|
|
1319
1246
|
window_stride_samples,
|
|
1320
|
-
|
|
1247
|
+
drop_last_window,
|
|
1321
1248
|
lazy_metadata,
|
|
1322
1249
|
):
|
|
1323
1250
|
"""Raises warnings for incorrect input arguments and will set correct default values for
|
|
1324
|
-
stop_offset_samples, window_stride_samples &
|
|
1251
|
+
stop_offset_samples, window_stride_samples & drop_last_window, if necessary.
|
|
1325
1252
|
"""
|
|
1326
1253
|
# default stride to window size for non-overlapping windows
|
|
1327
1254
|
if window_size_samples is not None and window_stride_samples is None:
|
|
1328
1255
|
window_stride_samples = window_size_samples
|
|
1329
|
-
if
|
|
1330
|
-
|
|
1256
|
+
if drop_last_window is None:
|
|
1257
|
+
drop_last_window = True
|
|
1331
1258
|
|
|
1332
1259
|
_check_windowing_arguments(
|
|
1333
1260
|
start_offset_samples,
|
|
@@ -1354,30 +1281,30 @@ def _check_and_set_fixed_length_window_arguments(
|
|
|
1354
1281
|
if (
|
|
1355
1282
|
window_size_samples is not None
|
|
1356
1283
|
and window_stride_samples is not None
|
|
1357
|
-
and
|
|
1284
|
+
and drop_last_window is None
|
|
1358
1285
|
):
|
|
1359
1286
|
raise ValueError(
|
|
1360
|
-
"
|
|
1361
|
-
"window_stride_samples have also been set
|
|
1362
|
-
"Use 'drop' or 'overlap'."
|
|
1287
|
+
"drop_last_window must be set if both window_size_samples &"
|
|
1288
|
+
" window_stride_samples have also been set"
|
|
1363
1289
|
)
|
|
1364
|
-
|
|
1290
|
+
elif (
|
|
1365
1291
|
window_size_samples is None
|
|
1366
1292
|
and window_stride_samples is None
|
|
1367
|
-
and
|
|
1293
|
+
and drop_last_window is False
|
|
1368
1294
|
):
|
|
1369
|
-
|
|
1295
|
+
# necessary for following assertion
|
|
1296
|
+
drop_last_window = None
|
|
1370
1297
|
|
|
1371
1298
|
assert (
|
|
1372
1299
|
(window_size_samples is None)
|
|
1373
1300
|
== (window_stride_samples is None)
|
|
1374
|
-
== (
|
|
1301
|
+
== (drop_last_window is None)
|
|
1375
1302
|
)
|
|
1376
|
-
if
|
|
1303
|
+
if not drop_last_window and lazy_metadata:
|
|
1377
1304
|
raise ValueError(
|
|
1378
|
-
"Cannot
|
|
1305
|
+
"Cannot have drop_last_window=False and lazy_metadata=True at the same time."
|
|
1379
1306
|
)
|
|
1380
|
-
return stop_offset_samples, window_stride_samples,
|
|
1307
|
+
return stop_offset_samples, window_stride_samples, drop_last_window
|
|
1381
1308
|
|
|
1382
1309
|
|
|
1383
1310
|
def _get_windowing_kwargs(windowing_func_locals):
|