braindecode 1.8.1.dev169794550__tar.gz → 1.8.1.dev170036056__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.1.dev169794550 → braindecode-1.8.1.dev170036056}/NOTICE.txt +24 -2
- {braindecode-1.8.1.dev169794550/braindecode.egg-info → braindecode-1.8.1.dev170036056}/PKG-INFO +5 -1
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/augmentation/__init__.py +2 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/augmentation/functional.py +6 -2
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/augmentation/transforms.py +185 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/classifier.py +9 -7
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/base.py +54 -5
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/tuh.py +22 -14
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datautil/serialization.py +6 -4
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/eegneuralnet.py +1 -1
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/functional/__init__.py +8 -0
- braindecode-1.8.1.dev170036056/braindecode/functional/_real_dft.py +138 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/functional/functions.py +178 -16
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/__init__.py +37 -14
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/attn_sleep.py +9 -15
- braindecode-1.8.1.dev170036056/braindecode/models/axon.py +523 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/barista.py +4 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/base.py +136 -20
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/bendr.py +73 -63
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/biot.py +57 -70
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/brainbert.py +10 -11
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/brainmodule.py +6 -11
- braindecode-1.8.1.dev170036056/braindecode/models/brainomni.py +958 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/brant.py +17 -14
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/cbramod.py +64 -26
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/codebrain.py +108 -78
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/config.py +1 -2
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/contrawr.py +4 -4
- braindecode-1.8.1.dev170036056/braindecode/models/csbrain.py +734 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/dance.py +1 -1
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/deep4.py +38 -13
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/dgcnn.py +10 -1
- braindecode-1.8.1.dev170036056/braindecode/models/diver1.py +948 -0
- braindecode-1.8.1.dev170036056/braindecode/models/eeg_clip.py +307 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/eegdino.py +32 -16
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/eeginception_mi.py +44 -17
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/eegnex.py +16 -1
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/eegpt.py +66 -103
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/eegsym.py +34 -8
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/emg2qwerty.py +19 -2
- braindecode-1.8.1.dev170036056/braindecode/models/guetschel2026.py +775 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/labram.py +376 -236
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/luna.py +81 -40
- braindecode-1.8.1.dev170036056/braindecode/models/mapa.py +905 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/medformer.py +28 -20
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/meta_neuromotor.py +67 -47
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/mirepnet.py +23 -2
- braindecode-1.8.1.dev170036056/braindecode/models/mscformer.py +502 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/msvtnet.py +7 -6
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/mvpformer.py +181 -189
- braindecode-1.8.1.dev170036056/braindecode/models/neurorvq.py +625 -0
- braindecode-1.8.1.dev170036056/braindecode/models/neurorvq_tokenizer.py +618 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/patchedtransformer.py +0 -1
- braindecode-1.8.1.dev170036056/braindecode/models/popt.py +324 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/reve.py +64 -52
- braindecode-1.8.1.dev170036056/braindecode/models/seizure_transformer.py +407 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/sensingdynamics.py +10 -5
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/shallow_fbcsp.py +15 -8
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/signal_jepa.py +99 -47
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/sleep_stager_blanco_2020.py +6 -2
- braindecode-1.8.1.dev170036056/braindecode/models/sleepfm.py +776 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/sstdpn.py +13 -10
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/steegformer.py +10 -4
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/summary.csv +17 -5
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/syncnet.py +2 -2
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/tcformer.py +30 -52
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/tcn.py +5 -0
- braindecode-1.8.1.dev170036056/braindecode/models/tfm_tokenizer.py +409 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/tidnet.py +18 -1
- braindecode-1.8.1.dev170036056/braindecode/models/tmsanet.py +233 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/usleep.py +3 -2
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/util.py +466 -112
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/zuna.py +41 -14
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/modules/__init__.py +6 -2
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/modules/attention.py +4 -4
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/modules/blocks.py +75 -11
- braindecode-1.8.1.dev170036056/braindecode/modules/channels.py +459 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/modules/convolution.py +25 -14
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/modules/dance_modules.py +34 -26
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/modules/filter.py +42 -36
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/modules/layers.py +16 -23
- braindecode-1.8.1.dev170036056/braindecode/modules/linear_attention.py +128 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/modules/parametrization.py +29 -0
- braindecode-1.8.1.dev170036056/braindecode/modules/popt_modules.py +187 -0
- braindecode-1.8.1.dev170036056/braindecode/modules/quantization.py +422 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/modules/stats.py +6 -1
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/preprocessing/preprocess.py +11 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/preprocessing/windowers.py +5 -4
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/regressor.py +41 -8
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/training/losses.py +7 -2
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/training/scoring.py +18 -9
- braindecode-1.8.1.dev170036056/braindecode/version.py +1 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/visualization/topology.py +1 -1
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056/braindecode.egg-info}/PKG-INFO +5 -1
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode.egg-info/SOURCES.txt +23 -3
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode.egg-info/requires.txt +5 -0
- braindecode-1.8.1.dev170036056/docs/agent_docs.rst +60 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/api.rst +54 -7
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/conf.py +7 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/index.rst +1 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/models/models_categorization.rst +10 -3
- braindecode-1.8.1.dev170036056/docs/user_guide/channel_strategies.rst +59 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/whats_new.rst +493 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/pyproject.toml +6 -0
- braindecode-1.8.1.dev169794550/braindecode/models/interpolated.py +0 -185
- braindecode-1.8.1.dev169794550/braindecode/modules/interpolation.py +0 -201
- braindecode-1.8.1.dev169794550/braindecode/version.py +0 -1
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/LICENSE.txt +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/MANIFEST.in +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/README.rst +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/__init__.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/augmentation/base.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/__init__.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/_notebook_viewer.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/bbci.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/bcicomp.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/bids/__init__.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/bids/datasets.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/bids/format.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/bids/hub.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/bids/hub_format.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/bids/hub_io.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/bids/hub_validation.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/bids/iterable.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/chb_mit.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/collate.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/mne.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/moabb.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/nmt.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/registry.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/siena.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/sleep_physio_challe_18.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/sleep_physionet.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/utils.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/xy.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datautil/__init__.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datautil/channel_utils.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datautil/hub_formats.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datautil/util.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/functional/initialization.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/atcnet.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/attentionbasenet.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/ctnet.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/deepsleepnet.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/eegconformer.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/eeginception_erp.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/eegitnet.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/eegminer.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/eegnet.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/eegsimpleconv.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/eegtcnet.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/fbcnet.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/fblightconvnet.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/fbmsnet.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/hybrid.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/ifnet.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/neuropose.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/sccnet.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/sinc_shallow.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/sleep_stager_chambon_2018.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/sparcnet.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/tsinception.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/models/vemg2pose.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/modules/activation.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/modules/linear.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/modules/util.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/modules/wrapper.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/preprocessing/__init__.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/preprocessing/eegprep_preprocess.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/preprocessing/mne_preprocess.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/preprocessing/util.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/samplers/__init__.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/samplers/base.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/samplers/ssl.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/training/__init__.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/training/callbacks.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/util.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/visualization/__init__.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/visualization/activations.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/visualization/attribution.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/visualization/confusion_matrices.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/visualization/frequency.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/visualization/metrics.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/visualization/sanity.py +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode.egg-info/dependency_links.txt +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode.egg-info/top_level.txt +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/Makefile +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/_templates/autosummary/class.rst +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/_templates/autosummary/class_in_subdir.rst +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/_templates/autosummary/function.rst +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/_templates/autosummary/function_in_subdir.rst +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/cite.rst +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/help.rst +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/install/install.rst +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/install/install_pip.rst +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/install/install_source.rst +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/models/categorization/attention.rst +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/models/categorization/channel.rst +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/models/categorization/convolution.rst +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/models/categorization/filterbank.rst +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/models/categorization/gnn.rst +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/models/categorization/interpretable.rst +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/models/categorization/lbm.rst +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/models/categorization/recurrent.rst +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/models/categorization/spd.rst +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/models/models.rst +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/models/models_table.rst +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/models/models_visualization.rst +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/docs/sg_execution_times.rst +0 -0
- {braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/setup.cfg +0 -0
|
@@ -13,9 +13,10 @@ The following components are licensed under the Creative Commons Attribution-Non
|
|
|
13
13
|
|
|
14
14
|
- `braindecode/models/eegminer.py`
|
|
15
15
|
- `braindecode/models/meta_neuromotor.py`
|
|
16
|
+
- `braindecode/models/sleepfm.py`
|
|
16
17
|
- `braindecode/models/brainmodule.py`
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
- `braindecode/models/neurorvq.py`
|
|
19
|
+
- `braindecode/models/neurorvq_tokenizer.py`
|
|
19
20
|
|
|
20
21
|
The `meta_neuromotor.py` file is a derivative of
|
|
21
22
|
`facebookresearch/generic-neuromotor-interface`, released by Meta Platforms,
|
|
@@ -43,15 +44,36 @@ The following components are licensed under the MIT License:
|
|
|
43
44
|
- `braindecode/models/tcformer.py`
|
|
44
45
|
- `braindecode/models/ifnet.py`
|
|
45
46
|
- `braindecode/models/mirepnet.py`
|
|
47
|
+
- `braindecode/models/popt.py`
|
|
48
|
+
- `braindecode/models/tfm_tokenizer.py`
|
|
49
|
+
- `braindecode/modules/popt_modules.py`
|
|
50
|
+
- `braindecode/models/brainomni.py`
|
|
51
|
+
- `braindecode/modules/quantization.py`
|
|
52
|
+
- `braindecode/modules/linear_attention.py`
|
|
53
|
+
- `braindecode/models/seizure_transformer.py`
|
|
54
|
+
- `docs/_static/model/seizure_transformer_arch.png`
|
|
55
|
+
- `braindecode/models/guetschel2026.py`
|
|
56
|
+
- `braindecode/models/tmsanet.py`
|
|
57
|
+
|
|
58
|
+
The `brainomni.py` file is a derivative of `OpenTSLab/BrainOmni` (MIT), whose
|
|
59
|
+
SEANet codec derives from Meta's `facebookresearch/encodec` (MIT). The
|
|
60
|
+
`quantization.py` module holds the residual vector quantization derived from
|
|
61
|
+
`lucidrains/vector-quantize-pytorch` (MIT) and the BrainOmni port.
|
|
62
|
+
The `linear_attention.py` module is the part of
|
|
63
|
+
`lucidrains/linear-attention-transformer` (MIT) that BIOT and TFMTokenizer run.
|
|
46
64
|
|
|
47
65
|
### Apache-2.0 Licensed Files
|
|
48
66
|
|
|
49
67
|
The following components are licensed under the Apache License 2.0:
|
|
50
68
|
|
|
69
|
+
- `braindecode/models/axon.py`
|
|
51
70
|
- `braindecode/models/mvpformer.py`
|
|
52
71
|
- `braindecode/models/zuna.py`
|
|
53
72
|
- `braindecode/models/luna.py`
|
|
73
|
+
- `braindecode/models/mapa.py`
|
|
54
74
|
- `braindecode/models/brant.py`
|
|
75
|
+
- `braindecode/models/diver1.py`
|
|
76
|
+
- `braindecode/models/mscformer.py`
|
|
55
77
|
|
|
56
78
|
### USC Academic License Files
|
|
57
79
|
|
{braindecode-1.8.1.dev169794550/braindecode.egg-info → braindecode-1.8.1.dev170036056}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: braindecode
|
|
3
|
-
Version: 1.8.1.
|
|
3
|
+
Version: 1.8.1.dev170036056
|
|
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>
|
|
@@ -44,6 +44,8 @@ Requires-Dist: huggingface_hub[torch]>=0.20.0; extra == "hub"
|
|
|
44
44
|
Requires-Dist: zarr>=3.0; extra == "hub"
|
|
45
45
|
Provides-Extra: viz
|
|
46
46
|
Requires-Dist: captum>=0.7.0; extra == "viz"
|
|
47
|
+
Provides-Extra: sae
|
|
48
|
+
Requires-Dist: sae-lens==6.51.3; extra == "sae"
|
|
47
49
|
Provides-Extra: tests
|
|
48
50
|
Requires-Dist: pytest<9.1; extra == "tests"
|
|
49
51
|
Requires-Dist: pytest-cov; extra == "tests"
|
|
@@ -58,6 +60,8 @@ Provides-Extra: typing
|
|
|
58
60
|
Requires-Dist: exca>=0.5.10; extra == "typing"
|
|
59
61
|
Requires-Dist: numpydantic>=1.7; extra == "typing"
|
|
60
62
|
Provides-Extra: docs
|
|
63
|
+
Requires-Dist: pytest<9.1; extra == "docs"
|
|
64
|
+
Requires-Dist: sphinx-markdown-builder==0.6.11; extra == "docs"
|
|
61
65
|
Requires-Dist: sphinx_gallery>=0.17; extra == "docs"
|
|
62
66
|
Requires-Dist: sphinx_rtd_theme; extra == "docs"
|
|
63
67
|
Requires-Dist: sphinx-autodoc-typehints; extra == "docs"
|
|
@@ -23,6 +23,7 @@ from .transforms import (
|
|
|
23
23
|
SignFlip,
|
|
24
24
|
SmoothTimeMask,
|
|
25
25
|
TimeReverse,
|
|
26
|
+
TrivialAugment,
|
|
26
27
|
)
|
|
27
28
|
|
|
28
29
|
__all__ = [
|
|
@@ -30,6 +31,7 @@ __all__ = [
|
|
|
30
31
|
"IdentityTransform",
|
|
31
32
|
"Compose",
|
|
32
33
|
"AugmentedDataLoader",
|
|
34
|
+
"TrivialAugment",
|
|
33
35
|
"TimeReverse",
|
|
34
36
|
"SignFlip",
|
|
35
37
|
"FTSurrogate",
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
# Gustavo Rodrigues <gustavenrique01@gmail.com>
|
|
4
4
|
# Bruna Lopes <brunajaflopes@gmail.com>
|
|
5
5
|
# Sarthak Tayal <sarthaktayal2@gmail.com>
|
|
6
|
+
# Anton Soloviev <anton@praviel.com>
|
|
6
7
|
#
|
|
7
8
|
# License: BSD (3-clause)
|
|
8
9
|
|
|
@@ -931,7 +932,7 @@ def _rotate_signals(
|
|
|
931
932
|
transformed_X = X.clone()
|
|
932
933
|
sensors_positions = list(sensors_positions_matrix)
|
|
933
934
|
for s, rot_sensors_matrix in enumerate(rot_sensors_matrices):
|
|
934
|
-
rot_sensors_positions = list(rot_sensors_matrix
|
|
935
|
+
rot_sensors_positions = list(rot_sensors_matrix)
|
|
935
936
|
for time in range(X.shape[-1]):
|
|
936
937
|
interpolator_t = Rbf(*sensors_positions, X[s, :, time])
|
|
937
938
|
transformed_X[s, :, time] = torch.from_numpy(
|
|
@@ -1093,7 +1094,8 @@ def segmentation_reconstruction(
|
|
|
1093
1094
|
y : torch.Tensor
|
|
1094
1095
|
EEG labels for the example or batch.
|
|
1095
1096
|
n_segments : int
|
|
1096
|
-
Number of segments to use in the batch.
|
|
1097
|
+
Number of segments to use in the batch. Any remaining samples are
|
|
1098
|
+
included in the last segment.
|
|
1097
1099
|
data_classes : list[tuple[int, torch.Tensor]]
|
|
1098
1100
|
List of tuples. Each tuple contains the class index and the corresponding EEG data.
|
|
1099
1101
|
rand_indices : array-like
|
|
@@ -1133,6 +1135,8 @@ def segmentation_reconstruction(
|
|
|
1133
1135
|
for idx_segment in range(n_segments):
|
|
1134
1136
|
start = idx_segment * segment_size
|
|
1135
1137
|
end = (idx_segment + 1) * segment_size
|
|
1138
|
+
if idx_segment == n_segments - 1:
|
|
1139
|
+
end = window_size
|
|
1136
1140
|
|
|
1137
1141
|
# Perform the data augmentation
|
|
1138
1142
|
X_aug[np.arange(n_trials), :, start:end] = X_class[
|
|
@@ -1457,3 +1457,188 @@ class BandRotation(Transform):
|
|
|
1457
1457
|
"circular_jitter": self.circular_jitter,
|
|
1458
1458
|
"random_state": self.rng,
|
|
1459
1459
|
}
|
|
1460
|
+
|
|
1461
|
+
|
|
1462
|
+
class TrivialAugment(Transform):
|
|
1463
|
+
"""Apply one randomly sampled label-preserving augmentation per example.
|
|
1464
|
+
|
|
1465
|
+
For every example, independently samples one transform from the pool
|
|
1466
|
+
below and one of ``num_bins`` strengths evenly spaced between that
|
|
1467
|
+
transform's bounds, as in TrivialAugment [1]_. Examples that draw the
|
|
1468
|
+
same transform and strength are transformed in one call; each pooled
|
|
1469
|
+
transform still draws its own randomness per example.
|
|
1470
|
+
|
|
1471
|
+
Default pool (no assumption on the signal's unit, sampling frequency or
|
|
1472
|
+
montage):
|
|
1473
|
+
|
|
1474
|
+
* :class:`TimeReverse` — no strength parameter.
|
|
1475
|
+
* :class:`SignFlip` — no strength parameter.
|
|
1476
|
+
* :class:`FTSurrogate` — phase noise magnitude, 0.2 to 1.
|
|
1477
|
+
* :class:`ChannelsDropout` — channel drop probability, 0.05 to 0.4.
|
|
1478
|
+
* :class:`ChannelsShuffle` — shuffle probability, 0.1 to 0.75.
|
|
1479
|
+
* :class:`SmoothTimeMask` — mask length as a fraction of the window
|
|
1480
|
+
length, 0.05 to 0.25.
|
|
1481
|
+
* :class:`GaussianNoise` — noise standard deviation as a fraction of the
|
|
1482
|
+
sub-batch standard deviation (volts or microvolts alike), 0.02 to 0.3.
|
|
1483
|
+
* :class:`AmplitudeScale` — scale interval ``(1/s, s)``, ``s`` from 1.25
|
|
1484
|
+
to 2.5.
|
|
1485
|
+
|
|
1486
|
+
``sfreq`` adds :class:`BandstopFilter` (bandwidth 0.5 to 4 Hz, capped
|
|
1487
|
+
2.5 Hz below Nyquist) and :class:`FrequencyShift` (maximum shift 0.5 to
|
|
1488
|
+
2 Hz); ``sensors_positions_matrix`` adds :class:`SensorsRotation` around
|
|
1489
|
+
the z axis (5 to 25 degrees).
|
|
1490
|
+
|
|
1491
|
+
Parameters
|
|
1492
|
+
----------
|
|
1493
|
+
probability : float, optional
|
|
1494
|
+
Probability of augmenting each example. Defaults to 1.0.
|
|
1495
|
+
sfreq : float | None, optional
|
|
1496
|
+
Sampling frequency of the signals, in Hz. Defaults to None.
|
|
1497
|
+
sensors_positions_matrix : array-like | None, optional
|
|
1498
|
+
Sensor positions of shape ``(3, n_channels)`` (see
|
|
1499
|
+
:class:`SensorsRotation`). Defaults to None.
|
|
1500
|
+
num_bins : int, optional
|
|
1501
|
+
Number of strength levels per transform. Defaults to 10.
|
|
1502
|
+
random_state : int | numpy.random.RandomState, optional
|
|
1503
|
+
Seed shared by the per-example sampler and every pooled transform.
|
|
1504
|
+
Defaults to None.
|
|
1505
|
+
|
|
1506
|
+
Attributes
|
|
1507
|
+
----------
|
|
1508
|
+
op_names : list of str
|
|
1509
|
+
Names of the transforms in the pool, in sampling order.
|
|
1510
|
+
|
|
1511
|
+
References
|
|
1512
|
+
----------
|
|
1513
|
+
.. [1] Müller, S. G., & Hutter, F. (2021). TrivialAugment:
|
|
1514
|
+
Tuning-free Yet State-of-the-Art Data Augmentation. Proceedings of
|
|
1515
|
+
the IEEE/CVF International Conference on Computer Vision (ICCV),
|
|
1516
|
+
pp. 774-782.
|
|
1517
|
+
"""
|
|
1518
|
+
|
|
1519
|
+
def __init__(
|
|
1520
|
+
self,
|
|
1521
|
+
probability=1.0,
|
|
1522
|
+
sfreq=None,
|
|
1523
|
+
sensors_positions_matrix=None,
|
|
1524
|
+
num_bins=10,
|
|
1525
|
+
random_state=None,
|
|
1526
|
+
):
|
|
1527
|
+
super().__init__(probability=probability, random_state=random_state)
|
|
1528
|
+
if not isinstance(num_bins, (int, np.integer)) or num_bins < 1:
|
|
1529
|
+
raise ValueError(f"num_bins must be a positive integer, got {num_bins}")
|
|
1530
|
+
self.num_bins = int(num_bins)
|
|
1531
|
+
rng = self.rng
|
|
1532
|
+
# (name, strength bounds or None, make(strength) or None: built per call)
|
|
1533
|
+
specs = [
|
|
1534
|
+
("TimeReverse", None, lambda s: TimeReverse(1.0, random_state=rng)),
|
|
1535
|
+
("SignFlip", None, lambda s: SignFlip(1.0, random_state=rng)),
|
|
1536
|
+
(
|
|
1537
|
+
"FTSurrogate",
|
|
1538
|
+
(0.2, 1.0),
|
|
1539
|
+
lambda s: FTSurrogate(1.0, phase_noise_magnitude=s, random_state=rng),
|
|
1540
|
+
),
|
|
1541
|
+
(
|
|
1542
|
+
"ChannelsDropout",
|
|
1543
|
+
(0.05, 0.4),
|
|
1544
|
+
lambda s: ChannelsDropout(1.0, p_drop=s, random_state=rng),
|
|
1545
|
+
),
|
|
1546
|
+
(
|
|
1547
|
+
"ChannelsShuffle",
|
|
1548
|
+
(0.1, 0.75),
|
|
1549
|
+
lambda s: ChannelsShuffle(1.0, p_shuffle=s, random_state=rng),
|
|
1550
|
+
),
|
|
1551
|
+
("SmoothTimeMask", (0.05, 0.25), None),
|
|
1552
|
+
("GaussianNoise", (0.02, 0.3), None),
|
|
1553
|
+
(
|
|
1554
|
+
"AmplitudeScale",
|
|
1555
|
+
(1.25, 2.5),
|
|
1556
|
+
lambda s: AmplitudeScale(1.0, interval=(1.0 / s, s), random_state=rng),
|
|
1557
|
+
),
|
|
1558
|
+
]
|
|
1559
|
+
if sfreq is not None:
|
|
1560
|
+
nyquist = sfreq / 2.0
|
|
1561
|
+
# BandstopFilter needs bandwidth < nyquist - 2; keep a margin
|
|
1562
|
+
max_bandwidth = min(4.0, nyquist - 2.5)
|
|
1563
|
+
if max_bandwidth <= 0.5:
|
|
1564
|
+
raise ValueError(
|
|
1565
|
+
f"sfreq={sfreq} is too small to sample valid band-stop "
|
|
1566
|
+
"bandwidths (needs at least 6.0 Hz)."
|
|
1567
|
+
)
|
|
1568
|
+
specs += [
|
|
1569
|
+
(
|
|
1570
|
+
"BandstopFilter",
|
|
1571
|
+
(0.5, max_bandwidth),
|
|
1572
|
+
lambda s: BandstopFilter(
|
|
1573
|
+
1.0,
|
|
1574
|
+
sfreq=sfreq,
|
|
1575
|
+
bandwidth=s,
|
|
1576
|
+
max_freq=nyquist,
|
|
1577
|
+
random_state=rng,
|
|
1578
|
+
),
|
|
1579
|
+
),
|
|
1580
|
+
(
|
|
1581
|
+
"FrequencyShift",
|
|
1582
|
+
(0.5, 2.0),
|
|
1583
|
+
lambda s: FrequencyShift(
|
|
1584
|
+
1.0, sfreq=sfreq, max_delta_freq=s, random_state=rng
|
|
1585
|
+
),
|
|
1586
|
+
),
|
|
1587
|
+
]
|
|
1588
|
+
if sensors_positions_matrix is not None:
|
|
1589
|
+
specs.append(
|
|
1590
|
+
(
|
|
1591
|
+
"SensorsRotation",
|
|
1592
|
+
(5.0, 25.0),
|
|
1593
|
+
lambda s: SensorsRotation(
|
|
1594
|
+
1.0,
|
|
1595
|
+
sensors_positions_matrix=sensors_positions_matrix,
|
|
1596
|
+
max_degrees=s,
|
|
1597
|
+
random_state=rng,
|
|
1598
|
+
),
|
|
1599
|
+
)
|
|
1600
|
+
)
|
|
1601
|
+
|
|
1602
|
+
self._pool = []
|
|
1603
|
+
for name, bounds, make in specs:
|
|
1604
|
+
if bounds is None:
|
|
1605
|
+
strengths = [None]
|
|
1606
|
+
else:
|
|
1607
|
+
strengths = np.linspace(*bounds, self.num_bins).tolist()
|
|
1608
|
+
variants = None if make is None else [make(s) for s in strengths]
|
|
1609
|
+
self._pool.append((name, strengths, variants))
|
|
1610
|
+
# pre-built transforms as submodules (pickle, ``.to()``)
|
|
1611
|
+
self._static_transforms = torch.nn.ModuleList(
|
|
1612
|
+
v for _, _, variants in self._pool if variants for v in variants
|
|
1613
|
+
)
|
|
1614
|
+
self.op_names = [name for name, _, _ in self._pool]
|
|
1615
|
+
|
|
1616
|
+
def operation(self, X, y):
|
|
1617
|
+
"""Apply one sampled transform and strength to each example of X."""
|
|
1618
|
+
n_strengths = np.array([len(strengths) for _, strengths, _ in self._pool])
|
|
1619
|
+
op_ids = self.rng.randint(0, len(self._pool), size=X.shape[0])
|
|
1620
|
+
bin_ids = self.rng.randint(0, self.num_bins, size=X.shape[0])
|
|
1621
|
+
# magnitude-free transforms collapse all examples onto bin 0
|
|
1622
|
+
bin_ids[n_strengths[op_ids] == 1] = 0
|
|
1623
|
+
keys = op_ids * self.num_bins + bin_ids
|
|
1624
|
+
|
|
1625
|
+
out_X, out_y = X.clone(), y.clone()
|
|
1626
|
+
for key in np.unique(keys):
|
|
1627
|
+
group = torch.from_numpy(np.flatnonzero(keys == key)).to(X.device)
|
|
1628
|
+
op_i, bin_j = divmod(int(key), self.num_bins)
|
|
1629
|
+
name, strengths, variants = self._pool[op_i]
|
|
1630
|
+
X_sub = X[group]
|
|
1631
|
+
if variants is not None:
|
|
1632
|
+
transform = variants[bin_j]
|
|
1633
|
+
elif name == "SmoothTimeMask":
|
|
1634
|
+
n_mask = max(1, int(round(strengths[bin_j] * X.shape[-1])))
|
|
1635
|
+
transform = SmoothTimeMask(
|
|
1636
|
+
1.0, mask_len_samples=n_mask, random_state=self.rng
|
|
1637
|
+
)
|
|
1638
|
+
else: # GaussianNoise, std relative to the sub-batch (unit-free)
|
|
1639
|
+
std = strengths[bin_j] * X_sub.std().item()
|
|
1640
|
+
transform = GaussianNoise(1.0, std=std, random_state=self.rng)
|
|
1641
|
+
tr_X, tr_y = transform(X_sub, y[group])
|
|
1642
|
+
out_X[group] = tr_X.to(out_X.dtype)
|
|
1643
|
+
out_y[group] = tr_y
|
|
1644
|
+
return out_X, out_y
|
|
@@ -207,15 +207,17 @@ class EEGClassifier(_EEGNeuralNet, NeuralNetClassifier):
|
|
|
207
207
|
|
|
208
208
|
Returns
|
|
209
209
|
-------
|
|
210
|
-
trial_predictions : np.ndarray
|
|
210
|
+
trial_predictions : np.ndarray | list of np.ndarray
|
|
211
211
|
3-dimensional array (n_trials x n_classes x n_predictions), where
|
|
212
212
|
the number of predictions depend on the chosen window size and the
|
|
213
|
-
receptive field of the network.
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
213
|
+
receptive field of the network. If trials have different lengths,
|
|
214
|
+
a list with one (n_classes x n_predictions) array per trial.
|
|
215
|
+
trial_targets : np.ndarray | list of np.ndarray
|
|
216
|
+
Ground-truth targets from the dataset. Only returned when
|
|
217
|
+
``return_targets=True``. An ``np.ndarray`` with a leading trial
|
|
218
|
+
dimension: ``(n_trials,)`` for scalar targets, with further
|
|
219
|
+
dimensions for multi-value or equal-length sequence targets. If
|
|
220
|
+
trial lengths differ, a list with one target array per trial.
|
|
219
221
|
"""
|
|
220
222
|
if not self.cropped:
|
|
221
223
|
warnings.warn(
|
{braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/base.py
RENAMED
|
@@ -14,6 +14,7 @@ from __future__ import annotations
|
|
|
14
14
|
import bisect
|
|
15
15
|
import html as _html
|
|
16
16
|
import json
|
|
17
|
+
import mmap
|
|
17
18
|
import os
|
|
18
19
|
import shutil
|
|
19
20
|
import warnings
|
|
@@ -28,6 +29,7 @@ import mne
|
|
|
28
29
|
import mne.io
|
|
29
30
|
import numpy as np
|
|
30
31
|
import pandas as pd
|
|
32
|
+
from mne.io.constants import FIFF
|
|
31
33
|
from mne.utils import _soft_import
|
|
32
34
|
from mne.utils.docs import deprecated
|
|
33
35
|
from torch.utils.data import ConcatDataset, Dataset, IterableDataset
|
|
@@ -220,6 +222,47 @@ def _compute_ch_pos(info, targets_from):
|
|
|
220
222
|
return pos
|
|
221
223
|
|
|
222
224
|
|
|
225
|
+
def _read_fif_window(raw, start, stop):
|
|
226
|
+
"""Samples ``start:stop`` of a lazy FIF raw, copied from the file in one go.
|
|
227
|
+
|
|
228
|
+
mne reads, casts and calibrates the FIF data buffers of a range one at a
|
|
229
|
+
time (60 Python steps for a 60-s window saved with 1-s buffers, each through
|
|
230
|
+
a buffered file whose buffer is 4 MB on network file systems). Here one
|
|
231
|
+
slice of the memory-mapped file holds the bytes of every buffer in the
|
|
232
|
+
range and one multiply calibrates them, with mne's arithmetic (float64 data
|
|
233
|
+
times ``raw._cals``), so the values equal ``raw._getitem``'s. Returns None
|
|
234
|
+
(the caller uses mne) unless ``raw`` is a lazy, single-file, uncompressed
|
|
235
|
+
FIF raw of float32 buffers without projector, compensation or gaps.
|
|
236
|
+
"""
|
|
237
|
+
if (
|
|
238
|
+
not isinstance(raw, mne.io.Raw)
|
|
239
|
+
or raw.preload
|
|
240
|
+
or len(raw._raw_extras) != 1
|
|
241
|
+
or raw._projector is not None
|
|
242
|
+
or raw._comp is not None
|
|
243
|
+
):
|
|
244
|
+
return None
|
|
245
|
+
extra = raw._raw_extras[0]
|
|
246
|
+
fname, bounds = extra["filename"], extra["bounds"]
|
|
247
|
+
if not isinstance(fname, Path) or fname.suffix == ".gz":
|
|
248
|
+
return None
|
|
249
|
+
start, stop = start + raw._first_samps[0], stop + raw._first_samps[0]
|
|
250
|
+
first = np.searchsorted(bounds, start, side="right") - 1
|
|
251
|
+
ents = extra["ent"][first : np.searchsorted(bounds, stop)]
|
|
252
|
+
if not ents or any(e is None or e.type != FIFF.FIFFT_FLOAT for e in ents):
|
|
253
|
+
return None
|
|
254
|
+
pos = ents[0].pos
|
|
255
|
+
# mmap: no copy through a 4 MB read buffer, and a cold file is read around
|
|
256
|
+
# the window by the kernel (as mne's 4 MB reads did), not window by window
|
|
257
|
+
with open(fname, "rb") as f, mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ) as m:
|
|
258
|
+
buf = m[pos : ents[-1].pos + 16 + ents[-1].size]
|
|
259
|
+
one = np.concatenate(
|
|
260
|
+
[np.frombuffer(buf, ">f4", e.size // 4, e.pos + 16 - pos) for e in ents]
|
|
261
|
+
).reshape(-1, extra["orig_nchan"])[start - bounds[first] : stop - bounds[first]]
|
|
262
|
+
picked = one[:, raw._read_picks[0]].T
|
|
263
|
+
return np.multiply(picked, raw._cals[:, np.newaxis], order="C")
|
|
264
|
+
|
|
265
|
+
|
|
223
266
|
def _window_info(crop_inds, sfreq):
|
|
224
267
|
"""Extract window size from crop indices.
|
|
225
268
|
|
|
@@ -823,9 +866,11 @@ class EEGWindowsDataset(_ZarrMixin, RecordDataset):
|
|
|
823
866
|
if self._zarr_data is not None:
|
|
824
867
|
X = self._zarr_data[:, i_start:i_stop]
|
|
825
868
|
else:
|
|
826
|
-
X = self.raw
|
|
827
|
-
|
|
828
|
-
|
|
869
|
+
X = _read_fif_window(self.raw, i_start, i_stop)
|
|
870
|
+
if X is None:
|
|
871
|
+
X = self.raw._getitem(
|
|
872
|
+
(slice(None), slice(i_start, i_stop)), return_times=False
|
|
873
|
+
)
|
|
829
874
|
X = np.array(X, dtype="float32")
|
|
830
875
|
if self.transform is not None:
|
|
831
876
|
X = self.transform(X)
|
|
@@ -1672,7 +1717,8 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1672
1717
|
kwargs_path = os.path.join(path, ".".join([kwarg_name, "json"]))
|
|
1673
1718
|
kwargs = getattr(self, kwarg_name)
|
|
1674
1719
|
if kwargs is not None:
|
|
1675
|
-
|
|
1720
|
+
with open(kwargs_path, "w") as f:
|
|
1721
|
+
json.dump(kwargs, f)
|
|
1676
1722
|
|
|
1677
1723
|
@property
|
|
1678
1724
|
def description(self) -> pd.DataFrame:
|
|
@@ -1742,7 +1788,10 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1742
1788
|
# Create path if it doesn't exist
|
|
1743
1789
|
os.makedirs(path, exist_ok=True)
|
|
1744
1790
|
|
|
1745
|
-
|
|
1791
|
+
# With an offset the caller fills one directory piece by piece (preprocess
|
|
1792
|
+
# saves each recording at its index), so the other entries are expected:
|
|
1793
|
+
# skip the scan that would stat them all on every call and list them in a warning.
|
|
1794
|
+
path_contents = os.listdir(path) if offset == 0 else []
|
|
1746
1795
|
n_sub_dirs = len(
|
|
1747
1796
|
[e for e in path_contents if os.path.isdir(os.path.join(path, e))]
|
|
1748
1797
|
)
|
{braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/datasets/tuh.py
RENAMED
|
@@ -11,10 +11,12 @@ TUH Abnormal EEG Corpus.
|
|
|
11
11
|
from __future__ import annotations
|
|
12
12
|
|
|
13
13
|
import glob
|
|
14
|
+
import json
|
|
14
15
|
import os
|
|
15
16
|
import re
|
|
16
17
|
import warnings
|
|
17
18
|
from datetime import datetime, timezone
|
|
19
|
+
from functools import cache
|
|
18
20
|
from pathlib import Path
|
|
19
21
|
from typing import Iterable, Literal
|
|
20
22
|
from unittest import mock
|
|
@@ -183,11 +185,8 @@ class TUH(BaseConcatDataset):
|
|
|
183
185
|
}
|
|
184
186
|
raw.rename_channels(mapping_strip)
|
|
185
187
|
|
|
186
|
-
montage1005 = mne.channels.make_standard_montage(
|
|
187
|
-
resolve_montage_name("standard_1005")
|
|
188
|
-
)
|
|
189
188
|
mapping_eeg_names = {
|
|
190
|
-
c.upper(): c for c in
|
|
189
|
+
c.upper(): c for c in _standard_1005().ch_names if c.upper() in raw.ch_names
|
|
191
190
|
}
|
|
192
191
|
|
|
193
192
|
# Set channels whose type could not be inferred (defaulted to "eeg") to "misc":
|
|
@@ -210,10 +209,7 @@ class TUH(BaseConcatDataset):
|
|
|
210
209
|
|
|
211
210
|
@staticmethod
|
|
212
211
|
def _set_montage(raw):
|
|
213
|
-
|
|
214
|
-
resolve_montage_name("standard_1005")
|
|
215
|
-
)
|
|
216
|
-
raw.set_montage(montage, on_missing="ignore")
|
|
212
|
+
raw.set_montage(_standard_1005(), on_missing="ignore")
|
|
217
213
|
|
|
218
214
|
@staticmethod
|
|
219
215
|
def _create_dataset(
|
|
@@ -245,7 +241,11 @@ class TUH(BaseConcatDataset):
|
|
|
245
241
|
# file paths, use this instead as before
|
|
246
242
|
if "year" in description:
|
|
247
243
|
meas_date = meas_date.replace(*description[["year", "month", "day"]])
|
|
248
|
-
|
|
244
|
+
# FIF (e.g. preprocess(..., save_dir=...)) stores dates from 1901-12-13 to
|
|
245
|
+
# 2038-01-19 only: undated recordings (year 1 above) and de-identified ones
|
|
246
|
+
# (TUAB has 1899-12-30) keep their date in the description only.
|
|
247
|
+
in_fif_range = -(2**31) <= meas_date.timestamp() < 2**31
|
|
248
|
+
raw.set_meas_date(meas_date if in_fif_range else None)
|
|
249
249
|
|
|
250
250
|
d = {
|
|
251
251
|
"age": int(age),
|
|
@@ -255,9 +255,9 @@ class TUH(BaseConcatDataset):
|
|
|
255
255
|
# if not, get it from meas_date in raw.info and add to description
|
|
256
256
|
# if meas_date is None, create fake one
|
|
257
257
|
if "year" not in description:
|
|
258
|
-
d["year"] =
|
|
259
|
-
d["month"] =
|
|
260
|
-
d["day"] =
|
|
258
|
+
d["year"] = meas_date.year
|
|
259
|
+
d["month"] = meas_date.month
|
|
260
|
+
d["day"] = meas_date.day
|
|
261
261
|
|
|
262
262
|
# read info relevant for preprocessing from raw without loading it
|
|
263
263
|
if add_physician_reports:
|
|
@@ -269,6 +269,12 @@ class TUH(BaseConcatDataset):
|
|
|
269
269
|
return base_dataset
|
|
270
270
|
|
|
271
271
|
|
|
272
|
+
@cache
|
|
273
|
+
def _standard_1005():
|
|
274
|
+
# Built once per process: set_montage copies the montage before using it.
|
|
275
|
+
return mne.channels.make_standard_montage(resolve_montage_name("standard_1005"))
|
|
276
|
+
|
|
277
|
+
|
|
272
278
|
def _create_description(file_paths, version, ds_name):
|
|
273
279
|
descriptions = [
|
|
274
280
|
_parse_description_from_file_path(f, version, ds_name) for f in file_paths
|
|
@@ -289,7 +295,8 @@ def _read_date(file_path):
|
|
|
289
295
|
date_path = file_path.replace(".edf", "_date.txt")
|
|
290
296
|
# if date file exists, read it
|
|
291
297
|
if os.path.exists(date_path):
|
|
292
|
-
|
|
298
|
+
with open(date_path) as f:
|
|
299
|
+
description = json.load(f)
|
|
293
300
|
# otherwise read edf file, extract date and store to file
|
|
294
301
|
else:
|
|
295
302
|
raw = mne.io.read_raw_edf(file_path, preload=False, verbose="error")
|
|
@@ -815,7 +822,8 @@ def _get_header(*args, **kwargs):
|
|
|
815
822
|
for paths_dict in [_TUH_EEG_PATHS, _TUH_EEG_ABNORMAL_PATHS, _TUH_EEG_EVENTS_PATHS]:
|
|
816
823
|
for version_dict in paths_dict.values():
|
|
817
824
|
all_paths.update(version_dict)
|
|
818
|
-
|
|
825
|
+
# Mock keys use POSIX separators; pathlib emits backslashes on Windows.
|
|
826
|
+
return all_paths[os.fspath(args[0]).replace("\\", "/")]
|
|
819
827
|
|
|
820
828
|
|
|
821
829
|
_TUH_EEG_PATHS = {
|
|
@@ -79,7 +79,8 @@ def _outdated_load_concat_dataset(path, preload, ids_to_load=None, target_name=N
|
|
|
79
79
|
for path in paths:
|
|
80
80
|
if is_raw and target_name is None:
|
|
81
81
|
target_file_name = path / "target_name.json"
|
|
82
|
-
|
|
82
|
+
with open(target_file_name) as f:
|
|
83
|
+
target_name = json.load(f)["target_name"]
|
|
83
84
|
|
|
84
85
|
all_signals, description = _load_signals_and_description(
|
|
85
86
|
path=path, preload=preload, is_raw=is_raw, ids_to_load=ids_to_load
|
|
@@ -264,7 +265,8 @@ def _load_parallel(path, i, preload, is_raw, has_stored_windows):
|
|
|
264
265
|
target_file_path = sub_dir / "target_name.json"
|
|
265
266
|
target_name = None
|
|
266
267
|
if target_file_path.exists():
|
|
267
|
-
|
|
268
|
+
with open(target_file_path) as f:
|
|
269
|
+
target_name = json.load(f)["target_name"]
|
|
268
270
|
|
|
269
271
|
if is_raw and (not has_stored_windows):
|
|
270
272
|
dataset = RawDataset(signals, description, target_name)
|
|
@@ -304,8 +306,8 @@ def _load_kwargs_json(kwargs_name, sub_dir):
|
|
|
304
306
|
kwargs_file_name = ".".join([kwargs_name, "json"])
|
|
305
307
|
kwargs_file_path = os.path.join(sub_dir, kwargs_file_name)
|
|
306
308
|
if os.path.exists(kwargs_file_path):
|
|
307
|
-
|
|
308
|
-
|
|
309
|
+
with open(kwargs_file_path) as f:
|
|
310
|
+
return json.load(f)
|
|
309
311
|
|
|
310
312
|
|
|
311
313
|
def _is_outdated_saved(path):
|
{braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/eegneuralnet.py
RENAMED
|
@@ -144,7 +144,7 @@ class _EEGNeuralNet(NeuralNet, abc.ABC):
|
|
|
144
144
|
i_window_in_trials.append(i[0].cpu().numpy())
|
|
145
145
|
i_window_stops.append(i[2].cpu().numpy())
|
|
146
146
|
with torch.no_grad():
|
|
147
|
-
preds.append(to_numpy(self.module_
|
|
147
|
+
preds.append(to_numpy(self.module_(X.to(self.device))))
|
|
148
148
|
window_ys.append(y.cpu().numpy())
|
|
149
149
|
preds = np.concatenate(preds)
|
|
150
150
|
i_window_in_trials = np.concatenate(i_window_in_trials)
|
{braindecode-1.8.1.dev169794550 → braindecode-1.8.1.dev170036056}/braindecode/functional/__init__.py
RENAMED
|
@@ -3,13 +3,17 @@ from .functions import (
|
|
|
3
3
|
daubechies_filters,
|
|
4
4
|
drop_path,
|
|
5
5
|
dwt_max_level,
|
|
6
|
+
fft_conv1d,
|
|
6
7
|
hilbert_freq,
|
|
7
8
|
identity,
|
|
8
9
|
iou_1d,
|
|
9
10
|
pairwise_iou_1d,
|
|
10
11
|
plv_time,
|
|
12
|
+
prefer_fft_conv,
|
|
13
|
+
rotate_pairs,
|
|
11
14
|
safe_log,
|
|
12
15
|
sinusoidal_positional_encoding,
|
|
16
|
+
spectral_input,
|
|
13
17
|
square,
|
|
14
18
|
wavelet_decomposition,
|
|
15
19
|
)
|
|
@@ -20,13 +24,17 @@ __all__ = [
|
|
|
20
24
|
"daubechies_filters",
|
|
21
25
|
"drop_path",
|
|
22
26
|
"dwt_max_level",
|
|
27
|
+
"fft_conv1d",
|
|
23
28
|
"hilbert_freq",
|
|
24
29
|
"identity",
|
|
25
30
|
"iou_1d",
|
|
26
31
|
"pairwise_iou_1d",
|
|
27
32
|
"plv_time",
|
|
33
|
+
"prefer_fft_conv",
|
|
34
|
+
"rotate_pairs",
|
|
28
35
|
"safe_log",
|
|
29
36
|
"sinusoidal_positional_encoding",
|
|
37
|
+
"spectral_input",
|
|
30
38
|
"square",
|
|
31
39
|
"wavelet_decomposition",
|
|
32
40
|
"glorot_weight_zero_bias",
|