braindecode 1.5.0.dev1009__tar.gz → 1.5.0.dev1013__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.5.0.dev1009/braindecode.egg-info → braindecode-1.5.0.dev1013}/PKG-INFO +1 -1
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/augmentation/__init__.py +2 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/augmentation/functional.py +127 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/augmentation/transforms.py +97 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/base.py +119 -1
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/preprocessing/preprocess.py +38 -17
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/preprocessing/windowers.py +13 -4
- braindecode-1.5.0.dev1013/braindecode/version.py +1 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013/braindecode.egg-info}/PKG-INFO +1 -1
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/whats_new.rst +31 -11
- braindecode-1.5.0.dev1009/braindecode/version.py +0 -1
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/LICENSE.txt +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/MANIFEST.in +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/NOTICE.txt +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/README.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/__init__.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/augmentation/base.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/classifier.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/__init__.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/bbci.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/bcicomp.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/bids/__init__.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/bids/datasets.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/bids/format.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/bids/hub.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/bids/hub_format.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/bids/hub_io.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/bids/hub_validation.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/bids/iterable.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/chb_mit.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/mne.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/moabb.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/nmt.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/registry.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/siena.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/sleep_physio_challe_18.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/sleep_physionet.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/tuh.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/utils.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/xy.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datautil/__init__.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datautil/channel_utils.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datautil/hub_formats.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datautil/serialization.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datautil/util.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/eegneuralnet.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/functional/__init__.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/functional/functions.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/functional/initialization.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/__init__.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/atcnet.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/attentionbasenet.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/attn_sleep.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/base.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/bendr.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/biot.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/brainmodule.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/cbramod.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/codebrain.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/config.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/contrawr.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/ctnet.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/deep4.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/deepsleepnet.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/dgcnn.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/eegconformer.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/eeginception_erp.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/eeginception_mi.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/eegitnet.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/eegminer.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/eegnet.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/eegnex.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/eegpt.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/eegsimpleconv.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/eegsym.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/eegtcnet.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/emg2qwerty.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/fbcnet.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/fblightconvnet.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/fbmsnet.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/hybrid.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/ifnet.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/interpolated.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/labram.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/luna.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/medformer.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/meta_neuromotor.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/msvtnet.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/patchedtransformer.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/reve.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/sccnet.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/shallow_fbcsp.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/signal_jepa.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/sinc_shallow.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/sleep_stager_blanco_2020.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/sleep_stager_chambon_2018.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/sparcnet.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/sstdpn.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/summary.csv +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/syncnet.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/tcn.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/tidnet.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/tsinception.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/usleep.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/models/util.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/modules/__init__.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/modules/activation.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/modules/attention.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/modules/blocks.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/modules/convolution.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/modules/filter.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/modules/interpolation.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/modules/layers.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/modules/linear.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/modules/parametrization.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/modules/stats.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/modules/util.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/modules/wrapper.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/preprocessing/__init__.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/preprocessing/eegprep_preprocess.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/preprocessing/mne_preprocess.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/preprocessing/util.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/regressor.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/samplers/__init__.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/samplers/base.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/samplers/ssl.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/training/__init__.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/training/callbacks.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/training/losses.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/training/scoring.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/util.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/visualization/__init__.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/visualization/attribution.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/visualization/confusion_matrices.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/visualization/frequency.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/visualization/metrics.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/visualization/sanity.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/visualization/topology.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode.egg-info/SOURCES.txt +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode.egg-info/dependency_links.txt +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode.egg-info/requires.txt +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode.egg-info/top_level.txt +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/Makefile +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/_templates/autosummary/class.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/_templates/autosummary/class_in_subdir.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/_templates/autosummary/function.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/_templates/autosummary/function_in_subdir.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/api.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/cite.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/conf.py +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/help.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/index.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/install/install.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/install/install_pip.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/install/install_source.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/models/categorization/attention.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/models/categorization/channel.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/models/categorization/convolution.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/models/categorization/filterbank.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/models/categorization/gnn.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/models/categorization/interpretable.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/models/categorization/lbm.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/models/categorization/recurrent.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/models/categorization/spd.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/models/models.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/models/models_categorization.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/models/models_table.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/models/models_visualization.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/docs/sg_execution_times.rst +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/pyproject.toml +0 -0
- {braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: braindecode
|
|
3
|
-
Version: 1.5.0.
|
|
3
|
+
Version: 1.5.0.dev1013
|
|
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.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/augmentation/__init__.py
RENAMED
|
@@ -4,6 +4,7 @@ from . import functional
|
|
|
4
4
|
from .base import AugmentedDataLoader, Compose, IdentityTransform, Transform
|
|
5
5
|
from .transforms import (
|
|
6
6
|
AmplitudeScale,
|
|
7
|
+
BandRotation,
|
|
7
8
|
BandstopFilter,
|
|
8
9
|
ChannelsDropout,
|
|
9
10
|
ChannelsReref,
|
|
@@ -47,6 +48,7 @@ __all__ = [
|
|
|
47
48
|
"SegmentationReconstruction",
|
|
48
49
|
"MaskEncoding",
|
|
49
50
|
"AmplitudeScale",
|
|
51
|
+
"BandRotation",
|
|
50
52
|
"ChannelsReref",
|
|
51
53
|
"functional",
|
|
52
54
|
]
|
{braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/augmentation/functional.py
RENAMED
|
@@ -1298,3 +1298,130 @@ def amplitude_scale(
|
|
|
1298
1298
|
X = s * X
|
|
1299
1299
|
|
|
1300
1300
|
return X, y
|
|
1301
|
+
|
|
1302
|
+
|
|
1303
|
+
def band_rotation(
|
|
1304
|
+
X: torch.Tensor,
|
|
1305
|
+
y: torch.Tensor,
|
|
1306
|
+
num_bands: int = 2,
|
|
1307
|
+
electrodes_per_band: int = 16,
|
|
1308
|
+
band_offsets: tuple[int, ...] = (-1, 0, 1),
|
|
1309
|
+
max_temporal_jitter: int = 0,
|
|
1310
|
+
circular_jitter: bool = True,
|
|
1311
|
+
random_state: int | np.random.RandomState | None = None,
|
|
1312
|
+
) -> tuple[torch.Tensor, torch.Tensor]:
|
|
1313
|
+
"""Per-band electrode rotation + inter-band temporal jitter.
|
|
1314
|
+
|
|
1315
|
+
Models small wristband rotation between sessions and relative timing
|
|
1316
|
+
noise between two arms. Introduced in [Sivakumar2024]_ for the
|
|
1317
|
+
emg2qwerty CTC keystroke decoding task: each electrode band gets its
|
|
1318
|
+
own circular roll along the channel axis (``Uniform(band_offsets)``
|
|
1319
|
+
positions), and band 1 also gets a sample-level temporal shift
|
|
1320
|
+
(``Uniform(-max_temporal_jitter, +max_temporal_jitter)``) along the
|
|
1321
|
+
time axis.
|
|
1322
|
+
|
|
1323
|
+
Channel layout assumes ``(B, num_bands * electrodes_per_band, T)`` with
|
|
1324
|
+
bands contiguous along the channel axis. Same offset / shift is
|
|
1325
|
+
applied to every sample in the batch (one set of parameters per call).
|
|
1326
|
+
|
|
1327
|
+
Parameters
|
|
1328
|
+
----------
|
|
1329
|
+
X : torch.Tensor
|
|
1330
|
+
EMG input batch of shape ``(B, C, T)`` with
|
|
1331
|
+
``C == num_bands * electrodes_per_band``.
|
|
1332
|
+
y : torch.Tensor
|
|
1333
|
+
Labels (returned unchanged).
|
|
1334
|
+
num_bands : int, optional
|
|
1335
|
+
Number of electrode bands (e.g. ``2`` for left + right wristband).
|
|
1336
|
+
Must be ``>= 1``. Defaults to 2.
|
|
1337
|
+
electrodes_per_band : int, optional
|
|
1338
|
+
Electrodes per band (e.g. ``16``). Must be ``>= 1``. Defaults
|
|
1339
|
+
to 16.
|
|
1340
|
+
band_offsets : tuple of int, optional
|
|
1341
|
+
Per-band roll values to sample from uniformly. ``(-1, 0, 1)``
|
|
1342
|
+
covers ±1-electrode misalignment. Must be non-empty. Defaults
|
|
1343
|
+
to ``(-1, 0, 1)``.
|
|
1344
|
+
max_temporal_jitter : int, optional
|
|
1345
|
+
Max ±-sample temporal shift applied to band 1 only when
|
|
1346
|
+
``num_bands >= 2``. Defaults to 0 (disabled). Must be ``>= 0``.
|
|
1347
|
+
circular_jitter : bool, optional
|
|
1348
|
+
If True (the default, paper-faithful), the temporal jitter is a
|
|
1349
|
+
circular ``torch.roll`` — samples shifted off one edge wrap to
|
|
1350
|
+
the other. If False, the gap left by the shift is zero-padded
|
|
1351
|
+
and the shifted-off samples are dropped, avoiding wrap-around
|
|
1352
|
+
discontinuity at the cost of a small zeroed margin. Has no
|
|
1353
|
+
effect when ``max_temporal_jitter == 0``.
|
|
1354
|
+
random_state : int | numpy.random.RandomState, optional
|
|
1355
|
+
Seed / generator for sampling rotation + jitter values.
|
|
1356
|
+
|
|
1357
|
+
Returns
|
|
1358
|
+
-------
|
|
1359
|
+
torch.Tensor
|
|
1360
|
+
Transformed inputs.
|
|
1361
|
+
torch.Tensor
|
|
1362
|
+
Labels (unchanged).
|
|
1363
|
+
|
|
1364
|
+
References
|
|
1365
|
+
----------
|
|
1366
|
+
.. [Sivakumar2024] Sivakumar, V., Seely, J., Du, A., Bittner, S. R.,
|
|
1367
|
+
Berenzweig, A., Bolarinwa, A., Gramfort, A., & Mandel, M. I. (2024).
|
|
1368
|
+
"emg2qwerty: A Large Dataset with Baselines for Touch Typing using
|
|
1369
|
+
Surface Electromyography." *NeurIPS Datasets and Benchmarks Track*.
|
|
1370
|
+
"""
|
|
1371
|
+
if num_bands < 1:
|
|
1372
|
+
raise ValueError(f"num_bands must be >= 1, got {num_bands}")
|
|
1373
|
+
if electrodes_per_band < 1:
|
|
1374
|
+
raise ValueError(f"electrodes_per_band must be >= 1, got {electrodes_per_band}")
|
|
1375
|
+
# Normalise to a tuple before truth-testing so callers can pass any
|
|
1376
|
+
# sequence-like (incl. ``np.ndarray``) without hitting numpy's
|
|
1377
|
+
# ambiguous-truth-value error on ``if not band_offsets``.
|
|
1378
|
+
band_offsets = tuple(band_offsets)
|
|
1379
|
+
if not band_offsets:
|
|
1380
|
+
raise ValueError("band_offsets must be non-empty")
|
|
1381
|
+
if not all(isinstance(o, (int, np.integer)) for o in band_offsets):
|
|
1382
|
+
raise ValueError(f"band_offsets must contain integers, got {band_offsets!r}")
|
|
1383
|
+
if max_temporal_jitter < 0:
|
|
1384
|
+
raise ValueError(f"max_temporal_jitter must be >= 0, got {max_temporal_jitter}")
|
|
1385
|
+
expected_channels = num_bands * electrodes_per_band
|
|
1386
|
+
if X.shape[1] != expected_channels:
|
|
1387
|
+
raise ValueError(
|
|
1388
|
+
f"X.shape[1]={X.shape[1]} != num_bands * electrodes_per_band="
|
|
1389
|
+
f"{expected_channels}"
|
|
1390
|
+
)
|
|
1391
|
+
|
|
1392
|
+
rng = check_random_state(random_state)
|
|
1393
|
+
band_offsets_arr = np.asarray(band_offsets)
|
|
1394
|
+
out = X.clone()
|
|
1395
|
+
|
|
1396
|
+
# Per-band channel-axis rolls. A vectorized ``torch.gather`` was
|
|
1397
|
+
# benchmarked and is ~16 % slower for the typical ``num_bands == 2``
|
|
1398
|
+
# case on CPU (the index tensor is larger than what two contiguous
|
|
1399
|
+
# rolls touch); the gather only wins past ``num_bands >= 8``.
|
|
1400
|
+
for b in range(num_bands):
|
|
1401
|
+
offset = int(rng.choice(band_offsets_arr))
|
|
1402
|
+
if offset:
|
|
1403
|
+
sl = slice(b * electrodes_per_band, (b + 1) * electrodes_per_band)
|
|
1404
|
+
out[:, sl, :] = torch.roll(out[:, sl, :], offset, dims=1)
|
|
1405
|
+
|
|
1406
|
+
# Inter-band temporal jitter — paper recipe applies it to band 1 only.
|
|
1407
|
+
if max_temporal_jitter > 0 and num_bands >= 2:
|
|
1408
|
+
shift = int(rng.randint(-max_temporal_jitter, max_temporal_jitter + 1))
|
|
1409
|
+
if shift:
|
|
1410
|
+
sl = slice(electrodes_per_band, 2 * electrodes_per_band)
|
|
1411
|
+
band1 = out[:, sl, :]
|
|
1412
|
+
if circular_jitter:
|
|
1413
|
+
# Paper-faithful circular shift; wraps end-of-window
|
|
1414
|
+
# samples to the start (and vice versa).
|
|
1415
|
+
out[:, sl, :] = torch.roll(band1, shift, dims=2)
|
|
1416
|
+
else:
|
|
1417
|
+
# Crop-and-pad shift: drop samples that fall off one end,
|
|
1418
|
+
# zero-pad the gap on the other. Avoids the wrap-around
|
|
1419
|
+
# discontinuity at the cost of a ``|shift|``-sample margin.
|
|
1420
|
+
shifted = torch.zeros_like(band1)
|
|
1421
|
+
if shift > 0:
|
|
1422
|
+
shifted[:, :, shift:] = band1[:, :, :-shift]
|
|
1423
|
+
else: # shift < 0
|
|
1424
|
+
shifted[:, :, :shift] = band1[:, :, -shift:]
|
|
1425
|
+
out[:, sl, :] = shifted
|
|
1426
|
+
|
|
1427
|
+
return out, y
|
{braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/augmentation/transforms.py
RENAMED
|
@@ -16,6 +16,7 @@ from mne.channels import make_standard_montage
|
|
|
16
16
|
from .base import Transform
|
|
17
17
|
from .functional import (
|
|
18
18
|
amplitude_scale,
|
|
19
|
+
band_rotation,
|
|
19
20
|
bandstop_filter,
|
|
20
21
|
channels_dropout,
|
|
21
22
|
channels_permute,
|
|
@@ -1356,3 +1357,99 @@ class AmplitudeScale(Transform):
|
|
|
1356
1357
|
def get_augmentation_params(self, *batch):
|
|
1357
1358
|
"""Return transform parameters."""
|
|
1358
1359
|
return {"random_state": self.rng, "scale": self.scale}
|
|
1360
|
+
|
|
1361
|
+
|
|
1362
|
+
class BandRotation(Transform):
|
|
1363
|
+
"""Per-band electrode rotation + inter-band temporal jitter.
|
|
1364
|
+
|
|
1365
|
+
Models small wristband rotation between sessions and relative timing
|
|
1366
|
+
noise between two arms. Introduced in [Sivakumar2024]_ for the
|
|
1367
|
+
emg2qwerty surface-EMG keystroke decoding task: the channel axis is
|
|
1368
|
+
laid out as ``(B, num_bands * electrodes_per_band, T)`` with bands
|
|
1369
|
+
contiguous, each band gets a uniform circular roll along the channel
|
|
1370
|
+
axis, and when ``num_bands >= 2``, band 1 also gets a sample-level
|
|
1371
|
+
temporal shift. The same offset / shift is applied to every sample
|
|
1372
|
+
in a transformed sub-batch (one set of parameters per call).
|
|
1373
|
+
|
|
1374
|
+
Parameters
|
|
1375
|
+
----------
|
|
1376
|
+
probability : float
|
|
1377
|
+
Float setting the probability of applying the operation.
|
|
1378
|
+
num_bands : int, optional
|
|
1379
|
+
Number of electrode bands (e.g. ``2`` for left + right wristband).
|
|
1380
|
+
Must be ``>= 1``. Defaults to 2.
|
|
1381
|
+
electrodes_per_band : int, optional
|
|
1382
|
+
Electrodes per band (e.g. ``16``). Must be ``>= 1``. Defaults
|
|
1383
|
+
to 16.
|
|
1384
|
+
band_offsets : tuple of int, optional
|
|
1385
|
+
Per-band roll values to sample from uniformly. ``(-1, 0, 1)``
|
|
1386
|
+
covers ±1-electrode misalignment. Must be non-empty. Defaults
|
|
1387
|
+
to ``(-1, 0, 1)``.
|
|
1388
|
+
max_temporal_jitter : int, optional
|
|
1389
|
+
Max ±-sample temporal shift applied to band 1. Defaults to 0
|
|
1390
|
+
(jitter disabled). Must be ``>= 0``. The emg2qwerty paper uses
|
|
1391
|
+
120 samples (60 ms at 2 kHz).
|
|
1392
|
+
circular_jitter : bool, optional
|
|
1393
|
+
If True (default, paper-faithful) the jitter is a circular roll;
|
|
1394
|
+
if False the gap left by the shift is zero-padded. See
|
|
1395
|
+
:func:`band_rotation`.
|
|
1396
|
+
random_state : int | numpy.random.RandomState, optional
|
|
1397
|
+
Seed for the rotation / jitter sampler. Defaults to None.
|
|
1398
|
+
|
|
1399
|
+
References
|
|
1400
|
+
----------
|
|
1401
|
+
.. [Sivakumar2024] Sivakumar, V., Seely, J., Du, A., Bittner, S. R.,
|
|
1402
|
+
Berenzweig, A., Bolarinwa, A., Gramfort, A., & Mandel, M. I. (2024).
|
|
1403
|
+
"emg2qwerty: A Large Dataset with Baselines for Touch Typing using
|
|
1404
|
+
Surface Electromyography." *NeurIPS Datasets and Benchmarks Track*.
|
|
1405
|
+
"""
|
|
1406
|
+
|
|
1407
|
+
operation = staticmethod(band_rotation) # type: ignore[assignment]
|
|
1408
|
+
|
|
1409
|
+
def __init__(
|
|
1410
|
+
self,
|
|
1411
|
+
probability,
|
|
1412
|
+
num_bands=2,
|
|
1413
|
+
electrodes_per_band=16,
|
|
1414
|
+
band_offsets=(-1, 0, 1),
|
|
1415
|
+
max_temporal_jitter=0,
|
|
1416
|
+
circular_jitter=True,
|
|
1417
|
+
random_state=None,
|
|
1418
|
+
):
|
|
1419
|
+
super().__init__(probability=probability, random_state=random_state)
|
|
1420
|
+
# Up-front parameter validation; the underlying ``band_rotation``
|
|
1421
|
+
# also re-checks at call time, but raising here surfaces config
|
|
1422
|
+
# mistakes when the Transform is built rather than on the first
|
|
1423
|
+
# batch.
|
|
1424
|
+
if num_bands < 1:
|
|
1425
|
+
raise ValueError(f"num_bands must be >= 1, got {num_bands}")
|
|
1426
|
+
if electrodes_per_band < 1:
|
|
1427
|
+
raise ValueError(
|
|
1428
|
+
f"electrodes_per_band must be >= 1, got {electrodes_per_band}"
|
|
1429
|
+
)
|
|
1430
|
+
band_offsets = tuple(band_offsets)
|
|
1431
|
+
if not band_offsets:
|
|
1432
|
+
raise ValueError("band_offsets must be non-empty")
|
|
1433
|
+
if not all(isinstance(o, (int, np.integer)) for o in band_offsets):
|
|
1434
|
+
raise ValueError(
|
|
1435
|
+
f"band_offsets must contain integers, got {band_offsets!r}"
|
|
1436
|
+
)
|
|
1437
|
+
if max_temporal_jitter < 0:
|
|
1438
|
+
raise ValueError(
|
|
1439
|
+
f"max_temporal_jitter must be >= 0, got {max_temporal_jitter}"
|
|
1440
|
+
)
|
|
1441
|
+
self.num_bands = num_bands
|
|
1442
|
+
self.electrodes_per_band = electrodes_per_band
|
|
1443
|
+
self.band_offsets = band_offsets
|
|
1444
|
+
self.max_temporal_jitter = max_temporal_jitter
|
|
1445
|
+
self.circular_jitter = circular_jitter
|
|
1446
|
+
|
|
1447
|
+
def get_augmentation_params(self, *batch):
|
|
1448
|
+
return {
|
|
1449
|
+
"num_bands": self.num_bands,
|
|
1450
|
+
"electrodes_per_band": self.electrodes_per_band,
|
|
1451
|
+
"band_offsets": self.band_offsets,
|
|
1452
|
+
"max_temporal_jitter": self.max_temporal_jitter,
|
|
1453
|
+
"circular_jitter": self.circular_jitter,
|
|
1454
|
+
"random_state": self.rng,
|
|
1455
|
+
}
|
|
@@ -18,7 +18,7 @@ import shutil
|
|
|
18
18
|
import warnings
|
|
19
19
|
from abc import abstractmethod
|
|
20
20
|
from collections import Counter
|
|
21
|
-
from collections.abc import Callable
|
|
21
|
+
from collections.abc import Callable, Hashable
|
|
22
22
|
from glob import glob
|
|
23
23
|
from pathlib import Path
|
|
24
24
|
from typing import Any, Generic, Iterable, no_type_check
|
|
@@ -1340,6 +1340,124 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1340
1340
|
raise TypeError("target_transform must be a callable.")
|
|
1341
1341
|
self._target_transform = fn
|
|
1342
1342
|
|
|
1343
|
+
def set_target(self, column: Hashable) -> "BaseConcatDataset":
|
|
1344
|
+
"""Use ``column`` as the target ``y`` for every subdataset.
|
|
1345
|
+
|
|
1346
|
+
Dispatches on the subdataset type:
|
|
1347
|
+
|
|
1348
|
+
* For :class:`WindowsDataset` / :class:`EEGWindowsDataset`,
|
|
1349
|
+
``column`` is looked up in per-window ``metadata`` first, then in
|
|
1350
|
+
the per-record ``description`` (broadcast to every window). The
|
|
1351
|
+
resolved values overwrite ``ds.metadata['target']`` and ``ds.y``.
|
|
1352
|
+
For :class:`WindowsDataset`, the underlying ``ds.windows.metadata``
|
|
1353
|
+
is kept in sync so ``get_metadata()`` and the repr reflect the
|
|
1354
|
+
new target.
|
|
1355
|
+
* For :class:`RawDataset`, ``column`` must exist on the
|
|
1356
|
+
``description``. ``ds.target_name`` is set to ``column`` so
|
|
1357
|
+
``__getitem__`` reads ``description[column]`` as ``y`` on every
|
|
1358
|
+
access — no rebuild needed.
|
|
1359
|
+
|
|
1360
|
+
Parameters
|
|
1361
|
+
----------
|
|
1362
|
+
column : Hashable
|
|
1363
|
+
Name of a metadata column or description field (BIDS entity,
|
|
1364
|
+
participants.tsv extra, ...). Typically a string, but any
|
|
1365
|
+
hashable that pandas accepts as a column label is allowed.
|
|
1366
|
+
|
|
1367
|
+
Returns
|
|
1368
|
+
-------
|
|
1369
|
+
self : BaseConcatDataset
|
|
1370
|
+
|
|
1371
|
+
Raises
|
|
1372
|
+
------
|
|
1373
|
+
TypeError
|
|
1374
|
+
If any subdataset is not a :class:`WindowsDataset`,
|
|
1375
|
+
:class:`EEGWindowsDataset`, or :class:`RawDataset`, or if a
|
|
1376
|
+
windowed subdataset has lazy (non-DataFrame) metadata.
|
|
1377
|
+
ValueError
|
|
1378
|
+
If ``column`` is not present on a subdataset's metadata or
|
|
1379
|
+
description, or if a windowed subdataset has
|
|
1380
|
+
``targets_from='channels'`` (which would make this a silent
|
|
1381
|
+
no-op since ``__getitem__`` reads y from misc channels, not
|
|
1382
|
+
from ``metadata['target']``).
|
|
1383
|
+
"""
|
|
1384
|
+
for i, ds in enumerate(self.datasets):
|
|
1385
|
+
if isinstance(ds, (WindowsDataset, EEGWindowsDataset)):
|
|
1386
|
+
if not isinstance(ds.metadata, pd.DataFrame):
|
|
1387
|
+
# _LazyDataFrame (lazy_metadata=True) does not implement
|
|
1388
|
+
# .copy()/__setitem__, so the in-place write below would
|
|
1389
|
+
# raise AttributeError. Surface the precondition cleanly.
|
|
1390
|
+
raise TypeError(
|
|
1391
|
+
"set_target requires a materialized metadata "
|
|
1392
|
+
f"DataFrame; datasets[{i}].metadata is "
|
|
1393
|
+
f"{type(ds.metadata).__name__}. Re-window with "
|
|
1394
|
+
"lazy_metadata=False to use set_target."
|
|
1395
|
+
)
|
|
1396
|
+
if getattr(ds, "targets_from", "metadata") != "metadata":
|
|
1397
|
+
# __getitem__ would read y from misc channels; writing
|
|
1398
|
+
# metadata['target']/ds.y would be a silent no-op.
|
|
1399
|
+
raise ValueError(
|
|
1400
|
+
f"datasets[{i}] has targets_from="
|
|
1401
|
+
f"{ds.targets_from!r}; set_target only applies when "
|
|
1402
|
+
"targets_from='metadata' (otherwise __getitem__ "
|
|
1403
|
+
"derives y from misc channels and would ignore the "
|
|
1404
|
+
"rewritten target column)."
|
|
1405
|
+
)
|
|
1406
|
+
n = len(ds)
|
|
1407
|
+
md = ds.metadata
|
|
1408
|
+
if column in md.columns:
|
|
1409
|
+
values = md[column].iloc[:n].to_list()
|
|
1410
|
+
elif (
|
|
1411
|
+
isinstance(ds.description, pd.Series)
|
|
1412
|
+
and column in ds.description.index
|
|
1413
|
+
):
|
|
1414
|
+
values = [ds.description[column]] * n
|
|
1415
|
+
else:
|
|
1416
|
+
desc_keys = (
|
|
1417
|
+
list(ds.description.index)
|
|
1418
|
+
if isinstance(ds.description, pd.Series)
|
|
1419
|
+
else []
|
|
1420
|
+
)
|
|
1421
|
+
raise ValueError(
|
|
1422
|
+
f"Column {column!r} not found on datasets[{i}]: "
|
|
1423
|
+
f"metadata cols={list(md.columns)}, "
|
|
1424
|
+
f"description keys={desc_keys}."
|
|
1425
|
+
)
|
|
1426
|
+
# In-place write so the WindowsDataset's metadata and the
|
|
1427
|
+
# underlying mne.Epochs.metadata (which start as the same
|
|
1428
|
+
# object reference) both reflect the new target. Defensive
|
|
1429
|
+
# second write covers the case where they got de-aliased
|
|
1430
|
+
# earlier by a caller-side reassignment.
|
|
1431
|
+
md["target"] = values
|
|
1432
|
+
windows_obj = getattr(ds, "_windows", None)
|
|
1433
|
+
if windows_obj is not None and windows_obj.metadata is not md:
|
|
1434
|
+
windows_obj.metadata["target"] = values
|
|
1435
|
+
# values is already a fresh list (Series.to_list() / [x] * n);
|
|
1436
|
+
# no defensive copy needed — pandas keeps its own representation
|
|
1437
|
+
# for md["target"] so mutating ds.y won't reach back into it.
|
|
1438
|
+
ds.y = values
|
|
1439
|
+
elif isinstance(ds, RawDataset):
|
|
1440
|
+
if (
|
|
1441
|
+
not isinstance(ds.description, pd.Series)
|
|
1442
|
+
or column not in ds.description.index
|
|
1443
|
+
):
|
|
1444
|
+
desc_keys = (
|
|
1445
|
+
list(ds.description.index)
|
|
1446
|
+
if isinstance(ds.description, pd.Series)
|
|
1447
|
+
else []
|
|
1448
|
+
)
|
|
1449
|
+
raise ValueError(
|
|
1450
|
+
f"Column {column!r} not found on datasets[{i}] "
|
|
1451
|
+
f"description (keys={desc_keys})."
|
|
1452
|
+
)
|
|
1453
|
+
ds.target_name = column
|
|
1454
|
+
else:
|
|
1455
|
+
raise TypeError(
|
|
1456
|
+
"set_target requires WindowsDataset, EEGWindowsDataset, "
|
|
1457
|
+
f"or RawDataset; datasets[{i}] is {type(ds).__name__}."
|
|
1458
|
+
)
|
|
1459
|
+
return self
|
|
1460
|
+
|
|
1343
1461
|
def _outdated_save(self, path, overwrite=False):
|
|
1344
1462
|
"""This is a copy of the old saving function, that had inconsistent.
|
|
1345
1463
|
|
{braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/preprocessing/preprocess.py
RENAMED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
# David Sabbagh <dav.sabbagh@gmail.com>
|
|
7
7
|
# Bruno Aristimunha <b.aristimunha@gmail.com>
|
|
8
8
|
# Léo Burgund <leo.burgund@gmail.com>
|
|
9
|
+
# Sarthak Tayal <sarthaktayal2@gmail.com>
|
|
9
10
|
#
|
|
10
11
|
# License: BSD (3-clause)
|
|
11
12
|
|
|
@@ -217,6 +218,7 @@ def preprocess(
|
|
|
217
218
|
offset: int = 0,
|
|
218
219
|
copy_data: bool | None = None,
|
|
219
220
|
parallel_kwargs: dict | None = None,
|
|
221
|
+
max_nbytes: int | str | None = "1M",
|
|
220
222
|
):
|
|
221
223
|
"""Apply preprocessors to a concat dataset.
|
|
222
224
|
|
|
@@ -244,14 +246,20 @@ def preprocess(
|
|
|
244
246
|
Additional keyword arguments forwarded to ``joblib.Parallel``.
|
|
245
247
|
Defaults to None (equivalent to ``{}``).
|
|
246
248
|
See https://joblib.readthedocs.io/en/stable/generated/joblib.Parallel.html for details.
|
|
249
|
+
max_nbytes : int, str, or None
|
|
250
|
+
Threshold (in bytes; or e.g. ``"1M"``) above which joblib memory-maps
|
|
251
|
+
preloaded arrays as read-only when dispatching to worker processes.
|
|
252
|
+
Effective only when ``n_jobs != 1``. Pass ``None`` to disable memory
|
|
253
|
+
mapping when a preprocessor resizes the underlying data (for example
|
|
254
|
+
``filterbank``), which would otherwise fail with an ``mmap can't
|
|
255
|
+
resize a readonly`` error. ``parallel_kwargs['max_nbytes']`` takes
|
|
256
|
+
precedence if both are provided.
|
|
247
257
|
|
|
248
258
|
Returns
|
|
249
259
|
-------
|
|
250
260
|
BaseConcatDataset
|
|
251
261
|
Preprocessed dataset.
|
|
252
262
|
"""
|
|
253
|
-
# In case of serialization, make sure directory is available before
|
|
254
|
-
# preprocessing
|
|
255
263
|
if save_dir is not None and not overwrite:
|
|
256
264
|
_check_save_dir_empty(save_dir)
|
|
257
265
|
|
|
@@ -266,22 +274,35 @@ def preprocess(
|
|
|
266
274
|
parallel_params.setdefault(
|
|
267
275
|
"prefer", "threads" if platform.system() == "Windows" else None
|
|
268
276
|
)
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
277
|
+
parallel_params.setdefault("max_nbytes", max_nbytes)
|
|
278
|
+
|
|
279
|
+
try:
|
|
280
|
+
list_of_ds = Parallel(n_jobs=n_jobs, **parallel_params)(
|
|
281
|
+
delayed(_preprocess)(
|
|
282
|
+
ds,
|
|
283
|
+
i + offset,
|
|
284
|
+
preprocessors,
|
|
285
|
+
save_dir,
|
|
286
|
+
overwrite,
|
|
287
|
+
copy_data=(
|
|
288
|
+
(parallel_processing and (save_dir is None))
|
|
289
|
+
if copy_data is None
|
|
290
|
+
else copy_data
|
|
291
|
+
),
|
|
292
|
+
)
|
|
293
|
+
for i, ds in enumerate(concat_ds.datasets)
|
|
282
294
|
)
|
|
283
|
-
|
|
284
|
-
|
|
295
|
+
except (BufferError, ValueError, OSError) as exc:
|
|
296
|
+
msg = str(exc).lower().replace("-", "")
|
|
297
|
+
if "mmap" in msg and "readonly" in msg:
|
|
298
|
+
raise RuntimeError(
|
|
299
|
+
"Parallel preprocessing failed because joblib memory-mapped "
|
|
300
|
+
"a preloaded array that a preprocessor then attempted to "
|
|
301
|
+
"resize (e.g. ``filterbank``). Pass ``max_nbytes=None`` to "
|
|
302
|
+
"``preprocess`` to disable memory mapping, or supply a "
|
|
303
|
+
"``save_dir`` so the data is reloaded with ``preload=False``."
|
|
304
|
+
) from exc
|
|
305
|
+
raise
|
|
285
306
|
|
|
286
307
|
if save_dir is not None: # Reload datasets and replace in concat_ds
|
|
287
308
|
ids_to_load = [i + offset for i in range(len(concat_ds.datasets))]
|
{braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/preprocessing/windowers.py
RENAMED
|
@@ -498,7 +498,7 @@ def create_fixed_length_windows(
|
|
|
498
498
|
EEGWindowsDataset objects with the extracted windows, depending on
|
|
499
499
|
the value of ``use_mne_epochs``.
|
|
500
500
|
"""
|
|
501
|
-
stop_offset_samples, drop_last_window = (
|
|
501
|
+
stop_offset_samples, window_stride_samples, drop_last_window = (
|
|
502
502
|
_check_and_set_fixed_length_window_arguments(
|
|
503
503
|
start_offset_samples,
|
|
504
504
|
stop_offset_samples,
|
|
@@ -886,7 +886,10 @@ def _create_fixed_length_windows(
|
|
|
886
886
|
if mapping is not None:
|
|
887
887
|
# in case of multiple targets
|
|
888
888
|
if isinstance(target, pd.Series):
|
|
889
|
-
|
|
889
|
+
# Plain comprehension instead of Series.replace(mapping):
|
|
890
|
+
# replace() emits a pandas FutureWarning about silent downcasting
|
|
891
|
+
# and the result is immediately list-ified anyway.
|
|
892
|
+
target = [mapping.get(v, v) for v in target]
|
|
890
893
|
# in case of single value target
|
|
891
894
|
else:
|
|
892
895
|
target = mapping[target]
|
|
@@ -1245,8 +1248,14 @@ def _check_and_set_fixed_length_window_arguments(
|
|
|
1245
1248
|
lazy_metadata,
|
|
1246
1249
|
):
|
|
1247
1250
|
"""Raises warnings for incorrect input arguments and will set correct default values for
|
|
1248
|
-
stop_offset_samples & drop_last_window, if necessary.
|
|
1251
|
+
stop_offset_samples, window_stride_samples & drop_last_window, if necessary.
|
|
1249
1252
|
"""
|
|
1253
|
+
# default stride to window size for non-overlapping windows
|
|
1254
|
+
if window_size_samples is not None and window_stride_samples is None:
|
|
1255
|
+
window_stride_samples = window_size_samples
|
|
1256
|
+
if drop_last_window is None:
|
|
1257
|
+
drop_last_window = True
|
|
1258
|
+
|
|
1250
1259
|
_check_windowing_arguments(
|
|
1251
1260
|
start_offset_samples,
|
|
1252
1261
|
stop_offset_samples,
|
|
@@ -1295,7 +1304,7 @@ def _check_and_set_fixed_length_window_arguments(
|
|
|
1295
1304
|
raise ValueError(
|
|
1296
1305
|
"Cannot have drop_last_window=False and lazy_metadata=True at the same time."
|
|
1297
1306
|
)
|
|
1298
|
-
return stop_offset_samples, drop_last_window
|
|
1307
|
+
return stop_offset_samples, window_stride_samples, drop_last_window
|
|
1299
1308
|
|
|
1300
1309
|
|
|
1301
1310
|
def _get_windowing_kwargs(windowing_func_locals):
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.5.0.dev1013"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: braindecode
|
|
3
|
-
Version: 1.5.0.
|
|
3
|
+
Version: 1.5.0.dev1013
|
|
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>
|
|
@@ -22,12 +22,30 @@
|
|
|
22
22
|
.. _current:
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
Current 1.5.0 (
|
|
25
|
+
Current 1.5.0 (stable)
|
|
26
26
|
===============================
|
|
27
27
|
|
|
28
28
|
Enhancements
|
|
29
29
|
============
|
|
30
30
|
|
|
31
|
+
- Add :class:`braindecode.augmentation.BandRotation` and
|
|
32
|
+
:func:`braindecode.augmentation.functional.band_rotation`: per-band
|
|
33
|
+
circular roll along the channel axis plus inter-band temporal jitter,
|
|
34
|
+
for surface-EMG inputs shaped ``(B, num_bands * electrodes_per_band, T)``.
|
|
35
|
+
Models small wristband rotation between sessions and relative timing
|
|
36
|
+
noise between two arms, from the emg2qwerty paper (Sivakumar et al.,
|
|
37
|
+
NeurIPS 2024). By `Bruno Aristimunha`_.
|
|
38
|
+
|
|
39
|
+
- Add :meth:`braindecode.datasets.BaseConcatDataset.set_target` to swap
|
|
40
|
+
any per-window metadata column or per-record description field
|
|
41
|
+
(e.g. a BIDS entity, a participants.tsv extra) into the dataset's
|
|
42
|
+
target ``y`` in one call, replacing the manual
|
|
43
|
+
``for ds in concat.datasets: ds.metadata.loc[:, 'target'] = ...; ds.y = ...``
|
|
44
|
+
loop. Dispatches on the subdataset type: writes
|
|
45
|
+
``metadata['target']`` / ``ds.y`` for windowed records, and points
|
|
46
|
+
``target_name`` at the chosen description field for raw records.
|
|
47
|
+
By `Bruno Aristimunha`_.
|
|
48
|
+
|
|
31
49
|
- Redesign the documentation landing page (``docs/index.rst``) in a
|
|
32
50
|
pyhealth.dev-style layout: animated brain → EEG → net hero, fact strip
|
|
33
51
|
highlighting MOABB / EEGDash interoperability, interactive model-zoo
|
|
@@ -140,11 +158,6 @@ API and behavior changes
|
|
|
140
158
|
:class:`braindecode.models.InterpolatedLaBraM`. (:gh:`993`
|
|
141
159
|
by `Pierre Guetschel`_)
|
|
142
160
|
|
|
143
|
-
Requirements
|
|
144
|
-
============
|
|
145
|
-
|
|
146
|
-
- None yet
|
|
147
|
-
|
|
148
161
|
Bug fixes
|
|
149
162
|
==========
|
|
150
163
|
|
|
@@ -173,6 +186,10 @@ Bug fixes
|
|
|
173
186
|
- Fix ``TypeError: type 'Any' is not subscriptable`` when importing
|
|
174
187
|
``braindecode.models.config`` without ``numpydantic`` installed on
|
|
175
188
|
Python 3.12+ (:gh:`871` by `Sarthak Tayal`_)
|
|
189
|
+
- Fix :func:`braindecode.preprocessing.create_fixed_length_windows` crashing
|
|
190
|
+
when only ``window_size_samples`` is provided without ``window_stride_samples``,
|
|
191
|
+
stride now defaults to window size as documented
|
|
192
|
+
(:gh:`990` by `Sarthak Tayal`_)
|
|
176
193
|
- Add ``channel_embedding`` parameter to :class:`braindecode.models.SignalJEPA` and
|
|
177
194
|
:class:`braindecode.models.SignalJEPA_Contextual` to load pre-trained channel
|
|
178
195
|
embedding weights when fine-tuning on a subset of the pre-training channels.
|
|
@@ -187,11 +204,6 @@ Bug fixes
|
|
|
187
204
|
- Retry transient TLS failures from ``physionet.org`` when fetching
|
|
188
205
|
:class:`braindecode.datasets.SleepPhysionet` (by `Bruno Aristimunha`_)
|
|
189
206
|
|
|
190
|
-
Code health
|
|
191
|
-
============
|
|
192
|
-
|
|
193
|
-
- None yet
|
|
194
|
-
|
|
195
207
|
|
|
196
208
|
Current 1.4.0 (stable)
|
|
197
209
|
===============================
|
|
@@ -346,6 +358,14 @@ Bugs
|
|
|
346
358
|
marked all model-specific parameters as "The description is missing"
|
|
347
359
|
when ``DOCSTRING_INHERITANCE_ENABLE=1`` was set during documentation
|
|
348
360
|
builds (:gh:`971` by `Bruno Aristimunha`_)
|
|
361
|
+
- Expose ``max_nbytes`` directly on
|
|
362
|
+
:func:`braindecode.preprocessing.preprocess.preprocess` and turn the
|
|
363
|
+
cryptic ``mmap can't resize a readonly`` failure (raised when joblib
|
|
364
|
+
memory-maps a preloaded array that a preprocessor later tries to
|
|
365
|
+
resize) into an actionable error explaining how to fix it: pass
|
|
366
|
+
``max_nbytes=None`` to disable memory mapping, or supply a ``save_dir``
|
|
367
|
+
so data is reloaded with ``preload=False``
|
|
368
|
+
(:gh:`325` by `Sarthak Tayal`_)
|
|
349
369
|
|
|
350
370
|
Code health
|
|
351
371
|
============
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.5.0.dev1009"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/bids/__init__.py
RENAMED
|
File without changes
|
{braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/bids/datasets.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{braindecode-1.5.0.dev1009 → braindecode-1.5.0.dev1013}/braindecode/datasets/bids/hub_format.py
RENAMED
|
File without changes
|