Braindecode 1.8.1.dev172419947__tar.gz → 1.8.1.dev172484635__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.dev172419947 → braindecode-1.8.1.dev172484635}/NOTICE.txt +2 -20
- {braindecode-1.8.1.dev172419947/braindecode.egg-info → braindecode-1.8.1.dev172484635}/PKG-INFO +1 -1
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/augmentation/__init__.py +0 -2
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/augmentation/functional.py +2 -6
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/augmentation/transforms.py +0 -185
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/classifier.py +5 -6
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/base.py +8 -164
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/tuh.py +13 -20
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datautil/serialization.py +6 -10
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/eegneuralnet.py +1 -1
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/functional/__init__.py +0 -6
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/functional/_real_dft.py +0 -55
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/functional/functions.py +16 -163
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/__init__.py +14 -31
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/attn_sleep.py +15 -9
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/barista.py +2 -6
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/base.py +20 -136
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/bendr.py +63 -73
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/biot.py +70 -57
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/brainbert.py +11 -10
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/brainmodule.py +11 -6
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/brant.py +14 -17
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/cbramod.py +26 -64
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/codebrain.py +78 -121
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/config.py +2 -1
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/contrawr.py +4 -26
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/dance.py +1 -1
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/deep4.py +13 -37
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/dgcnn.py +1 -10
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/diver1.py +60 -55
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/eegconformer.py +2 -5
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/eegdino.py +16 -32
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/eeginception_mi.py +17 -48
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/eegnex.py +1 -16
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/eegpt.py +104 -69
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/eegsym.py +8 -34
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/emg2qwerty.py +2 -19
- braindecode-1.8.1.dev172484635/braindecode/models/interpolated.py +185 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/labram.py +222 -294
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/luna.py +41 -82
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/medformer.py +20 -28
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/meta_neuromotor.py +55 -102
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/mirepnet.py +2 -23
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/msvtnet.py +8 -12
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/mvpformer.py +192 -178
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/patchedtransformer.py +8 -3
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/popt.py +0 -4
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/reve.py +58 -75
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/sensingdynamics.py +5 -10
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/shallow_fbcsp.py +8 -15
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/signal_jepa.py +36 -72
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/sleep_stager_blanco_2020.py +6 -13
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/sstdpn.py +10 -13
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/steegformer.py +4 -10
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/summary.csv +5 -14
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/syncnet.py +2 -2
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/tcformer.py +52 -30
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/tcn.py +0 -5
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/tidnet.py +1 -18
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/usleep.py +2 -3
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/util.py +85 -315
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/zuna.py +14 -30
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/modules/__init__.py +2 -6
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/modules/attention.py +10 -49
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/modules/blocks.py +5 -18
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/modules/convolution.py +9 -10
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/modules/dance_modules.py +27 -48
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/modules/filter.py +66 -93
- braindecode-1.8.1.dev172484635/braindecode/modules/interpolation.py +201 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/modules/layers.py +25 -57
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/modules/parametrization.py +0 -29
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/modules/stats.py +1 -6
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/preprocessing/preprocess.py +0 -11
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/preprocessing/windowers.py +4 -5
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/regressor.py +5 -6
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/training/scoring.py +5 -6
- braindecode-1.8.1.dev172484635/braindecode/version.py +1 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/visualization/topology.py +1 -1
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635/braindecode.egg-info}/PKG-INFO +1 -1
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode.egg-info/SOURCES.txt +3 -17
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/api.rst +7 -46
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/index.rst +0 -1
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/models/models_categorization.rst +3 -10
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/whats_new.rst +1 -410
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/pyproject.toml +0 -3
- braindecode-1.8.1.dev172419947/braindecode/models/axon.py +0 -523
- braindecode-1.8.1.dev172419947/braindecode/models/brainomni.py +0 -962
- braindecode-1.8.1.dev172419947/braindecode/models/csbrain.py +0 -767
- braindecode-1.8.1.dev172419947/braindecode/models/eeg_clip.py +0 -307
- braindecode-1.8.1.dev172419947/braindecode/models/guetschel2026.py +0 -775
- braindecode-1.8.1.dev172419947/braindecode/models/mapa.py +0 -905
- braindecode-1.8.1.dev172419947/braindecode/models/neurorvq.py +0 -625
- braindecode-1.8.1.dev172419947/braindecode/models/neurorvq_tokenizer.py +0 -627
- braindecode-1.8.1.dev172419947/braindecode/models/seizure_transformer.py +0 -407
- braindecode-1.8.1.dev172419947/braindecode/models/sleepfm.py +0 -776
- braindecode-1.8.1.dev172419947/braindecode/models/tfm_tokenizer.py +0 -409
- braindecode-1.8.1.dev172419947/braindecode/models/tmsanet.py +0 -233
- braindecode-1.8.1.dev172419947/braindecode/modules/channels.py +0 -459
- braindecode-1.8.1.dev172419947/braindecode/modules/linear_attention.py +0 -128
- braindecode-1.8.1.dev172419947/braindecode/modules/quantization.py +0 -422
- braindecode-1.8.1.dev172419947/braindecode/version.py +0 -1
- braindecode-1.8.1.dev172419947/docs/user_guide/channel_strategies.rst +0 -59
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/LICENSE.txt +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/MANIFEST.in +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/README.rst +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/__init__.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/augmentation/base.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/__init__.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/_notebook_viewer.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/bbci.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/bcicomp.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/bids/__init__.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/bids/datasets.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/bids/format.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/bids/hub.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/bids/hub_format.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/bids/hub_io.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/bids/hub_validation.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/bids/iterable.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/chb_mit.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/collate.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/mne.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/moabb.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/nmt.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/registry.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/siena.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/sleep_physio_challe_18.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/sleep_physionet.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/utils.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/xy.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datautil/__init__.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datautil/channel_utils.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datautil/hub_formats.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datautil/util.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/functional/initialization.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/atcnet.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/attentionbasenet.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/ctnet.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/deepsleepnet.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/eeginception_erp.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/eegitnet.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/eegminer.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/eegnet.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/eegsimpleconv.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/eegtcnet.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/fbcnet.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/fblightconvnet.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/fbmsnet.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/hybrid.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/ifnet.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/mscformer.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/neuropose.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/sccnet.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/sinc_shallow.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/sleep_stager_chambon_2018.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/sparcnet.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/tsinception.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/models/vemg2pose.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/modules/activation.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/modules/linear.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/modules/popt_modules.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/modules/util.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/modules/wrapper.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/preprocessing/__init__.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/preprocessing/eegprep_preprocess.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/preprocessing/mne_preprocess.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/preprocessing/util.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/samplers/__init__.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/samplers/base.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/samplers/ssl.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/training/__init__.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/training/callbacks.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/training/losses.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/util.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/visualization/__init__.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/visualization/activations.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/visualization/attribution.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/visualization/confusion_matrices.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/visualization/frequency.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/visualization/metrics.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/visualization/sanity.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode.egg-info/dependency_links.txt +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode.egg-info/requires.txt +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode.egg-info/top_level.txt +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/Makefile +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/_templates/autosummary/class.rst +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/_templates/autosummary/class_in_subdir.rst +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/_templates/autosummary/function.rst +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/_templates/autosummary/function_in_subdir.rst +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/agent_docs.rst +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/cite.rst +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/conf.py +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/help.rst +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/install/install.rst +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/install/install_pip.rst +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/install/install_source.rst +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/models/categorization/attention.rst +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/models/categorization/channel.rst +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/models/categorization/convolution.rst +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/models/categorization/filterbank.rst +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/models/categorization/gnn.rst +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/models/categorization/interpretable.rst +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/models/categorization/lbm.rst +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/models/categorization/recurrent.rst +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/models/categorization/spd.rst +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/models/models.rst +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/models/models_table.rst +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/models/models_visualization.rst +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/docs/sg_execution_times.rst +0 -0
- {braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/setup.cfg +0 -0
|
@@ -13,10 +13,9 @@ 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`
|
|
17
16
|
- `braindecode/models/brainmodule.py`
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
|
|
18
|
+
As well as class later imported into the `braindecode.models.module` named as GeneralizedGaussianFilter.
|
|
20
19
|
|
|
21
20
|
The `meta_neuromotor.py` file is a derivative of
|
|
22
21
|
`facebookresearch/generic-neuromotor-interface`, released by Meta Platforms,
|
|
@@ -45,32 +44,15 @@ The following components are licensed under the MIT License:
|
|
|
45
44
|
- `braindecode/models/ifnet.py`
|
|
46
45
|
- `braindecode/models/mirepnet.py`
|
|
47
46
|
- `braindecode/models/popt.py`
|
|
48
|
-
- `braindecode/models/tfm_tokenizer.py`
|
|
49
47
|
- `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.
|
|
64
48
|
|
|
65
49
|
### Apache-2.0 Licensed Files
|
|
66
50
|
|
|
67
51
|
The following components are licensed under the Apache License 2.0:
|
|
68
52
|
|
|
69
|
-
- `braindecode/models/axon.py`
|
|
70
53
|
- `braindecode/models/mvpformer.py`
|
|
71
54
|
- `braindecode/models/zuna.py`
|
|
72
55
|
- `braindecode/models/luna.py`
|
|
73
|
-
- `braindecode/models/mapa.py`
|
|
74
56
|
- `braindecode/models/brant.py`
|
|
75
57
|
- `braindecode/models/diver1.py`
|
|
76
58
|
- `braindecode/models/mscformer.py`
|
{braindecode-1.8.1.dev172419947/braindecode.egg-info → braindecode-1.8.1.dev172484635}/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.dev172484635
|
|
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>
|
|
@@ -23,7 +23,6 @@ from .transforms import (
|
|
|
23
23
|
SignFlip,
|
|
24
24
|
SmoothTimeMask,
|
|
25
25
|
TimeReverse,
|
|
26
|
-
TrivialAugment,
|
|
27
26
|
)
|
|
28
27
|
|
|
29
28
|
__all__ = [
|
|
@@ -31,7 +30,6 @@ __all__ = [
|
|
|
31
30
|
"IdentityTransform",
|
|
32
31
|
"Compose",
|
|
33
32
|
"AugmentedDataLoader",
|
|
34
|
-
"TrivialAugment",
|
|
35
33
|
"TimeReverse",
|
|
36
34
|
"SignFlip",
|
|
37
35
|
"FTSurrogate",
|
|
@@ -3,7 +3,6 @@
|
|
|
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>
|
|
7
6
|
#
|
|
8
7
|
# License: BSD (3-clause)
|
|
9
8
|
|
|
@@ -932,7 +931,7 @@ def _rotate_signals(
|
|
|
932
931
|
transformed_X = X.clone()
|
|
933
932
|
sensors_positions = list(sensors_positions_matrix)
|
|
934
933
|
for s, rot_sensors_matrix in enumerate(rot_sensors_matrices):
|
|
935
|
-
rot_sensors_positions = list(rot_sensors_matrix)
|
|
934
|
+
rot_sensors_positions = list(rot_sensors_matrix.T)
|
|
936
935
|
for time in range(X.shape[-1]):
|
|
937
936
|
interpolator_t = Rbf(*sensors_positions, X[s, :, time])
|
|
938
937
|
transformed_X[s, :, time] = torch.from_numpy(
|
|
@@ -1094,8 +1093,7 @@ def segmentation_reconstruction(
|
|
|
1094
1093
|
y : torch.Tensor
|
|
1095
1094
|
EEG labels for the example or batch.
|
|
1096
1095
|
n_segments : int
|
|
1097
|
-
Number of segments to use in the batch.
|
|
1098
|
-
included in the last segment.
|
|
1096
|
+
Number of segments to use in the batch.
|
|
1099
1097
|
data_classes : list[tuple[int, torch.Tensor]]
|
|
1100
1098
|
List of tuples. Each tuple contains the class index and the corresponding EEG data.
|
|
1101
1099
|
rand_indices : array-like
|
|
@@ -1135,8 +1133,6 @@ def segmentation_reconstruction(
|
|
|
1135
1133
|
for idx_segment in range(n_segments):
|
|
1136
1134
|
start = idx_segment * segment_size
|
|
1137
1135
|
end = (idx_segment + 1) * segment_size
|
|
1138
|
-
if idx_segment == n_segments - 1:
|
|
1139
|
-
end = window_size
|
|
1140
1136
|
|
|
1141
1137
|
# Perform the data augmentation
|
|
1142
1138
|
X_aug[np.arange(n_trials), :, start:end] = X_class[
|
|
@@ -1457,188 +1457,3 @@ 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
|
|
@@ -212,12 +212,11 @@ class EEGClassifier(_EEGNeuralNet, NeuralNetClassifier):
|
|
|
212
212
|
the number of predictions depend on the chosen window size and the
|
|
213
213
|
receptive field of the network. If trials have different lengths,
|
|
214
214
|
a list with one (n_classes x n_predictions) array per trial.
|
|
215
|
-
trial_targets : np.ndarray
|
|
216
|
-
Ground-truth targets from the dataset
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
trial lengths differ, a list with one target array per trial.
|
|
215
|
+
trial_targets : np.ndarray
|
|
216
|
+
Ground-truth targets from the dataset in a 2-dimensional array
|
|
217
|
+
(n_trials x n_targets). Only returned when ``return_targets=True``.
|
|
218
|
+
The number of targets depends on the decoding paradigm and can be
|
|
219
|
+
either a single value, multiple values, or a sequence.
|
|
221
220
|
"""
|
|
222
221
|
if not self.cropped:
|
|
223
222
|
warnings.warn(
|
{braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/base.py
RENAMED
|
@@ -14,16 +14,13 @@ from __future__ import annotations
|
|
|
14
14
|
import bisect
|
|
15
15
|
import html as _html
|
|
16
16
|
import json
|
|
17
|
-
import mmap
|
|
18
17
|
import os
|
|
19
18
|
import shutil
|
|
20
19
|
import warnings
|
|
21
20
|
from abc import abstractmethod
|
|
22
21
|
from collections import Counter
|
|
23
|
-
from collections.abc import Callable, Hashable
|
|
22
|
+
from collections.abc import Callable, Hashable
|
|
24
23
|
from glob import glob
|
|
25
|
-
from itertools import chain
|
|
26
|
-
from operator import attrgetter
|
|
27
24
|
from pathlib import Path
|
|
28
25
|
from typing import Any, Generic, Iterable, no_type_check
|
|
29
26
|
|
|
@@ -31,7 +28,6 @@ import mne
|
|
|
31
28
|
import mne.io
|
|
32
29
|
import numpy as np
|
|
33
30
|
import pandas as pd
|
|
34
|
-
from mne.io.constants import FIFF
|
|
35
31
|
from mne.utils import _soft_import
|
|
36
32
|
from mne.utils.docs import deprecated
|
|
37
33
|
from torch.utils.data import ConcatDataset, Dataset, IterableDataset
|
|
@@ -224,125 +220,6 @@ def _compute_ch_pos(info, targets_from):
|
|
|
224
220
|
return pos
|
|
225
221
|
|
|
226
222
|
|
|
227
|
-
_TAG_ROW = attrgetter("kind", "type", "size", "next", "pos")
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
def _tag_rows(tags):
|
|
231
|
-
"""(kind, type, size, next, pos) of FIF tags as an int64 array (n, 5)."""
|
|
232
|
-
flat = chain.from_iterable(map(_TAG_ROW, tags))
|
|
233
|
-
return np.fromiter(flat, np.int64, 5 * len(tags)).reshape(-1, 5)
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
class _FifTagTable(Sequence):
|
|
237
|
-
"""The data-buffer tags of a lazy FIF raw as one int64 array.
|
|
238
|
-
|
|
239
|
-
mne's FIF reader keeps one ``Tag`` object per data buffer in
|
|
240
|
-
``raw._raw_extras[i]["ent"]`` (one per second of signal with mne's default
|
|
241
|
-
buffers), each with its attribute dict and integers once unpickled. A lazy
|
|
242
|
-
dataset of many recordings holds millions of them in RAM, and every forked
|
|
243
|
-
DataLoader worker copies the memory pages of those it reads (reference
|
|
244
|
-
counts). This holds the same fields in 40 bytes per buffer and returns an
|
|
245
|
-
equal ``Tag`` on access, so mne's own reads are unchanged.
|
|
246
|
-
"""
|
|
247
|
-
|
|
248
|
-
def __init__(self, tags):
|
|
249
|
-
self.tag_class = type(tags[0])
|
|
250
|
-
self.table = _tag_rows(tags)
|
|
251
|
-
|
|
252
|
-
def __len__(self):
|
|
253
|
-
return len(self.table)
|
|
254
|
-
|
|
255
|
-
def __getitem__(self, i):
|
|
256
|
-
if isinstance(i, slice):
|
|
257
|
-
return [self.tag_class(*row) for row in self.table[i].tolist()]
|
|
258
|
-
return self.tag_class(*self.table[i].tolist())
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
_TAG_FIELDS = ("kind", "type", "size", "next", "pos", "data")
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
def _compact_fif_tags(inst):
|
|
265
|
-
"""Swap the ``Tag`` lists of a FIF raw for `_FifTagTable` (in place).
|
|
266
|
-
|
|
267
|
-
Only gap-free lists of directory tags (no ``None``, no ``data``) with mne's
|
|
268
|
-
``Tag`` fields are swapped; anything else is left as mne built it.
|
|
269
|
-
"""
|
|
270
|
-
for extra in getattr(inst, "_raw_extras", ()):
|
|
271
|
-
tags = extra.get("ent")
|
|
272
|
-
if not isinstance(tags, list) or not tags:
|
|
273
|
-
continue
|
|
274
|
-
cls = type(tags[0])
|
|
275
|
-
if tuple(getattr(cls, "__dataclass_fields__", ())) == _TAG_FIELDS and all(
|
|
276
|
-
type(t) is cls and t.data is None for t in tags
|
|
277
|
-
):
|
|
278
|
-
extra["ent"] = _FifTagTable(tags)
|
|
279
|
-
return inst
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
def _read_fif_window(raw, start, stop, willneed=False):
|
|
283
|
-
"""Samples ``start:stop`` of a lazy FIF raw, copied from the file in one go.
|
|
284
|
-
|
|
285
|
-
mne reads, casts and calibrates the FIF data buffers of a range one at a
|
|
286
|
-
time (60 Python steps for a 60-s window saved with 1-s buffers, each through
|
|
287
|
-
a buffered file whose buffer is 4 MB on network file systems). Here one
|
|
288
|
-
slice of the memory-mapped file holds the bytes of every buffer in the
|
|
289
|
-
range and one multiply calibrates them, with mne's arithmetic (float64 data
|
|
290
|
-
times ``raw._cals``), so the values equal ``raw._getitem``'s. Returns None
|
|
291
|
-
(the caller uses mne) unless ``raw`` is a lazy, single-file, uncompressed
|
|
292
|
-
FIF raw of float32 buffers without projector, compensation or gaps.
|
|
293
|
-
|
|
294
|
-
With ``willneed=True`` nothing is read and None is returned: the OS is
|
|
295
|
-
only asked to start reading the window's bytes into the page cache in the
|
|
296
|
-
background (``posix_fadvise(POSIX_FADV_WILLNEED)``).
|
|
297
|
-
"""
|
|
298
|
-
if (
|
|
299
|
-
not isinstance(raw, mne.io.Raw)
|
|
300
|
-
or raw.preload
|
|
301
|
-
or len(raw._raw_extras) != 1
|
|
302
|
-
or raw._projector is not None
|
|
303
|
-
or raw._comp is not None
|
|
304
|
-
):
|
|
305
|
-
return None
|
|
306
|
-
extra = raw._raw_extras[0]
|
|
307
|
-
fname, bounds = extra["filename"], extra["bounds"]
|
|
308
|
-
if not isinstance(fname, Path) or fname.suffix == ".gz":
|
|
309
|
-
return None
|
|
310
|
-
start, stop = start + raw._first_samps[0], stop + raw._first_samps[0]
|
|
311
|
-
first = np.searchsorted(bounds, start, side="right") - 1
|
|
312
|
-
tags = extra["ent"]
|
|
313
|
-
if isinstance(tags, _FifTagTable):
|
|
314
|
-
rows = tags.table[first : np.searchsorted(bounds, stop)]
|
|
315
|
-
else:
|
|
316
|
-
tags = tags[first : np.searchsorted(bounds, stop)]
|
|
317
|
-
if any(t is None for t in tags):
|
|
318
|
-
return None
|
|
319
|
-
rows = _tag_rows(tags)
|
|
320
|
-
if not len(rows) or (rows[:, 1] != FIFF.FIFFT_FLOAT).any():
|
|
321
|
-
return None
|
|
322
|
-
size, pos = rows[:, 2].tolist(), rows[:, 4].tolist()
|
|
323
|
-
if willneed: # only a hint: any error is left to the read itself
|
|
324
|
-
try:
|
|
325
|
-
with open(fname, "rb") as f:
|
|
326
|
-
os.posix_fadvise(
|
|
327
|
-
f.fileno(),
|
|
328
|
-
pos[0],
|
|
329
|
-
pos[-1] + 16 + size[-1] - pos[0],
|
|
330
|
-
os.POSIX_FADV_WILLNEED,
|
|
331
|
-
)
|
|
332
|
-
except OSError:
|
|
333
|
-
pass
|
|
334
|
-
return None
|
|
335
|
-
# mmap: no copy through a 4 MB read buffer, and a cold file is read around
|
|
336
|
-
# the window by the kernel (as mne's 4 MB reads did), not window by window
|
|
337
|
-
with open(fname, "rb") as f, mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ) as m:
|
|
338
|
-
buf = m[pos[0] : pos[-1] + 16 + size[-1]]
|
|
339
|
-
one = np.concatenate(
|
|
340
|
-
[np.frombuffer(buf, ">f4", s // 4, p + 16 - pos[0]) for s, p in zip(size, pos)]
|
|
341
|
-
).reshape(-1, extra["orig_nchan"])[start - bounds[first] : stop - bounds[first]]
|
|
342
|
-
picked = one[:, raw._read_picks[0]].T
|
|
343
|
-
return np.multiply(picked, raw._cals[:, np.newaxis], order="C")
|
|
344
|
-
|
|
345
|
-
|
|
346
223
|
def _window_info(crop_inds, sfreq):
|
|
347
224
|
"""Extract window size from crop indices.
|
|
348
225
|
|
|
@@ -946,11 +823,9 @@ class EEGWindowsDataset(_ZarrMixin, RecordDataset):
|
|
|
946
823
|
if self._zarr_data is not None:
|
|
947
824
|
X = self._zarr_data[:, i_start:i_stop]
|
|
948
825
|
else:
|
|
949
|
-
X =
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
(slice(None), slice(i_start, i_stop)), return_times=False
|
|
953
|
-
)
|
|
826
|
+
X = self.raw._getitem(
|
|
827
|
+
(slice(None), slice(i_start, i_stop)), return_times=False
|
|
828
|
+
)
|
|
954
829
|
X = np.array(X, dtype="float32")
|
|
955
830
|
if self.transform is not None:
|
|
956
831
|
X = self.transform(X)
|
|
@@ -1378,8 +1253,7 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1378
1253
|
def __len__(self):
|
|
1379
1254
|
return self._ensure_cumulative_sizes()[-1]
|
|
1380
1255
|
|
|
1381
|
-
def
|
|
1382
|
-
"""The dataset that holds item ``idx`` and the item's index in it."""
|
|
1256
|
+
def _get_single_item(self, idx: int):
|
|
1383
1257
|
if idx < 0:
|
|
1384
1258
|
if -idx > len(self):
|
|
1385
1259
|
raise ValueError(
|
|
@@ -1393,33 +1267,7 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1393
1267
|
sample_idx = idx
|
|
1394
1268
|
else:
|
|
1395
1269
|
sample_idx = idx - cumulative_sizes[dataset_idx - 1]
|
|
1396
|
-
return self.datasets[dataset_idx]
|
|
1397
|
-
|
|
1398
|
-
def _get_single_item(self, idx: int):
|
|
1399
|
-
ds, i = self._locate(idx)
|
|
1400
|
-
return ds[i]
|
|
1401
|
-
|
|
1402
|
-
def __getitems__(self, indices):
|
|
1403
|
-
"""Items ``indices``, as ``[self[i] for i in indices]``.
|
|
1404
|
-
|
|
1405
|
-
A :class:`~torch.utils.data.DataLoader` fetches each batch through
|
|
1406
|
-
this. The lazy FIF windows of the batch are first requested from the
|
|
1407
|
-
OS all at once (``posix_fadvise(POSIX_FADV_WILLNEED)``, where it
|
|
1408
|
-
exists), so their reads from disk overlap instead of running one after
|
|
1409
|
-
another: on a network file system a batch read from cold files then
|
|
1410
|
-
costs about one round trip, not one per window.
|
|
1411
|
-
"""
|
|
1412
|
-
# ponytail: advises the whole batch at once; chunk it if a batch's
|
|
1413
|
-
# windows ever outgrow the page cache
|
|
1414
|
-
if hasattr(os, "posix_fadvise"):
|
|
1415
|
-
for idx in indices:
|
|
1416
|
-
if not isinstance(idx, (int, np.integer)):
|
|
1417
|
-
continue # e.g. a SequenceSampler tuple: read, not advised
|
|
1418
|
-
ds, i = self._locate(idx)
|
|
1419
|
-
if isinstance(ds, EEGWindowsDataset) and ds._zarr_data is None:
|
|
1420
|
-
_, start, stop = ds.crop_inds[i].tolist()
|
|
1421
|
-
_read_fif_window(ds.raw, start, stop, willneed=True)
|
|
1422
|
-
return [self[idx] for idx in indices]
|
|
1270
|
+
return self.datasets[dataset_idx][sample_idx]
|
|
1423
1271
|
|
|
1424
1272
|
def __getitem__(self, idx: int | list):
|
|
1425
1273
|
"""
|
|
@@ -1824,8 +1672,7 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1824
1672
|
kwargs_path = os.path.join(path, ".".join([kwarg_name, "json"]))
|
|
1825
1673
|
kwargs = getattr(self, kwarg_name)
|
|
1826
1674
|
if kwargs is not None:
|
|
1827
|
-
|
|
1828
|
-
json.dump(kwargs, f)
|
|
1675
|
+
json.dump(kwargs, open(kwargs_path, "w"))
|
|
1829
1676
|
|
|
1830
1677
|
@property
|
|
1831
1678
|
def description(self) -> pd.DataFrame:
|
|
@@ -1895,10 +1742,7 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1895
1742
|
# Create path if it doesn't exist
|
|
1896
1743
|
os.makedirs(path, exist_ok=True)
|
|
1897
1744
|
|
|
1898
|
-
|
|
1899
|
-
# saves each recording at its index), so the other entries are expected:
|
|
1900
|
-
# skip the scan that would stat them all on every call and list them in a warning.
|
|
1901
|
-
path_contents = os.listdir(path) if offset == 0 else []
|
|
1745
|
+
path_contents = os.listdir(path)
|
|
1902
1746
|
n_sub_dirs = len(
|
|
1903
1747
|
[e for e in path_contents if os.path.isdir(os.path.join(path, e))]
|
|
1904
1748
|
)
|
{braindecode-1.8.1.dev172419947 → braindecode-1.8.1.dev172484635}/braindecode/datasets/tuh.py
RENAMED
|
@@ -11,12 +11,10 @@ TUH Abnormal EEG Corpus.
|
|
|
11
11
|
from __future__ import annotations
|
|
12
12
|
|
|
13
13
|
import glob
|
|
14
|
-
import json
|
|
15
14
|
import os
|
|
16
15
|
import re
|
|
17
16
|
import warnings
|
|
18
17
|
from datetime import datetime, timezone
|
|
19
|
-
from functools import cache
|
|
20
18
|
from pathlib import Path
|
|
21
19
|
from typing import Iterable, Literal
|
|
22
20
|
from unittest import mock
|
|
@@ -185,8 +183,11 @@ class TUH(BaseConcatDataset):
|
|
|
185
183
|
}
|
|
186
184
|
raw.rename_channels(mapping_strip)
|
|
187
185
|
|
|
186
|
+
montage1005 = mne.channels.make_standard_montage(
|
|
187
|
+
resolve_montage_name("standard_1005")
|
|
188
|
+
)
|
|
188
189
|
mapping_eeg_names = {
|
|
189
|
-
c.upper(): c for c in
|
|
190
|
+
c.upper(): c for c in montage1005.ch_names if c.upper() in raw.ch_names
|
|
190
191
|
}
|
|
191
192
|
|
|
192
193
|
# Set channels whose type could not be inferred (defaulted to "eeg") to "misc":
|
|
@@ -209,7 +210,10 @@ class TUH(BaseConcatDataset):
|
|
|
209
210
|
|
|
210
211
|
@staticmethod
|
|
211
212
|
def _set_montage(raw):
|
|
212
|
-
|
|
213
|
+
montage = mne.channels.make_standard_montage(
|
|
214
|
+
resolve_montage_name("standard_1005")
|
|
215
|
+
)
|
|
216
|
+
raw.set_montage(montage, on_missing="ignore")
|
|
213
217
|
|
|
214
218
|
@staticmethod
|
|
215
219
|
def _create_dataset(
|
|
@@ -241,11 +245,7 @@ class TUH(BaseConcatDataset):
|
|
|
241
245
|
# file paths, use this instead as before
|
|
242
246
|
if "year" in description:
|
|
243
247
|
meas_date = meas_date.replace(*description[["year", "month", "day"]])
|
|
244
|
-
|
|
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)
|
|
248
|
+
raw.set_meas_date(meas_date)
|
|
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"] = meas_date.year
|
|
259
|
-
d["month"] = meas_date.month
|
|
260
|
-
d["day"] = meas_date.day
|
|
258
|
+
d["year"] = raw.info["meas_date"].year
|
|
259
|
+
d["month"] = raw.info["meas_date"].month
|
|
260
|
+
d["day"] = raw.info["meas_date"].day
|
|
261
261
|
|
|
262
262
|
# read info relevant for preprocessing from raw without loading it
|
|
263
263
|
if add_physician_reports:
|
|
@@ -269,12 +269,6 @@ 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
|
-
|
|
278
272
|
def _create_description(file_paths, version, ds_name):
|
|
279
273
|
descriptions = [
|
|
280
274
|
_parse_description_from_file_path(f, version, ds_name) for f in file_paths
|
|
@@ -295,8 +289,7 @@ def _read_date(file_path):
|
|
|
295
289
|
date_path = file_path.replace(".edf", "_date.txt")
|
|
296
290
|
# if date file exists, read it
|
|
297
291
|
if os.path.exists(date_path):
|
|
298
|
-
|
|
299
|
-
description = json.load(f)
|
|
292
|
+
description = pd.read_json(date_path, typ="series").to_dict()
|
|
300
293
|
# otherwise read edf file, extract date and store to file
|
|
301
294
|
else:
|
|
302
295
|
raw = mne.io.read_raw_edf(file_path, preload=False, verbose="error")
|