braindecode 1.8.1.dev168679286__tar.gz → 1.8.1.dev168760068__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.dev168679286 → braindecode-1.8.1.dev168760068}/NOTICE.txt +30 -2
- {braindecode-1.8.1.dev168679286/braindecode.egg-info → braindecode-1.8.1.dev168760068}/PKG-INFO +5 -1
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/augmentation/__init__.py +2 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/augmentation/transforms.py +185 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/classifier.py +9 -7
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/base.py +4 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/tuh.py +2 -1
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datautil/serialization.py +4 -1
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/eegneuralnet.py +1 -1
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/functional/__init__.py +4 -0
- braindecode-1.8.1.dev168760068/braindecode/functional/_real_dft.py +138 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/functional/functions.py +83 -6
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/__init__.py +43 -14
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/attn_sleep.py +0 -4
- braindecode-1.8.1.dev168760068/braindecode/models/axon.py +516 -0
- braindecode-1.8.1.dev168760068/braindecode/models/barista.py +703 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/base.py +127 -7
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/bendr.py +75 -63
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/biot.py +35 -61
- braindecode-1.8.1.dev168760068/braindecode/models/brainbert.py +447 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/brainmodule.py +6 -11
- braindecode-1.8.1.dev168760068/braindecode/models/brainomni.py +917 -0
- braindecode-1.8.1.dev168760068/braindecode/models/brant.py +479 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/cbramod.py +67 -26
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/codebrain.py +81 -76
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/config.py +1 -2
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/contrawr.py +4 -4
- braindecode-1.8.1.dev168760068/braindecode/models/csbrain.py +730 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/deep4.py +28 -12
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/dgcnn.py +3 -1
- braindecode-1.8.1.dev168760068/braindecode/models/diver1.py +948 -0
- braindecode-1.8.1.dev168760068/braindecode/models/eeg_clip.py +307 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/eegdino.py +34 -16
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/eeginception_mi.py +107 -11
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/eegpt.py +20 -29
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/eegsym.py +17 -7
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/emg2qwerty.py +19 -2
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/labram.py +325 -199
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/luna.py +70 -27
- braindecode-1.8.1.dev168760068/braindecode/models/mapa.py +862 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/meta_neuromotor.py +48 -25
- braindecode-1.8.1.dev168760068/braindecode/models/mirepnet.py +389 -0
- braindecode-1.8.1.dev168760068/braindecode/models/mscformer.py +502 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/msvtnet.py +4 -2
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/mvpformer.py +19 -7
- braindecode-1.8.1.dev168760068/braindecode/models/neurorvq.py +611 -0
- braindecode-1.8.1.dev168760068/braindecode/models/neurorvq_tokenizer.py +623 -0
- braindecode-1.8.1.dev168760068/braindecode/models/popt.py +324 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/reve.py +55 -64
- braindecode-1.8.1.dev168760068/braindecode/models/seizure_transformer.py +407 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/sensingdynamics.py +10 -5
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/shallow_fbcsp.py +15 -8
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/signal_jepa.py +96 -46
- braindecode-1.8.1.dev168760068/braindecode/models/sleepfm.py +776 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/sstdpn.py +13 -10
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/steegformer.py +76 -23
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/summary.csv +20 -5
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/syncnet.py +2 -2
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/tcformer.py +30 -52
- braindecode-1.8.1.dev168760068/braindecode/models/tfm_tokenizer.py +416 -0
- braindecode-1.8.1.dev168760068/braindecode/models/tmsanet.py +233 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/util.py +472 -86
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/zuna.py +44 -32
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/modules/__init__.py +6 -2
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/modules/attention.py +11 -5
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/modules/blocks.py +75 -11
- braindecode-1.8.1.dev168760068/braindecode/modules/channels.py +459 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/modules/convolution.py +25 -14
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/modules/filter.py +49 -31
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/modules/layers.py +4 -2
- braindecode-1.8.1.dev168760068/braindecode/modules/parametrization.py +91 -0
- braindecode-1.8.1.dev168760068/braindecode/modules/popt_modules.py +187 -0
- braindecode-1.8.1.dev168760068/braindecode/modules/quantization.py +411 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/modules/stats.py +6 -1
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/preprocessing/windowers.py +20 -5
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/regressor.py +41 -8
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/training/losses.py +7 -2
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/training/scoring.py +18 -9
- braindecode-1.8.1.dev168760068/braindecode/version.py +1 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/visualization/topology.py +1 -1
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068/braindecode.egg-info}/PKG-INFO +5 -1
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode.egg-info/SOURCES.txt +25 -3
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode.egg-info/requires.txt +5 -0
- braindecode-1.8.1.dev168760068/docs/agent_docs.rst +60 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/api.rst +54 -7
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/conf.py +7 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/index.rst +1 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/models/models_categorization.rst +10 -3
- braindecode-1.8.1.dev168760068/docs/user_guide/channel_strategies.rst +59 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/whats_new.rst +521 -2
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/pyproject.toml +6 -0
- braindecode-1.8.1.dev168679286/braindecode/models/interpolated.py +0 -185
- braindecode-1.8.1.dev168679286/braindecode/modules/interpolation.py +0 -201
- braindecode-1.8.1.dev168679286/braindecode/modules/parametrization.py +0 -38
- braindecode-1.8.1.dev168679286/braindecode/version.py +0 -1
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/LICENSE.txt +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/MANIFEST.in +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/README.rst +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/__init__.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/augmentation/base.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/augmentation/functional.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/__init__.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/_notebook_viewer.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/bbci.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/bcicomp.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/bids/__init__.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/bids/datasets.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/bids/format.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/bids/hub.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/bids/hub_format.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/bids/hub_io.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/bids/hub_validation.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/bids/iterable.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/chb_mit.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/collate.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/mne.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/moabb.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/nmt.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/registry.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/siena.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/sleep_physio_challe_18.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/sleep_physionet.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/utils.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/xy.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datautil/__init__.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datautil/channel_utils.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datautil/hub_formats.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datautil/util.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/functional/initialization.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/atcnet.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/attentionbasenet.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/ctnet.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/dance.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/deepsleepnet.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/eegconformer.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/eeginception_erp.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/eegitnet.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/eegminer.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/eegnet.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/eegnex.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/eegsimpleconv.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/eegtcnet.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/fbcnet.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/fblightconvnet.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/fbmsnet.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/hybrid.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/ifnet.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/medformer.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/neuropose.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/patchedtransformer.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/sccnet.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/sinc_shallow.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/sleep_stager_blanco_2020.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/sleep_stager_chambon_2018.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/sparcnet.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/tcn.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/tidnet.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/tsinception.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/usleep.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/models/vemg2pose.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/modules/activation.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/modules/dance_modules.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/modules/linear.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/modules/util.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/modules/wrapper.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/preprocessing/__init__.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/preprocessing/eegprep_preprocess.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/preprocessing/mne_preprocess.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/preprocessing/preprocess.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/preprocessing/util.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/samplers/__init__.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/samplers/base.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/samplers/ssl.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/training/__init__.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/training/callbacks.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/util.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/visualization/__init__.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/visualization/activations.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/visualization/attribution.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/visualization/confusion_matrices.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/visualization/frequency.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/visualization/metrics.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/visualization/sanity.py +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode.egg-info/dependency_links.txt +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode.egg-info/top_level.txt +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/Makefile +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/_templates/autosummary/class.rst +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/_templates/autosummary/class_in_subdir.rst +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/_templates/autosummary/function.rst +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/_templates/autosummary/function_in_subdir.rst +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/cite.rst +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/help.rst +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/install/install.rst +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/install/install_pip.rst +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/install/install_source.rst +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/models/categorization/attention.rst +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/models/categorization/channel.rst +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/models/categorization/convolution.rst +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/models/categorization/filterbank.rst +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/models/categorization/gnn.rst +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/models/categorization/interpretable.rst +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/models/categorization/lbm.rst +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/models/categorization/recurrent.rst +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/models/categorization/spd.rst +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/models/models.rst +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/models/models_table.rst +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/models/models_visualization.rst +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/docs/sg_execution_times.rst +0 -0
- {braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/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,
|
|
@@ -42,14 +43,40 @@ The following components are licensed under the MIT License:
|
|
|
42
43
|
- `braindecode/models/medformer.py`
|
|
43
44
|
- `braindecode/models/tcformer.py`
|
|
44
45
|
- `braindecode/models/ifnet.py`
|
|
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/models/seizure_transformer.py`
|
|
53
|
+
- `docs/_static/model/seizure_transformer_arch.png`
|
|
54
|
+
- `braindecode/models/tmsanet.py`
|
|
55
|
+
|
|
56
|
+
The `brainomni.py` file is a derivative of `OpenTSLab/BrainOmni` (MIT), whose
|
|
57
|
+
SEANet codec derives from Meta's `facebookresearch/encodec` (MIT). The
|
|
58
|
+
`quantization.py` module holds the residual vector quantization derived from
|
|
59
|
+
`lucidrains/vector-quantize-pytorch` (MIT) and the BrainOmni port.
|
|
45
60
|
|
|
46
61
|
### Apache-2.0 Licensed Files
|
|
47
62
|
|
|
48
63
|
The following components are licensed under the Apache License 2.0:
|
|
49
64
|
|
|
65
|
+
- `braindecode/models/axon.py`
|
|
50
66
|
- `braindecode/models/mvpformer.py`
|
|
51
67
|
- `braindecode/models/zuna.py`
|
|
52
68
|
- `braindecode/models/luna.py`
|
|
69
|
+
- `braindecode/models/mapa.py`
|
|
70
|
+
- `braindecode/models/brant.py`
|
|
71
|
+
- `braindecode/models/diver1.py`
|
|
72
|
+
- `braindecode/models/mscformer.py`
|
|
73
|
+
|
|
74
|
+
### USC Academic License Files
|
|
75
|
+
|
|
76
|
+
[License](https://github.com/ShanechiLab/BaRISTA/blob/master/LICENSE.md)
|
|
77
|
+
|
|
78
|
+
- `braindecode/models/barista.py`
|
|
79
|
+
- `docs/_static/model/barista.jpeg`
|
|
53
80
|
|
|
54
81
|
## License Links
|
|
55
82
|
|
|
@@ -58,6 +85,7 @@ The following components are licensed under the Apache License 2.0:
|
|
|
58
85
|
- [CC BY-NC-SA 4.0 License](https://creativecommons.org/licenses/by-nc-sa/4.0/)
|
|
59
86
|
- [MIT License](https://opensource.org/licenses/MIT)
|
|
60
87
|
- [Apache-2.0 License](https://www.apache.org/licenses/LICENSE-2.0)
|
|
88
|
+
- [USC Academic License](https://github.com/ShanechiLab/BaRISTA/blob/master/LICENSE.md)
|
|
61
89
|
|
|
62
90
|
## Note
|
|
63
91
|
|
{braindecode-1.8.1.dev168679286/braindecode.egg-info → braindecode-1.8.1.dev168760068}/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.dev168760068
|
|
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",
|
|
@@ -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.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/base.py
RENAMED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
# Simon Brandt <simonbrandt@protonmail.com>
|
|
6
6
|
# David Sabbagh <dav.sabbagh@gmail.com>
|
|
7
7
|
# Robin Schirrmeister <robintibor@gmail.com>
|
|
8
|
+
# Sarthak Tayal <sarthaktayal2@gmail.com>
|
|
8
9
|
#
|
|
9
10
|
# License: BSD (3-clause)
|
|
10
11
|
|
|
@@ -1398,6 +1399,9 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1398
1399
|
df = ds._windows.metadata
|
|
1399
1400
|
else:
|
|
1400
1401
|
df = ds.metadata
|
|
1402
|
+
if isinstance(df, pd.DataFrame):
|
|
1403
|
+
# copy so the description columns stay out of the dataset
|
|
1404
|
+
df = df.copy()
|
|
1401
1405
|
for k, v in ds.description.items():
|
|
1402
1406
|
df[k] = v
|
|
1403
1407
|
all_dfs.append(df)
|
{braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/datasets/tuh.py
RENAMED
|
@@ -815,7 +815,8 @@ def _get_header(*args, **kwargs):
|
|
|
815
815
|
for paths_dict in [_TUH_EEG_PATHS, _TUH_EEG_ABNORMAL_PATHS, _TUH_EEG_EVENTS_PATHS]:
|
|
816
816
|
for version_dict in paths_dict.values():
|
|
817
817
|
all_paths.update(version_dict)
|
|
818
|
-
|
|
818
|
+
# Mock keys use POSIX separators; pathlib emits backslashes on Windows.
|
|
819
|
+
return all_paths[os.fspath(args[0]).replace("\\", "/")]
|
|
819
820
|
|
|
820
821
|
|
|
821
822
|
_TUH_EEG_PATHS = {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Convenience functions for storing and loading of windows datasets."""
|
|
2
2
|
|
|
3
3
|
# Authors: Lukas Gemein <l.gemein@gmail.com>
|
|
4
|
+
# Sarthak Tayal <sarthaktayal2@gmail.com>
|
|
4
5
|
#
|
|
5
6
|
# License: BSD (3-clause)
|
|
6
7
|
|
|
@@ -270,7 +271,9 @@ def _load_parallel(path, i, preload, is_raw, has_stored_windows):
|
|
|
270
271
|
else:
|
|
271
272
|
window_kwargs = _load_kwargs_json("window_kwargs", sub_dir)
|
|
272
273
|
windows_ds_kwargs = [
|
|
273
|
-
kwargs[1]
|
|
274
|
+
kwargs[1]
|
|
275
|
+
for kwargs in window_kwargs
|
|
276
|
+
if kwargs[0] in ("WindowsDataset", "EEGWindowsDataset")
|
|
274
277
|
]
|
|
275
278
|
windows_ds_kwargs = windows_ds_kwargs[0] if len(windows_ds_kwargs) == 1 else {}
|
|
276
279
|
if is_raw:
|
{braindecode-1.8.1.dev168679286 → braindecode-1.8.1.dev168760068}/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.dev168679286 → braindecode-1.8.1.dev168760068}/braindecode/functional/__init__.py
RENAMED
|
@@ -8,8 +8,10 @@ from .functions import (
|
|
|
8
8
|
iou_1d,
|
|
9
9
|
pairwise_iou_1d,
|
|
10
10
|
plv_time,
|
|
11
|
+
rotate_pairs,
|
|
11
12
|
safe_log,
|
|
12
13
|
sinusoidal_positional_encoding,
|
|
14
|
+
spectral_input,
|
|
13
15
|
square,
|
|
14
16
|
wavelet_decomposition,
|
|
15
17
|
)
|
|
@@ -25,8 +27,10 @@ __all__ = [
|
|
|
25
27
|
"iou_1d",
|
|
26
28
|
"pairwise_iou_1d",
|
|
27
29
|
"plv_time",
|
|
30
|
+
"rotate_pairs",
|
|
28
31
|
"safe_log",
|
|
29
32
|
"sinusoidal_positional_encoding",
|
|
33
|
+
"spectral_input",
|
|
30
34
|
"square",
|
|
31
35
|
"wavelet_decomposition",
|
|
32
36
|
"glorot_weight_zero_bias",
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"""Real-valued DFT helpers for accelerators without complex tensors.
|
|
2
|
+
|
|
3
|
+
Intel Gaudi (HPU) has no complex dtype, so ``torch.fft`` with complex outputs
|
|
4
|
+
cannot run there. These helpers express the one-sided DFT, and the inverse
|
|
5
|
+
transforms built on top of it, as matmuls against a cosine/sine basis. Under
|
|
6
|
+
bfloat16 autocast those matmuls would run in bfloat16, whereas ``torch.fft`` is
|
|
7
|
+
never downcast, so callers wrap the numerically sensitive parts with
|
|
8
|
+
:func:`fp32_island`.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
# Authors: Bruno Aristimunha <b.aristimunha@gmail.com>
|
|
12
|
+
#
|
|
13
|
+
# License: BSD (3-clause)
|
|
14
|
+
import functools
|
|
15
|
+
|
|
16
|
+
import torch
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def needs_real_dft(x: torch.Tensor) -> bool:
|
|
20
|
+
"""Whether ``x`` lives on a device without complex-tensor FFT support."""
|
|
21
|
+
return x.device.type == "hpu"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def fp32_island(fn):
|
|
25
|
+
"""Run ``fn`` with autocast disabled, in at least float32 precision.
|
|
26
|
+
|
|
27
|
+
Any bfloat16/float16 tensor argument is upcast to float32 before ``fn``
|
|
28
|
+
runs; float32 and float64 arguments are left untouched, so the same code
|
|
29
|
+
path can also be checked against a float64 ``torch.fft`` reference.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
@functools.wraps(fn)
|
|
33
|
+
def wrapped(*args, **kwargs):
|
|
34
|
+
ref = next(a for a in args if isinstance(a, torch.Tensor))
|
|
35
|
+
with torch.autocast(device_type=ref.device.type, enabled=False):
|
|
36
|
+
args = tuple(
|
|
37
|
+
a.float()
|
|
38
|
+
if isinstance(a, torch.Tensor)
|
|
39
|
+
and a.is_floating_point()
|
|
40
|
+
and torch.finfo(a.dtype).bits < 32
|
|
41
|
+
else a
|
|
42
|
+
for a in args
|
|
43
|
+
)
|
|
44
|
+
return fn(*args, **kwargs)
|
|
45
|
+
|
|
46
|
+
return wrapped
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def real_dft_basis(n, *, device, dtype):
|
|
50
|
+
"""One-sided cosine/sine basis of an ``n``-point DFT, shape ``(n // 2 + 1, n)``.
|
|
51
|
+
|
|
52
|
+
The phase index is reduced modulo ``n`` in integers before scaling, so the
|
|
53
|
+
DC row is exact (``sin`` is exactly zero there); the Nyquist row (present
|
|
54
|
+
for even ``n``) is exact to floating-point precision.
|
|
55
|
+
"""
|
|
56
|
+
if n <= 0:
|
|
57
|
+
raise ValueError("n must be positive")
|
|
58
|
+
if (n // 2) * (n - 1) >= 2**31:
|
|
59
|
+
# The int32 phase index below would overflow and give wrong phases.
|
|
60
|
+
raise ValueError(f"n={n} exceeds the 65536 samples of the real-valued DFT")
|
|
61
|
+
freqs = torch.arange(n // 2 + 1, device=device, dtype=torch.int32)
|
|
62
|
+
samples = torch.arange(n, device=device, dtype=torch.int32)
|
|
63
|
+
phase_index = (freqs[:, None] * samples[None, :]) % n
|
|
64
|
+
angles = 2 * torch.pi * phase_index.to(dtype) / n
|
|
65
|
+
return angles.cos(), angles.sin()
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def real_rfft(x):
|
|
69
|
+
"""Real and imaginary parts of ``torch.fft.rfft(x, dim=-1)`` without complex tensors."""
|
|
70
|
+
n = x.shape[-1]
|
|
71
|
+
cosine, sine = real_dft_basis(n, device=x.device, dtype=x.dtype)
|
|
72
|
+
return x @ cosine.transpose(0, 1), -(x @ sine.transpose(0, 1))
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def real_irfft(real, imag, *, n):
|
|
76
|
+
"""``torch.fft.irfft(torch.complex(real, imag), n=n, dim=-1)`` without complex tensors."""
|
|
77
|
+
if real.shape[-1] != n // 2 + 1:
|
|
78
|
+
raise ValueError(
|
|
79
|
+
f"expected {n // 2 + 1} one-sided bins for n={n}, got {real.shape[-1]}"
|
|
80
|
+
)
|
|
81
|
+
cosine, sine = real_dft_basis(n, device=real.device, dtype=real.dtype)
|
|
82
|
+
output = real[..., :1] @ cosine[:1, :]
|
|
83
|
+
if n % 2 == 0:
|
|
84
|
+
interior = slice(1, -1)
|
|
85
|
+
output = output + real[..., -1:] @ cosine[-1:, :]
|
|
86
|
+
else:
|
|
87
|
+
interior = slice(1, None)
|
|
88
|
+
if real.shape[-1] > (2 if n % 2 == 0 else 1):
|
|
89
|
+
output = output + 2 * (
|
|
90
|
+
real[..., interior] @ cosine[interior, :]
|
|
91
|
+
- imag[..., interior] @ sine[interior, :]
|
|
92
|
+
)
|
|
93
|
+
return output / n
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def real_analytic_ifft(real, imag, *, n):
|
|
97
|
+
"""Inverse ``n``-point FFT of a one-sided spectrum, without complex tensors.
|
|
98
|
+
|
|
99
|
+
``real``/``imag`` hold the bins ``0 .. n // 2`` of a length-``n`` spectrum
|
|
100
|
+
whose remaining (negative-frequency) bins are zero, so this is a plain
|
|
101
|
+
(non-Hermitian) inverse DFT, not :func:`real_irfft`. Returns the real and
|
|
102
|
+
imaginary parts of the generally complex time-domain signal, each of shape
|
|
103
|
+
``(..., n)``. This is the last step of :func:`hilbert_freq_real`.
|
|
104
|
+
"""
|
|
105
|
+
if real.shape[-1] != n // 2 + 1:
|
|
106
|
+
raise ValueError(
|
|
107
|
+
f"expected {n // 2 + 1} one-sided bins for n={n}, got {real.shape[-1]}"
|
|
108
|
+
)
|
|
109
|
+
cosine, sine = real_dft_basis(n, device=real.device, dtype=real.dtype)
|
|
110
|
+
out_real = (real @ cosine - imag @ sine) / n
|
|
111
|
+
out_imag = (real @ sine + imag @ cosine) / n
|
|
112
|
+
return out_real, out_imag
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
@torch.jit.unused
|
|
116
|
+
def hilbert_freq_real(x: torch.Tensor, forward_fourier: bool) -> torch.Tensor:
|
|
117
|
+
"""Real-valued equivalent of :func:`braindecode.functional.hilbert_freq`.
|
|
118
|
+
|
|
119
|
+
Lives here rather than in ``functions.py`` because ``torch.jit.unused`` needs
|
|
120
|
+
real annotations, and ``functions.py`` uses ``from __future__ import annotations``.
|
|
121
|
+
"""
|
|
122
|
+
|
|
123
|
+
@fp32_island
|
|
124
|
+
def compute(x):
|
|
125
|
+
if forward_fourier:
|
|
126
|
+
seq_len = x.shape[-1]
|
|
127
|
+
real, imag = real_rfft(x)
|
|
128
|
+
else:
|
|
129
|
+
seq_len = 2 * (x.shape[-2] - 1)
|
|
130
|
+
real, imag = x[..., 0], x[..., 1]
|
|
131
|
+
scale = torch.full((real.shape[-1],), 2.0, dtype=real.dtype, device=real.device)
|
|
132
|
+
scale[0] = 1.0 # Don't multiply the DC-term by 2
|
|
133
|
+
if forward_fourier and seq_len % 2 == 0:
|
|
134
|
+
scale[-1] = 1.0 # Nor the Nyquist term, which only exists for even lengths
|
|
135
|
+
out_real, out_imag = real_analytic_ifft(real * scale, imag * scale, n=seq_len)
|
|
136
|
+
return torch.stack((out_real, out_imag), dim=-1)
|
|
137
|
+
|
|
138
|
+
return compute(x)
|