braindecode 2.1.0.dev179666547__tar.gz → 2.1.0.dev180711956__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-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/NOTICE.txt +3 -0
- {braindecode-2.1.0.dev179666547/braindecode.egg-info → braindecode-2.1.0.dev180711956}/PKG-INFO +2 -1
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/augmentation/base.py +43 -14
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/augmentation/functional.py +0 -2
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/augmentation/transforms.py +17 -17
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/classifier.py +11 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/base.py +67 -34
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/bids/hub.py +2 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/tuh.py +31 -19
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/utils.py +15 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datautil/hub_formats.py +76 -15
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datautil/util.py +50 -12
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/functional/__init__.py +2 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/functional/_real_dft.py +4 -4
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/functional/channel_mask.py +27 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/functional/functions.py +55 -33
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/functional/patches.py +17 -9
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/__init__.py +3 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/axon.py +9 -1
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/base.py +50 -13
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/bbl.py +16 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/bendr.py +8 -1
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/brainomni.py +63 -1
- braindecode-2.1.0.dev180711956/braindecode/models/caresleepnet.py +356 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/cbramod.py +18 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/codebrain.py +10 -1
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/corteg.py +18 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/csbrain.py +32 -1
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/duin.py +8 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/eeg_clip.py +27 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/eegpt.py +8 -1
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/geonirs.py +18 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/jung_mae.py +28 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/mapa.py +28 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/medformer.py +16 -1
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/meggpt.py +33 -1
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/megxl.py +28 -3
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/mirepnet.py +8 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/mtrenirs.py +18 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/neurorvq.py +25 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/neurorvq_tokenizer.py +16 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/patchedtransformer.py +20 -3
- braindecode-2.1.0.dev180711956/braindecode/models/pratibha2.py +518 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/reve.py +24 -2
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/signal_jepa.py +29 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/sleepfm.py +7 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/summary.csv +3 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/tfm_tokenizer.py +11 -0
- braindecode-2.1.0.dev180711956/braindecode/models/tinymyo.py +367 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/util.py +29 -1
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/zuna.py +8 -1
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/modules/attention.py +45 -1
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/modules/blocks.py +15 -35
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/modules/filter.py +54 -24
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/modules/quantization.py +19 -9
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/training/losses.py +48 -17
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/util.py +8 -8
- braindecode-2.1.0.dev180711956/braindecode/version.py +1 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956/braindecode.egg-info}/PKG-INFO +2 -1
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode.egg-info/SOURCES.txt +3 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode.egg-info/requires.txt +1 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/api.rst +5 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/user_guide/channel_strategies.rst +12 -3
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/whats_new.rst +163 -2
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/pyproject.toml +1 -1
- braindecode-2.1.0.dev179666547/braindecode/version.py +0 -1
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/LICENSE.txt +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/MANIFEST.in +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/README.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/__init__.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/augmentation/__init__.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/__init__.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/_notebook_viewer.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/bbci.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/bcicomp.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/bids/__init__.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/bids/datasets.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/bids/hub_format.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/bids/hub_io.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/bids/hub_validation.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/bids/iterable.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/chb_mit.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/collate.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/mne.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/moabb.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/nmt.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/registry.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/siena.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/sleep_physio_challe_18.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/sleep_physionet.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/xy.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datautil/__init__.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datautil/channel_utils.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datautil/serialization.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/eegneuralnet.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/functional/_lfilter.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/functional/attention.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/functional/channels.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/functional/initialization.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/atcnet.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/attentionbasenet.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/attn_sleep.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/barista.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/biot.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/brainbert.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/brainmodule.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/brant.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/config.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/contrawr.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/ctnet.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/dance.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/deep4.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/deepsleepnet.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/dgcnn.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/diver1.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/eegconformer.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/eegdino.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/eeginception_erp.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/eeginception_mi.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/eegitnet.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/eegminer.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/eegnet.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/eegnex.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/eegsimpleconv.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/eegsym.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/eegtcnet.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/emg2qwerty.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/epint.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/fbcnet.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/fblightconvnet.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/fbmsnet.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/fnirs4d.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/fnirs_cnn1d.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/fnirs_t.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/fnirsnet.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/gcnsnet.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/guetschel2026.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/hybrid.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/ifnet.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/labram.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/luna.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/meta_neuromotor.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/model.html.jinja +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/mscformer.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/msvtnet.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/mvpformer.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/neuropose.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/nice.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/popt.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/sccnet.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/seizure_transformer.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/sensingdynamics.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/shallow_fbcsp.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/sinc_shallow.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/sleep_stager_blanco_2020.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/sleep_stager_chambon_2018.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/sparcnet.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/sstdpn.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/steegformer.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/syncnet.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/tccnet.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/tcformer.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/tcn.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/tidnet.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/tmsanet.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/tsinception.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/usleep.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/models/vemg2pose.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/modules/__init__.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/modules/activation.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/modules/channels.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/modules/convolution.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/modules/dance_modules.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/modules/layers.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/modules/linear.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/modules/linear_attention.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/modules/parametrization.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/modules/seanet.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/modules/stats.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/modules/util.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/modules/wrapper.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/preprocessing/__init__.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/preprocessing/eegprep_preprocess.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/preprocessing/mne_preprocess.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/preprocessing/preprocess.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/preprocessing/util.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/preprocessing/windowers.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/regressor.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/samplers/__init__.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/samplers/base.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/samplers/ssl.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/training/__init__.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/training/_trial_aggregation.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/training/callbacks.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/training/scoring.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/visualization/__init__.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/visualization/activations.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/visualization/attribution.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/visualization/confusion_matrices.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/visualization/frequency.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/visualization/metrics.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/visualization/sanity.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/visualization/topology.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode.egg-info/dependency_links.txt +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode.egg-info/top_level.txt +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/Makefile +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/_templates/autosummary/class.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/_templates/autosummary/class_in_subdir.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/_templates/autosummary/function.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/_templates/autosummary/function_in_subdir.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/agent_docs.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/cite.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/conf.py +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/help.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/index.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/install/gaudi.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/install/install.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/install/install_pip.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/install/install_source.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/models/categorization/attention.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/models/categorization/channel.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/models/categorization/convolution.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/models/categorization/filterbank.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/models/categorization/gnn.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/models/categorization/interpretable.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/models/categorization/lbm.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/models/categorization/recurrent.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/models/categorization/spd.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/models/models.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/models/models_categorization.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/models/models_table.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/models/models_visualization.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/sg_execution_times.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/docs/user_guide/cropped_inference.rst +0 -0
- {braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/setup.cfg +0 -0
|
@@ -38,6 +38,7 @@ same noncommercial ShareAlike terms.
|
|
|
38
38
|
|
|
39
39
|
The following components are licensed under the MIT License:
|
|
40
40
|
|
|
41
|
+
- `braindecode/models/caresleepnet.py`
|
|
41
42
|
- `braindecode/models/ctnet.py`
|
|
42
43
|
- `braindecode/models/dance.py`
|
|
43
44
|
- `braindecode/models/duin.py`
|
|
@@ -84,9 +85,11 @@ whose average-over-time and context-attention layers come from
|
|
|
84
85
|
The following components are licensed under the Apache License 2.0:
|
|
85
86
|
|
|
86
87
|
- `braindecode/models/axon.py`
|
|
88
|
+
- `braindecode/models/pratibha2.py`
|
|
87
89
|
- `braindecode/models/mvpformer.py`
|
|
88
90
|
- `braindecode/models/zuna.py`
|
|
89
91
|
- `braindecode/models/luna.py`
|
|
92
|
+
- `braindecode/models/tinymyo.py`
|
|
90
93
|
- `braindecode/models/mapa.py`
|
|
91
94
|
- `braindecode/models/brant.py`
|
|
92
95
|
- `braindecode/models/diver1.py`
|
{braindecode-2.1.0.dev179666547/braindecode.egg-info → braindecode-2.1.0.dev180711956}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: braindecode
|
|
3
|
-
Version: 2.1.0.
|
|
3
|
+
Version: 2.1.0.dev180711956
|
|
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,7 @@ Requires-Dist: torch>=2.7; python_version < "3.12" and extra == "eegprep"
|
|
|
44
44
|
Provides-Extra: hub
|
|
45
45
|
Requires-Dist: huggingface_hub[torch]>=0.20.0; extra == "hub"
|
|
46
46
|
Requires-Dist: zarr>=3.1; extra == "hub"
|
|
47
|
+
Requires-Dist: filelock; extra == "hub"
|
|
47
48
|
Provides-Extra: viz
|
|
48
49
|
Requires-Dist: captum>=0.7.0; extra == "viz"
|
|
49
50
|
Provides-Extra: sae
|
{braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/augmentation/base.py
RENAMED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
# License: BSD (3-clause)
|
|
8
8
|
|
|
9
9
|
from numbers import Real
|
|
10
|
-
from typing import Any, Callable,
|
|
10
|
+
from typing import Any, Callable, TypeGuard, Union
|
|
11
11
|
|
|
12
12
|
import numpy as np
|
|
13
13
|
import torch
|
|
@@ -52,6 +52,7 @@ class Transform(torch.nn.Module):
|
|
|
52
52
|
"""
|
|
53
53
|
|
|
54
54
|
operation: Operation
|
|
55
|
+
signal_only = False
|
|
55
56
|
|
|
56
57
|
def __init__(self, probability=1.0, random_state=None):
|
|
57
58
|
super().__init__()
|
|
@@ -70,15 +71,19 @@ class Transform(torch.nn.Module):
|
|
|
70
71
|
def get_augmentation_params(self, *batch):
|
|
71
72
|
return dict()
|
|
72
73
|
|
|
73
|
-
def forward(
|
|
74
|
+
def forward(
|
|
75
|
+
self, X: Tensor, y: Union[Tensor, tuple[Tensor, ...], list[Tensor], None] = None
|
|
76
|
+
) -> Output:
|
|
74
77
|
"""General forward pass for an augmentation transform.
|
|
75
78
|
|
|
76
79
|
Parameters
|
|
77
80
|
----------
|
|
78
81
|
X : torch.Tensor
|
|
79
82
|
EEG input example or batch.
|
|
80
|
-
y : torch.Tensor | None
|
|
81
|
-
EEG labels for the example or batch.
|
|
83
|
+
y : torch.Tensor | tuple of torch.Tensor | None
|
|
84
|
+
EEG labels for the example or batch. Transforms that operate
|
|
85
|
+
independently of the labels can set ``signal_only = True`` to
|
|
86
|
+
accept the ``(y_a, y_b, lam)`` target from Mixup or CutMix.
|
|
82
87
|
|
|
83
88
|
Returns
|
|
84
89
|
-------
|
|
@@ -88,6 +93,17 @@ class Transform(torch.nn.Module):
|
|
|
88
93
|
Transformed labels. Only returned when y is not None.
|
|
89
94
|
"""
|
|
90
95
|
X = torch.as_tensor(X).float()
|
|
96
|
+
mixed_target = None
|
|
97
|
+
if _is_mixed_target(y):
|
|
98
|
+
if not self.signal_only:
|
|
99
|
+
raise ValueError(
|
|
100
|
+
f"{type(self).__name__} requires a single target tensor. "
|
|
101
|
+
"Apply label-dependent transforms before Mixup or CutMix, "
|
|
102
|
+
"or set ``signal_only = True`` on transforms that leave the "
|
|
103
|
+
"target unchanged."
|
|
104
|
+
)
|
|
105
|
+
mixed_target = tuple(part.to(X.device) for part in y)
|
|
106
|
+
y = None
|
|
91
107
|
|
|
92
108
|
out_X = X.clone()
|
|
93
109
|
# check if input has a batch dimension
|
|
@@ -95,8 +111,7 @@ class Transform(torch.nn.Module):
|
|
|
95
111
|
out_X = out_X[None, ...]
|
|
96
112
|
|
|
97
113
|
if y is not None:
|
|
98
|
-
|
|
99
|
-
out_y = y.clone()
|
|
114
|
+
out_y = torch.as_tensor(y, device=out_X.device).clone()
|
|
100
115
|
if len(out_y.shape) == 0:
|
|
101
116
|
out_y = out_y.reshape(1)
|
|
102
117
|
else:
|
|
@@ -130,6 +145,8 @@ class Transform(torch.nn.Module):
|
|
|
130
145
|
|
|
131
146
|
# potentially remove empty batch dimension again
|
|
132
147
|
out_X = out_X.reshape_as(X)
|
|
148
|
+
if mixed_target is not None:
|
|
149
|
+
return out_X, mixed_target
|
|
133
150
|
if y is not None:
|
|
134
151
|
return out_X, out_y
|
|
135
152
|
else:
|
|
@@ -146,7 +163,13 @@ class Transform(torch.nn.Module):
|
|
|
146
163
|
return self._probability
|
|
147
164
|
|
|
148
165
|
|
|
149
|
-
class
|
|
166
|
+
class _SignalTransform(Transform):
|
|
167
|
+
"""Augment the signal without consulting or changing its target."""
|
|
168
|
+
|
|
169
|
+
signal_only = True
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
class IdentityTransform(_SignalTransform):
|
|
150
173
|
"""Identity transform.
|
|
151
174
|
|
|
152
175
|
Transform that does not change the input.
|
|
@@ -165,7 +188,9 @@ class Compose(Transform):
|
|
|
165
188
|
Parameters
|
|
166
189
|
----------
|
|
167
190
|
transforms : list
|
|
168
|
-
Sequence of Transforms to be composed.
|
|
191
|
+
Sequence of Transforms to be composed. Signal-only transforms may
|
|
192
|
+
follow Mixup or CutMix. Apply transforms that use or change labels
|
|
193
|
+
before mixing.
|
|
169
194
|
"""
|
|
170
195
|
|
|
171
196
|
def __init__(self, transforms):
|
|
@@ -184,9 +209,17 @@ class Compose(Transform):
|
|
|
184
209
|
return X, y
|
|
185
210
|
|
|
186
211
|
|
|
212
|
+
def _is_mixed_target(y: object) -> TypeGuard[tuple[Tensor, ...] | list[Tensor]]:
|
|
213
|
+
return (
|
|
214
|
+
isinstance(y, (tuple, list))
|
|
215
|
+
and len(y) == 3
|
|
216
|
+
and all(isinstance(part, Tensor) and part.ndim > 0 for part in y)
|
|
217
|
+
)
|
|
218
|
+
|
|
219
|
+
|
|
187
220
|
def _as_mixed_target(y, lam_dtype):
|
|
188
221
|
# an untouched target is the same as being mixed with itself with lam of one
|
|
189
|
-
if
|
|
222
|
+
if _is_mixed_target(y):
|
|
190
223
|
return tuple(y)
|
|
191
224
|
lam = torch.ones(y.shape[0], device=y.device, dtype=lam_dtype)
|
|
192
225
|
return y, y, lam
|
|
@@ -317,11 +350,7 @@ class _AugmentationCollate:
|
|
|
317
350
|
aug_X, aug_y = self.transform(X, y)
|
|
318
351
|
xs.append(aug_X)
|
|
319
352
|
ys.append(aug_y)
|
|
320
|
-
mixed_ys = [
|
|
321
|
-
aug_y
|
|
322
|
-
for aug_y in ys
|
|
323
|
-
if isinstance(aug_y, (tuple, list)) and len(aug_y) == 3
|
|
324
|
-
]
|
|
353
|
+
mixed_ys = [aug_y for aug_y in ys if _is_mixed_target(aug_y)]
|
|
325
354
|
_assert_stackable(xs, "X")
|
|
326
355
|
if mixed_ys:
|
|
327
356
|
# a target-mixing transform such as Mixup returns (y_a, y_b, lam),
|
|
@@ -206,8 +206,6 @@ def ft_surrogate(
|
|
|
206
206
|
device=device,
|
|
207
207
|
random_state=random_state,
|
|
208
208
|
)
|
|
209
|
-
if not channel_indep:
|
|
210
|
-
random_phase = torch.tile(random_phase, (1, f.shape[-2], 1))
|
|
211
209
|
if isinstance(phase_noise_magnitude, torch.Tensor):
|
|
212
210
|
phase_noise_magnitude = phase_noise_magnitude.to(device)
|
|
213
211
|
f_shifted = f * torch.exp(phase_noise_magnitude * random_phase)
|
|
@@ -16,7 +16,7 @@ from mne.channels import make_standard_montage
|
|
|
16
16
|
|
|
17
17
|
from braindecode.util import resolve_montage_name
|
|
18
18
|
|
|
19
|
-
from .base import Transform
|
|
19
|
+
from .base import Transform, _SignalTransform
|
|
20
20
|
from .functional import (
|
|
21
21
|
_max_float_dtype,
|
|
22
22
|
amplitude_scale,
|
|
@@ -41,7 +41,7 @@ from .functional import (
|
|
|
41
41
|
)
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
class TimeReverse(
|
|
44
|
+
class TimeReverse(_SignalTransform):
|
|
45
45
|
"""Flip the time axis of each input with a given probability.
|
|
46
46
|
|
|
47
47
|
Parameters
|
|
@@ -67,7 +67,7 @@ class TimeReverse(Transform):
|
|
|
67
67
|
)
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
class SignFlip(
|
|
70
|
+
class SignFlip(_SignalTransform):
|
|
71
71
|
"""Flip the sign axis of each input with a given probability.
|
|
72
72
|
|
|
73
73
|
Parameters
|
|
@@ -86,7 +86,7 @@ class SignFlip(Transform):
|
|
|
86
86
|
super().__init__(probability=probability, random_state=random_state)
|
|
87
87
|
|
|
88
88
|
|
|
89
|
-
class FTSurrogate(
|
|
89
|
+
class FTSurrogate(_SignalTransform):
|
|
90
90
|
"""FT surrogate augmentation of a single EEG channel, as proposed in [1]_.
|
|
91
91
|
|
|
92
92
|
Parameters
|
|
@@ -163,7 +163,7 @@ class FTSurrogate(Transform):
|
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
|
|
166
|
-
class ChannelsDropout(
|
|
166
|
+
class ChannelsDropout(_SignalTransform):
|
|
167
167
|
"""Randomly set channels to flat signal.
|
|
168
168
|
|
|
169
169
|
Part of the CMSAugment policy proposed in [1]_
|
|
@@ -220,7 +220,7 @@ class ChannelsDropout(Transform):
|
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
|
|
223
|
-
class ChannelsShuffle(
|
|
223
|
+
class ChannelsShuffle(_SignalTransform):
|
|
224
224
|
"""Randomly shuffle channels in EEG data matrix.
|
|
225
225
|
|
|
226
226
|
Part of the CMSAugment policy proposed in [1]_
|
|
@@ -278,7 +278,7 @@ class ChannelsShuffle(Transform):
|
|
|
278
278
|
}
|
|
279
279
|
|
|
280
280
|
|
|
281
|
-
class GaussianNoise(
|
|
281
|
+
class GaussianNoise(_SignalTransform):
|
|
282
282
|
"""Randomly add white noise to all channels.
|
|
283
283
|
|
|
284
284
|
Suggested e.g. in [1]_, [2]_ and [3]_
|
|
@@ -342,7 +342,7 @@ class GaussianNoise(Transform):
|
|
|
342
342
|
}
|
|
343
343
|
|
|
344
344
|
|
|
345
|
-
class ChannelsSymmetry(
|
|
345
|
+
class ChannelsSymmetry(_SignalTransform):
|
|
346
346
|
"""Permute EEG channels inverting left and right-side sensors.
|
|
347
347
|
|
|
348
348
|
Suggested e.g. in [1]_
|
|
@@ -417,7 +417,7 @@ class ChannelsSymmetry(Transform):
|
|
|
417
417
|
return {"permutation": self.permutation}
|
|
418
418
|
|
|
419
419
|
|
|
420
|
-
class SmoothTimeMask(
|
|
420
|
+
class SmoothTimeMask(_SignalTransform):
|
|
421
421
|
"""Smoothly replace a randomly chosen contiguous part of all channels by.
|
|
422
422
|
|
|
423
423
|
zeros.
|
|
@@ -504,7 +504,7 @@ class SmoothTimeMask(Transform):
|
|
|
504
504
|
}
|
|
505
505
|
|
|
506
506
|
|
|
507
|
-
class BandstopFilter(
|
|
507
|
+
class BandstopFilter(_SignalTransform):
|
|
508
508
|
"""Apply a band-stop filter with desired bandwidth at a randomly selected.
|
|
509
509
|
|
|
510
510
|
frequency position between 0 and ``max_freq``.
|
|
@@ -621,7 +621,7 @@ class BandstopFilter(Transform):
|
|
|
621
621
|
}
|
|
622
622
|
|
|
623
623
|
|
|
624
|
-
class FrequencyShift(
|
|
624
|
+
class FrequencyShift(_SignalTransform):
|
|
625
625
|
"""Add a random shift in the frequency domain to all channels.
|
|
626
626
|
|
|
627
627
|
Note that here, the shift is the same for all channels of a single example.
|
|
@@ -722,7 +722,7 @@ def _get_standard_10_20_positions(raw_or_epoch=None, ordered_ch_names=None):
|
|
|
722
722
|
return np.stack(list(positions_subdict.values())).T
|
|
723
723
|
|
|
724
724
|
|
|
725
|
-
class SensorsRotation(
|
|
725
|
+
class SensorsRotation(_SignalTransform):
|
|
726
726
|
"""Interpolates EEG signals over sensors rotated around the desired axis.
|
|
727
727
|
|
|
728
728
|
with an angle sampled uniformly between ``-max_degree`` and ``max_degree``.
|
|
@@ -1357,7 +1357,7 @@ class SegmentationReconstruction(Transform):
|
|
|
1357
1357
|
}
|
|
1358
1358
|
|
|
1359
1359
|
|
|
1360
|
-
class MaskEncoding(
|
|
1360
|
+
class MaskEncoding(_SignalTransform):
|
|
1361
1361
|
"""MaskEncoding from [1]_.
|
|
1362
1362
|
|
|
1363
1363
|
Replaces randomly chosen contiguous part (or parts) of all channels by
|
|
@@ -1448,7 +1448,7 @@ class MaskEncoding(Transform):
|
|
|
1448
1448
|
}
|
|
1449
1449
|
|
|
1450
1450
|
|
|
1451
|
-
class ChannelsReref(
|
|
1451
|
+
class ChannelsReref(_SignalTransform):
|
|
1452
1452
|
"""Randomly re-reference channels in EEG data matrix.
|
|
1453
1453
|
|
|
1454
1454
|
Part of the augmentations proposed in [1]_
|
|
@@ -1483,7 +1483,7 @@ class ChannelsReref(Transform):
|
|
|
1483
1483
|
}
|
|
1484
1484
|
|
|
1485
1485
|
|
|
1486
|
-
class AmplitudeScale(
|
|
1486
|
+
class AmplitudeScale(_SignalTransform):
|
|
1487
1487
|
"""Rescale amplitude based on a random sampled scaling value.
|
|
1488
1488
|
|
|
1489
1489
|
Part of the augmentations proposed in [1]_
|
|
@@ -1517,7 +1517,7 @@ class AmplitudeScale(Transform):
|
|
|
1517
1517
|
return {"random_state": self.rng, "scale": self.scale}
|
|
1518
1518
|
|
|
1519
1519
|
|
|
1520
|
-
class BandRotation(
|
|
1520
|
+
class BandRotation(_SignalTransform):
|
|
1521
1521
|
"""Per-band electrode rotation + inter-band temporal jitter.
|
|
1522
1522
|
|
|
1523
1523
|
Models small wristband rotation between sessions and relative timing
|
|
@@ -1613,7 +1613,7 @@ class BandRotation(Transform):
|
|
|
1613
1613
|
}
|
|
1614
1614
|
|
|
1615
1615
|
|
|
1616
|
-
class TrivialAugment(
|
|
1616
|
+
class TrivialAugment(_SignalTransform):
|
|
1617
1617
|
"""Apply one randomly sampled label-preserving augmentation per example.
|
|
1618
1618
|
|
|
1619
1619
|
For every example, independently samples one transform from the pool
|
|
@@ -12,9 +12,11 @@ import warnings
|
|
|
12
12
|
from skorch import NeuralNet
|
|
13
13
|
from skorch.callbacks import EpochScoring
|
|
14
14
|
from skorch.classifier import NeuralNetClassifier
|
|
15
|
+
from torch import Tensor
|
|
15
16
|
from torch.nn import CrossEntropyLoss
|
|
16
17
|
|
|
17
18
|
from .eegneuralnet import _EEGNeuralNet
|
|
19
|
+
from .training.losses import CroppedLoss, _class_target
|
|
18
20
|
from .training.scoring import predict_trials
|
|
19
21
|
from .util import ThrowAwayIndexLoader, update_estimator_docstring
|
|
20
22
|
|
|
@@ -173,6 +175,15 @@ class EEGClassifier(_EEGNeuralNet, NeuralNetClassifier):
|
|
|
173
175
|
loss : float
|
|
174
176
|
The loss value.
|
|
175
177
|
"""
|
|
178
|
+
# CroppedLoss pools logits before comparing them with trial targets.
|
|
179
|
+
# Composite inputs have their own target dtype contract in the loader.
|
|
180
|
+
if (
|
|
181
|
+
isinstance(y_pred, Tensor)
|
|
182
|
+
and isinstance(y_true, Tensor)
|
|
183
|
+
and not isinstance(self.criterion_, CroppedLoss)
|
|
184
|
+
and not isinstance(kwargs.get("X"), (tuple, list))
|
|
185
|
+
):
|
|
186
|
+
y_true = _class_target(y_pred, y_true)
|
|
176
187
|
return NeuralNet.get_loss(self, y_pred, y_true, *args, **kwargs)
|
|
177
188
|
|
|
178
189
|
def predict(self, X):
|
{braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/base.py
RENAMED
|
@@ -26,7 +26,7 @@ from itertools import chain
|
|
|
26
26
|
from operator import attrgetter
|
|
27
27
|
from pathlib import Path
|
|
28
28
|
from typing import Any, Generic, Iterable, no_type_check
|
|
29
|
-
from uuid import uuid4
|
|
29
|
+
from uuid import UUID, uuid4
|
|
30
30
|
|
|
31
31
|
import mne
|
|
32
32
|
import mne.io
|
|
@@ -513,20 +513,23 @@ def _zarr_to_memmap(zarr_path, group_name):
|
|
|
513
513
|
so they can never collide with a live writer, they are never
|
|
514
514
|
read by the fast path, and they do not prevent subsequent
|
|
515
515
|
callers from producing a correct result. Caches written by
|
|
516
|
-
earlier braindecode versions remain valid
|
|
517
|
-
|
|
516
|
+
earlier braindecode versions remain valid for stores without a store ID.
|
|
517
|
+
New stores have a separate cache for each export, including overwrites.
|
|
518
518
|
"""
|
|
519
|
-
zarr_p = Path(zarr_path)
|
|
519
|
+
zarr_p = Path(zarr_path).absolute()
|
|
520
520
|
cache_dir = zarr_p.parent / f".{zarr_p.name}_memmap"
|
|
521
|
+
store_stat = zarr_p.stat()
|
|
522
|
+
root = zarr.open(str(zarr_p), mode="r")
|
|
523
|
+
store_id = root.attrs.get("store_id")
|
|
524
|
+
if store_id is not None:
|
|
525
|
+
cache_dir /= UUID(store_id).hex
|
|
521
526
|
npy_path = cache_dir / f"{group_name}.npy"
|
|
522
527
|
|
|
523
|
-
# Fast path: the file is already fully materialised. A single
|
|
524
|
-
# stat() is all the steady-state workload pays.
|
|
525
528
|
if npy_path.exists():
|
|
526
529
|
return npy_path
|
|
527
530
|
|
|
528
531
|
cache_dir.mkdir(parents=True, exist_ok=True)
|
|
529
|
-
arr =
|
|
532
|
+
arr = root[group_name]["data"]
|
|
530
533
|
# Unique per call, not per pid: threads of one process must not share it.
|
|
531
534
|
# Exclusive creation, not tempfile.mkstemp, which would make it 0600.
|
|
532
535
|
tmp_path = cache_dir / f"{group_name}.{uuid4().hex}.tmp.npy"
|
|
@@ -546,6 +549,11 @@ def _zarr_to_memmap(zarr_path, group_name):
|
|
|
546
549
|
finally:
|
|
547
550
|
del mm
|
|
548
551
|
|
|
552
|
+
# A reader on read-only media may be unable to acquire the store lock.
|
|
553
|
+
# Never publish a mixture of chunks under the previous store's ID.
|
|
554
|
+
if not os.path.samestat(store_stat, zarr_p.stat()):
|
|
555
|
+
raise OSError(f"Zarr store {zarr_p} changed while populating its cache.")
|
|
556
|
+
|
|
549
557
|
# Atomic publication. ``os.link`` never replaces an existing
|
|
550
558
|
# destination, so the published inode is immutable for the
|
|
551
559
|
# lifetime of the cache directory. Concurrent readers never
|
|
@@ -580,7 +588,14 @@ class _ZarrMixin:
|
|
|
580
588
|
_zarr_data = None
|
|
581
589
|
|
|
582
590
|
def _open_zarr(self):
|
|
583
|
-
npy_path =
|
|
591
|
+
npy_path = getattr(self, "_zarr_cache_path", None)
|
|
592
|
+
if npy_path is None or not npy_path.exists():
|
|
593
|
+
current = _zarr_to_memmap(self._zarr_path, self._group_name)
|
|
594
|
+
if npy_path is not None and current != npy_path:
|
|
595
|
+
raise FileNotFoundError(
|
|
596
|
+
f"The cache for the original Zarr store was removed: {npy_path}"
|
|
597
|
+
)
|
|
598
|
+
self._zarr_cache_path = npy_path = current
|
|
584
599
|
# 'c' = copy-on-write: reads from file, writes to RAM
|
|
585
600
|
self._zarr_data = np.load(npy_path, mmap_mode="c")
|
|
586
601
|
|
|
@@ -969,6 +984,10 @@ class EEGWindowsDataset(_ZarrMixin, RecordDataset):
|
|
|
969
984
|
i_window_in_trial, i_start, i_stop = crop_inds
|
|
970
985
|
if self._zarr_data is not None:
|
|
971
986
|
X = self._zarr_data[:, i_start:i_stop]
|
|
987
|
+
elif isinstance(self.raw, mne.io.BaseRaw) and self.raw.preload:
|
|
988
|
+
# what raw._getitem returns, without parsing the picks on every call
|
|
989
|
+
# (an Epochs' 3-D _data must not be sliced as channels x times)
|
|
990
|
+
X = self.raw._data[:, i_start:i_stop]
|
|
972
991
|
else:
|
|
973
992
|
X = _read_fif_window(self.raw, i_start, i_stop)
|
|
974
993
|
if X is None:
|
|
@@ -985,7 +1004,10 @@ class EEGWindowsDataset(_ZarrMixin, RecordDataset):
|
|
|
985
1004
|
if self.targets_from == "metadata":
|
|
986
1005
|
y = self.y[index]
|
|
987
1006
|
else:
|
|
988
|
-
|
|
1007
|
+
# same as get_channel_types() == "misc", which is slow to call per window
|
|
1008
|
+
misc_mask = np.array(
|
|
1009
|
+
[ch["kind"] == FIFF.FIFFV_MISC_CH for ch in self.raw.info["chs"]]
|
|
1010
|
+
)
|
|
989
1011
|
if self.last_target_only:
|
|
990
1012
|
y = X[misc_mask, -1]
|
|
991
1013
|
else:
|
|
@@ -1654,7 +1676,11 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1654
1676
|
BaseConcatDataset, with the metadata and description information
|
|
1655
1677
|
for each window, and an ``i_dataset`` column giving the position
|
|
1656
1678
|
in ``datasets`` of the dataset (recording) each window comes from.
|
|
1657
|
-
Samplers use it to keep recordings apart.
|
|
1679
|
+
Samplers use it to keep recordings apart. If a recording description
|
|
1680
|
+
and a window have a column with the same name, the window value is
|
|
1681
|
+
retained. The recording value remains accessible on the dataset's
|
|
1682
|
+
description. For lazy fixed windows this accessor materializes the
|
|
1683
|
+
table. It reports the stored labels before any ``target_transform``.
|
|
1658
1684
|
"""
|
|
1659
1685
|
if not all(
|
|
1660
1686
|
[
|
|
@@ -1667,7 +1693,8 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1667
1693
|
"datasets are WindowsDataset."
|
|
1668
1694
|
)
|
|
1669
1695
|
|
|
1670
|
-
|
|
1696
|
+
all_dfs = []
|
|
1697
|
+
for i_ds, ds in enumerate(self.datasets):
|
|
1671
1698
|
if hasattr(ds, "_windows") and ds._windows is not None:
|
|
1672
1699
|
df = ds._windows.metadata
|
|
1673
1700
|
else:
|
|
@@ -1689,18 +1716,19 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1689
1716
|
"position of the dataset each window comes from. Rename it."
|
|
1690
1717
|
)
|
|
1691
1718
|
|
|
1692
|
-
all_dfs = list()
|
|
1693
|
-
for i_ds, ds in enumerate(self.datasets):
|
|
1694
|
-
if hasattr(ds, "_windows") and ds._windows is not None:
|
|
1695
|
-
df = ds._windows.metadata
|
|
1696
|
-
else:
|
|
1697
|
-
df = ds.metadata
|
|
1698
1719
|
if isinstance(df, pd.DataFrame):
|
|
1699
|
-
# copy so the description columns stay out of the dataset
|
|
1700
1720
|
df = df.copy()
|
|
1701
|
-
|
|
1721
|
+
else:
|
|
1722
|
+
# Only this public accessor materializes fixed-window lazy metadata.
|
|
1723
|
+
df = pd.DataFrame(
|
|
1724
|
+
{
|
|
1725
|
+
col: [df.loc[i, col] for i in range(len(df))]
|
|
1726
|
+
for col in df.columns
|
|
1727
|
+
}
|
|
1728
|
+
)
|
|
1702
1729
|
for k, v in description.items():
|
|
1703
|
-
|
|
1730
|
+
if k not in df.columns:
|
|
1731
|
+
df[k] = v
|
|
1704
1732
|
df["i_dataset"] = i_ds
|
|
1705
1733
|
all_dfs.append(df)
|
|
1706
1734
|
|
|
@@ -1766,6 +1794,8 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1766
1794
|
no-op since ``__getitem__`` reads y from misc channels, not
|
|
1767
1795
|
from ``metadata['target']``).
|
|
1768
1796
|
"""
|
|
1797
|
+
windows_to_update = []
|
|
1798
|
+
raw_to_update = []
|
|
1769
1799
|
for i, ds in enumerate(self.datasets):
|
|
1770
1800
|
if isinstance(ds, (WindowsDataset, EEGWindowsDataset)):
|
|
1771
1801
|
if not isinstance(ds.metadata, pd.DataFrame):
|
|
@@ -1808,19 +1838,15 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1808
1838
|
f"metadata cols={list(md.columns)}, "
|
|
1809
1839
|
f"description keys={desc_keys}."
|
|
1810
1840
|
)
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
# values is already a fresh list (Series.to_list() / [x] * n);
|
|
1821
|
-
# no defensive copy needed — pandas keeps its own representation
|
|
1822
|
-
# for md["target"] so mutating ds.y won't reach back into it.
|
|
1823
|
-
ds.y = values
|
|
1841
|
+
frames = [md]
|
|
1842
|
+
epochs = getattr(ds, "_windows", None)
|
|
1843
|
+
if epochs is not None and epochs.metadata is not md:
|
|
1844
|
+
frames.append(epochs.metadata)
|
|
1845
|
+
if any(frame is None or len(frame) != len(values) for frame in frames):
|
|
1846
|
+
raise ValueError(
|
|
1847
|
+
f"Window metadata must have one row per window in datasets[{i}]."
|
|
1848
|
+
)
|
|
1849
|
+
windows_to_update.append((ds, frames, values))
|
|
1824
1850
|
elif isinstance(ds, RawDataset):
|
|
1825
1851
|
if (
|
|
1826
1852
|
not isinstance(ds.description, pd.Series)
|
|
@@ -1835,12 +1861,19 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1835
1861
|
f"Column {column!r} not found on datasets[{i}] "
|
|
1836
1862
|
f"description (keys={desc_keys})."
|
|
1837
1863
|
)
|
|
1838
|
-
ds
|
|
1864
|
+
raw_to_update.append(ds)
|
|
1839
1865
|
else:
|
|
1840
1866
|
raise TypeError(
|
|
1841
1867
|
"set_target requires WindowsDataset, EEGWindowsDataset, "
|
|
1842
1868
|
f"or RawDataset; datasets[{i}] is {type(ds).__name__}."
|
|
1843
1869
|
)
|
|
1870
|
+
# Preserve shared DataFrame objects while changing all recordings together.
|
|
1871
|
+
for ds, frames, values in windows_to_update:
|
|
1872
|
+
for frame in frames:
|
|
1873
|
+
frame["target"] = values
|
|
1874
|
+
ds.y = values
|
|
1875
|
+
for ds in raw_to_update:
|
|
1876
|
+
ds.target_name = column
|
|
1844
1877
|
return self
|
|
1845
1878
|
|
|
1846
1879
|
def set_return_ch_pos(self, value: bool = True) -> "BaseConcatDataset":
|
{braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/bids/hub.py
RENAMED
|
@@ -35,6 +35,7 @@ import tempfile
|
|
|
35
35
|
from datetime import timedelta
|
|
36
36
|
from pathlib import Path
|
|
37
37
|
from typing import TYPE_CHECKING, List, Optional, Union
|
|
38
|
+
from uuid import uuid4
|
|
38
39
|
|
|
39
40
|
import mne
|
|
40
41
|
import numpy as np
|
|
@@ -769,6 +770,7 @@ class HubDatasetMixin:
|
|
|
769
770
|
# Store global metadata
|
|
770
771
|
root.attrs["n_datasets"] = len(self.datasets)
|
|
771
772
|
root.attrs["dataset_type"] = dataset_type
|
|
773
|
+
root.attrs["store_id"] = uuid4().hex
|
|
772
774
|
root.attrs["braindecode_version"] = braindecode.__version__
|
|
773
775
|
|
|
774
776
|
# Track dependency versions for reproducibility
|
{braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/tuh.py
RENAMED
|
@@ -436,27 +436,39 @@ def _parse_description_from_file_path(
|
|
|
436
436
|
|
|
437
437
|
|
|
438
438
|
def _read_physician_report(file_path):
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
if
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
439
|
+
recording = Path(file_path)
|
|
440
|
+
session = re.sub(r"_t\d+$", "", recording.stem)
|
|
441
|
+
reports = [
|
|
442
|
+
p for p in recording.parent.rglob("*.txt") if not p.name.endswith("_date.txt")
|
|
443
|
+
]
|
|
444
|
+
matched = [p for p in reports if p.stem in (recording.stem, session)]
|
|
445
|
+
if matched:
|
|
446
|
+
reports = matched
|
|
447
|
+
elif reports:
|
|
448
|
+
# An unnamed report is usable only in a directory belonging to one session.
|
|
449
|
+
foreign_report = any(
|
|
450
|
+
re.fullmatch(r"[^_]+_s\d+(?:_t\d+)?", p.stem) for p in reports
|
|
451
|
+
)
|
|
452
|
+
shared_directory = any(
|
|
453
|
+
re.sub(r"_t\d+$", "", p.stem) != session
|
|
454
|
+
for p in recording.parent.rglob("*.edf")
|
|
455
|
+
)
|
|
456
|
+
if foreign_report or shared_directory:
|
|
457
|
+
reports = []
|
|
458
|
+
if len(reports) > 1:
|
|
455
459
|
raise RuntimeError(
|
|
456
|
-
f"
|
|
457
|
-
f"Disable option or choose appropriate directory."
|
|
460
|
+
f"Expected at most one physician report for {recording}, found {sorted(reports)}."
|
|
458
461
|
)
|
|
459
|
-
|
|
462
|
+
if reports:
|
|
463
|
+
try:
|
|
464
|
+
report = reports[0].read_text(encoding="utf-8")
|
|
465
|
+
except UnicodeDecodeError:
|
|
466
|
+
report = reports[0].read_text(encoding="latin-1")
|
|
467
|
+
if report:
|
|
468
|
+
return report
|
|
469
|
+
raise RuntimeError(
|
|
470
|
+
f"Could not read physician report for {recording}. Disable add_physician_reports or check the recording directory."
|
|
471
|
+
)
|
|
460
472
|
|
|
461
473
|
|
|
462
474
|
def _read_edf_header(file_path):
|
{braindecode-2.1.0.dev179666547 → braindecode-2.1.0.dev180711956}/braindecode/datasets/utils.py
RENAMED
|
@@ -9,6 +9,7 @@ from __future__ import annotations
|
|
|
9
9
|
import os
|
|
10
10
|
from pathlib import Path
|
|
11
11
|
|
|
12
|
+
import numpy as np
|
|
12
13
|
from mne.datasets import fetch_dataset
|
|
13
14
|
|
|
14
15
|
from .bids import BIDSDataset
|
|
@@ -102,3 +103,17 @@ class _ZenodoBIDSDataset(BIDSDataset):
|
|
|
102
103
|
super().__init__(
|
|
103
104
|
*args, root=path_root, extensions=".edf", check=False, **kwargs
|
|
104
105
|
)
|
|
106
|
+
|
|
107
|
+
def _get_dataset(self, bids_path):
|
|
108
|
+
dataset = super()._get_dataset(bids_path)
|
|
109
|
+
# These events.tsv name each event in ``eventType``, not ``trial_type``:
|
|
110
|
+
# mne-bids labels every event "n/a" and keeps ``eventType`` in the extras.
|
|
111
|
+
# Before mne 1.13, a list assigned here stays a list and breaks
|
|
112
|
+
# mne.events_from_annotations, so assign an array.
|
|
113
|
+
annotations = dataset.raw.annotations
|
|
114
|
+
names = []
|
|
115
|
+
for description, extras in zip(annotations.description, annotations.extras):
|
|
116
|
+
event_type = extras.get("eventType")
|
|
117
|
+
names.append(description if event_type in (None, "", "n/a") else event_type)
|
|
118
|
+
annotations.description = np.asarray(names, dtype=str)
|
|
119
|
+
return dataset
|