Braindecode 1.8.1.dev182039595__tar.gz → 1.8.1.dev182199177__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.dev182039595 → braindecode-1.8.1.dev182199177}/NOTICE.txt +0 -3
- {braindecode-1.8.1.dev182039595/braindecode.egg-info → braindecode-1.8.1.dev182199177}/PKG-INFO +1 -1
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/augmentation/__init__.py +0 -2
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/augmentation/functional.py +0 -49
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/augmentation/transforms.py +1 -52
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/base.py +11 -232
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/mne.py +0 -5
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/tuh.py +5 -10
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datautil/serialization.py +10 -21
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/eegneuralnet.py +1 -6
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/functional/_real_dft.py +0 -55
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/functional/functions.py +13 -32
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/__init__.py +0 -6
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/axon.py +8 -42
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/barista.py +13 -25
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/base.py +15 -56
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/brainmodule.py +1 -13
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/brainomni.py +4 -14
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/brant.py +7 -18
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/codebrain.py +26 -114
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/contrawr.py +1 -23
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/csbrain.py +48 -93
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/ctnet.py +1 -9
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/deep4.py +1 -10
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/dgcnn.py +0 -5
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/diver1.py +59 -51
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/eeg_clip.py +9 -71
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/eegconformer.py +3 -19
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/eeginception_mi.py +3 -7
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/eegnex.py +1 -20
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/eegpt.py +9 -15
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/eegsym.py +16 -68
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/guetschel2026.py +8 -8
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/labram.py +15 -34
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/luna.py +5 -11
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/medformer.py +21 -51
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/meta_neuromotor.py +8 -35
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/mirepnet.py +4 -15
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/mscformer.py +1 -21
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/msvtnet.py +2 -120
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/neurorvq.py +34 -135
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/neurorvq_tokenizer.py +63 -87
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/patchedtransformer.py +7 -3
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/reve.py +43 -127
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/signal_jepa.py +4 -87
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/sinc_shallow.py +1 -2
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/sleep_stager_blanco_2020.py +6 -13
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/sleepfm.py +12 -62
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/steegformer.py +9 -16
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/summary.csv +0 -3
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/tfm_tokenizer.py +3 -44
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/tidnet.py +1 -18
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/util.py +0 -8
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/zuna.py +9 -11
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/modules/__init__.py +1 -2
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/modules/attention.py +15 -124
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/modules/blocks.py +5 -54
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/modules/channels.py +0 -77
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/modules/dance_modules.py +3 -16
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/modules/filter.py +33 -79
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/modules/layers.py +2 -41
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/modules/quantization.py +5 -5
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/preprocessing/preprocess.py +0 -19
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/samplers/base.py +61 -60
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/training/losses.py +4 -5
- braindecode-1.8.1.dev182199177/braindecode/version.py +1 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177/braindecode.egg-info}/PKG-INFO +1 -1
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode.egg-info/SOURCES.txt +0 -3
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/api.rst +0 -11
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/whats_new.rst +0 -149
- braindecode-1.8.1.dev182039595/braindecode/models/duin.py +0 -454
- braindecode-1.8.1.dev182039595/braindecode/models/epint.py +0 -315
- braindecode-1.8.1.dev182039595/braindecode/models/gcnsnet.py +0 -338
- braindecode-1.8.1.dev182039595/braindecode/version.py +0 -1
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/LICENSE.txt +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/MANIFEST.in +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/README.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/__init__.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/augmentation/base.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/classifier.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/__init__.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/_notebook_viewer.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/bbci.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/bcicomp.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/bids/__init__.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/bids/datasets.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/bids/format.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/bids/hub.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/bids/hub_format.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/bids/hub_io.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/bids/hub_validation.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/bids/iterable.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/chb_mit.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/collate.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/moabb.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/nmt.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/registry.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/siena.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/sleep_physio_challe_18.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/sleep_physionet.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/utils.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/xy.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datautil/__init__.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datautil/channel_utils.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datautil/hub_formats.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datautil/util.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/functional/__init__.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/functional/initialization.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/atcnet.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/attentionbasenet.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/attn_sleep.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/bendr.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/biot.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/brainbert.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/cbramod.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/config.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/dance.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/deepsleepnet.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/eegdino.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/eeginception_erp.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/eegitnet.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/eegminer.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/eegnet.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/eegsimpleconv.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/eegtcnet.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/emg2qwerty.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/fbcnet.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/fblightconvnet.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/fbmsnet.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/hybrid.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/ifnet.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/mapa.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/mvpformer.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/neuropose.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/popt.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/sccnet.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/seizure_transformer.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/sensingdynamics.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/shallow_fbcsp.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/sleep_stager_chambon_2018.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/sparcnet.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/sstdpn.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/syncnet.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/tcformer.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/tcn.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/tmsanet.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/tsinception.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/usleep.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/models/vemg2pose.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/modules/activation.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/modules/convolution.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/modules/linear.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/modules/linear_attention.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/modules/parametrization.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/modules/popt_modules.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/modules/stats.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/modules/util.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/modules/wrapper.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/preprocessing/__init__.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/preprocessing/eegprep_preprocess.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/preprocessing/mne_preprocess.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/preprocessing/util.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/preprocessing/windowers.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/regressor.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/samplers/__init__.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/samplers/ssl.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/training/__init__.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/training/callbacks.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/training/scoring.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/util.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/visualization/__init__.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/visualization/activations.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/visualization/attribution.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/visualization/confusion_matrices.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/visualization/frequency.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/visualization/metrics.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/visualization/sanity.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/visualization/topology.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode.egg-info/dependency_links.txt +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode.egg-info/requires.txt +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode.egg-info/top_level.txt +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/Makefile +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/_templates/autosummary/class.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/_templates/autosummary/class_in_subdir.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/_templates/autosummary/function.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/_templates/autosummary/function_in_subdir.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/agent_docs.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/cite.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/conf.py +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/help.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/index.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/install/install.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/install/install_pip.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/install/install_source.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/models/categorization/attention.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/models/categorization/channel.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/models/categorization/convolution.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/models/categorization/filterbank.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/models/categorization/gnn.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/models/categorization/interpretable.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/models/categorization/lbm.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/models/categorization/recurrent.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/models/categorization/spd.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/models/models.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/models/models_categorization.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/models/models_table.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/models/models_visualization.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/sg_execution_times.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/docs/user_guide/channel_strategies.rst +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/pyproject.toml +0 -0
- {braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/setup.cfg +0 -0
|
@@ -40,7 +40,6 @@ The following components are licensed under the MIT License:
|
|
|
40
40
|
|
|
41
41
|
- `braindecode/models/ctnet.py`
|
|
42
42
|
- `braindecode/models/dance.py`
|
|
43
|
-
- `braindecode/models/duin.py`
|
|
44
43
|
- `braindecode/models/medformer.py`
|
|
45
44
|
- `braindecode/models/tcformer.py`
|
|
46
45
|
- `braindecode/models/ifnet.py`
|
|
@@ -55,8 +54,6 @@ The following components are licensed under the MIT License:
|
|
|
55
54
|
- `docs/_static/model/seizure_transformer_arch.png`
|
|
56
55
|
- `braindecode/models/guetschel2026.py`
|
|
57
56
|
- `braindecode/models/tmsanet.py`
|
|
58
|
-
- `braindecode/models/epint.py`
|
|
59
|
-
- `braindecode/models/gcnsnet.py`
|
|
60
57
|
|
|
61
58
|
The `brainomni.py` file is a derivative of `OpenTSLab/BrainOmni` (MIT), whose
|
|
62
59
|
SEANet codec derives from Meta's `facebookresearch/encodec` (MIT). The
|
{braindecode-1.8.1.dev182039595/braindecode.egg-info → braindecode-1.8.1.dev182199177}/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.dev182199177
|
|
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>
|
|
@@ -10,7 +10,6 @@ from .transforms import (
|
|
|
10
10
|
ChannelsReref,
|
|
11
11
|
ChannelsShuffle,
|
|
12
12
|
ChannelsSymmetry,
|
|
13
|
-
CutMix,
|
|
14
13
|
FrequencyShift,
|
|
15
14
|
FTSurrogate,
|
|
16
15
|
GaussianNoise,
|
|
@@ -37,7 +36,6 @@ __all__ = [
|
|
|
37
36
|
"SignFlip",
|
|
38
37
|
"FTSurrogate",
|
|
39
38
|
"ChannelsShuffle",
|
|
40
|
-
"CutMix",
|
|
41
39
|
"ChannelsDropout",
|
|
42
40
|
"GaussianNoise",
|
|
43
41
|
"ChannelsSymmetry",
|
|
@@ -580,7 +580,6 @@ def _frequency_shift(X: torch.Tensor, fs: float, f_shift: float) -> torch.Tensor
|
|
|
580
580
|
_f_shift = torch.as_tensor(f_shift).float()
|
|
581
581
|
else:
|
|
582
582
|
raise ValueError(f"Invalid f_shift type: {type(f_shift)}")
|
|
583
|
-
_f_shift = _f_shift.to(X.device)
|
|
584
583
|
f_shift_stack = _f_shift.repeat(N_padded, n_channels, 1)
|
|
585
584
|
reshaped_f_shift = f_shift_stack.permute(
|
|
586
585
|
*torch.arange(f_shift_stack.ndim - 1, -1, -1)
|
|
@@ -1076,54 +1075,6 @@ def mixup(
|
|
|
1076
1075
|
return X_mix, (y_a, y_b, lam)
|
|
1077
1076
|
|
|
1078
1077
|
|
|
1079
|
-
def cutmix(
|
|
1080
|
-
X: torch.Tensor,
|
|
1081
|
-
y: torch.Tensor,
|
|
1082
|
-
idx_perm: torch.Tensor,
|
|
1083
|
-
cut_t_start: torch.Tensor,
|
|
1084
|
-
cut_t_len: torch.Tensor,
|
|
1085
|
-
) -> tuple[torch.Tensor, torch.Tensor]:
|
|
1086
|
-
"""Paste a time region of shuffled examples into the original examples.
|
|
1087
|
-
|
|
1088
|
-
See [1]_ for details.
|
|
1089
|
-
|
|
1090
|
-
Parameters
|
|
1091
|
-
----------
|
|
1092
|
-
X : torch.Tensor
|
|
1093
|
-
EEG data in form ``batch_size, n_channels, n_times``
|
|
1094
|
-
y : torch.Tensor
|
|
1095
|
-
Target of length ``batch_size``
|
|
1096
|
-
idx_perm : torch.Tensor
|
|
1097
|
-
Permuted indices of example that are mixed into original examples.
|
|
1098
|
-
cut_t_start : torch.Tensor
|
|
1099
|
-
Start index of the pasted time region for each example.
|
|
1100
|
-
cut_t_len : torch.Tensor
|
|
1101
|
-
Length of the pasted time region for each example.
|
|
1102
|
-
|
|
1103
|
-
Returns
|
|
1104
|
-
-------
|
|
1105
|
-
tuple
|
|
1106
|
-
``X``, ``y``. Where ``X`` is augmented and ``y`` is a tuple of length
|
|
1107
|
-
3 containing the labels of the two mixed examples and the fraction of
|
|
1108
|
-
each example kept from the original, ``1 - cut_t_len / n_times``.
|
|
1109
|
-
|
|
1110
|
-
References
|
|
1111
|
-
----------
|
|
1112
|
-
.. [1] Sangdoo Yun, Dongyoon Han, Seong Joon Oh, Sanghyuk Chun,
|
|
1113
|
-
Junsuk Choe, Youngjoon Yoo (2019). CutMix: Regularization Strategy
|
|
1114
|
-
to Train Strong Classifiers with Localizable Features. In 2019
|
|
1115
|
-
IEEE/CVF International Conference on Computer Vision (ICCV)
|
|
1116
|
-
Online: https://arxiv.org/abs/1905.04899
|
|
1117
|
-
"""
|
|
1118
|
-
n_times = X.shape[-1]
|
|
1119
|
-
t = torch.arange(n_times, device=X.device)
|
|
1120
|
-
start = cut_t_start[:, None]
|
|
1121
|
-
in_cut = (t >= start) & (t < start + cut_t_len[:, None])
|
|
1122
|
-
X_mix = torch.where(in_cut[:, None], X[idx_perm], X)
|
|
1123
|
-
lam = (n_times - cut_t_len).to(X.dtype) / n_times
|
|
1124
|
-
return X_mix, (y.clone(), y[idx_perm].clone(), lam)
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
1078
|
def segmentation_reconstruction(
|
|
1128
1079
|
X: torch.Tensor,
|
|
1129
1080
|
y: torch.Tensor,
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
# Gustavo Rodrigues <gustavenrique01@gmail.com>
|
|
4
4
|
# Bruna Lopes <brunajaflopes@gmail.com>
|
|
5
5
|
# Sarthak Tayal <sarthaktayal2@gmail.com>
|
|
6
|
-
# Anton Soloviev <anton@praviel.com>
|
|
7
6
|
#
|
|
8
7
|
# License: BSD (3-clause)
|
|
9
8
|
|
|
@@ -25,7 +24,6 @@ from .functional import (
|
|
|
25
24
|
channels_permute,
|
|
26
25
|
channels_rereference,
|
|
27
26
|
channels_shuffle,
|
|
28
|
-
cutmix,
|
|
29
27
|
frequency_shift,
|
|
30
28
|
ft_surrogate,
|
|
31
29
|
gaussian_noise,
|
|
@@ -1097,55 +1095,6 @@ class Mixup(Transform):
|
|
|
1097
1095
|
}
|
|
1098
1096
|
|
|
1099
1097
|
|
|
1100
|
-
class CutMix(Mixup):
|
|
1101
|
-
"""Implements CutMix for EEG data.
|
|
1102
|
-
|
|
1103
|
-
A random time region of each example is replaced by the same region of
|
|
1104
|
-
a shuffled example of the batch, see [1]_. As in the reference code [2]_,
|
|
1105
|
-
a coefficient ``lam`` is drawn from a Beta distribution, the region is
|
|
1106
|
-
``(1 - lam) * n_times`` long (the 1-D analogue of the cut area ratio
|
|
1107
|
-
``1 - lam``) around a uniformly drawn center, it is clipped at the trial
|
|
1108
|
-
boundaries, and ``lam`` is then recomputed from the pasted length.
|
|
1109
|
-
|
|
1110
|
-
Like :class:`Mixup`, it applies to whole batches and returns targets
|
|
1111
|
-
``(y_a, y_b, lam)`` for :func:`braindecode.training.mixup_criterion`.
|
|
1112
|
-
|
|
1113
|
-
Parameters
|
|
1114
|
-
----------
|
|
1115
|
-
alpha : float
|
|
1116
|
-
Parameter of the Beta distribution of ``lam``. ``alpha <= 0`` cuts
|
|
1117
|
-
nothing.
|
|
1118
|
-
beta_per_sample : bool (default=False)
|
|
1119
|
-
By default, one ``lam`` per batch is drawn. If True, one per sample.
|
|
1120
|
-
random_state : int | numpy.random.Generator, optional
|
|
1121
|
-
Seed to be used to instantiate numpy random number generator instance.
|
|
1122
|
-
Defaults to None.
|
|
1123
|
-
|
|
1124
|
-
References
|
|
1125
|
-
----------
|
|
1126
|
-
.. [1] Sangdoo Yun, Dongyoon Han, Seong Joon Oh, Sanghyuk Chun,
|
|
1127
|
-
Junsuk Choe, Youngjoon Yoo (2019). CutMix: Regularization Strategy
|
|
1128
|
-
to Train Strong Classifiers with Localizable Features. In 2019
|
|
1129
|
-
IEEE/CVF International Conference on Computer Vision (ICCV)
|
|
1130
|
-
Online: https://arxiv.org/abs/1905.04899
|
|
1131
|
-
.. [2] https://github.com/clovaai/CutMix-PyTorch/blob/master/train.py
|
|
1132
|
-
"""
|
|
1133
|
-
|
|
1134
|
-
operation = staticmethod(cutmix) # type: ignore[assignment]
|
|
1135
|
-
|
|
1136
|
-
def get_augmentation_params(self, *batch):
|
|
1137
|
-
"""Return idx_perm and the cut_t_start, cut_t_len of each region."""
|
|
1138
|
-
params = super().get_augmentation_params(*batch)
|
|
1139
|
-
lam = params.pop("lam")
|
|
1140
|
-
n_times = batch[0].shape[-1]
|
|
1141
|
-
half = ((1 - lam) * n_times).long() // 2
|
|
1142
|
-
center = torch.as_tensor(self.rng.randint(n_times, size=len(lam)))
|
|
1143
|
-
center = center.to(lam.device)
|
|
1144
|
-
start = (center - half).clamp(min=0)
|
|
1145
|
-
end = (center + half).clamp(max=n_times)
|
|
1146
|
-
return dict(params, cut_t_start=start, cut_t_len=end - start)
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
1098
|
class SegmentationReconstruction(Transform):
|
|
1150
1099
|
"""Segmentation Reconstruction from Lotte (2015) [Lotte2015]_.
|
|
1151
1100
|
|
|
@@ -1334,7 +1283,7 @@ class MaskEncoding(Transform):
|
|
|
1334
1283
|
)
|
|
1335
1284
|
|
|
1336
1285
|
time_start = self.rng.randint(
|
|
1337
|
-
0, n_times - segment_length
|
|
1286
|
+
0, n_times - segment_length, (batch_size, self.n_segments)
|
|
1338
1287
|
)
|
|
1339
1288
|
time_start = torch.from_numpy(time_start)
|
|
1340
1289
|
|
{braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/base.py
RENAMED
|
@@ -14,16 +14,13 @@ from __future__ import annotations
|
|
|
14
14
|
import bisect
|
|
15
15
|
import html as _html
|
|
16
16
|
import json
|
|
17
|
-
import mmap
|
|
18
17
|
import os
|
|
19
18
|
import shutil
|
|
20
19
|
import warnings
|
|
21
20
|
from abc import abstractmethod
|
|
22
21
|
from collections import Counter
|
|
23
|
-
from collections.abc import Callable, Hashable
|
|
22
|
+
from collections.abc import Callable, Hashable
|
|
24
23
|
from glob import glob
|
|
25
|
-
from itertools import chain
|
|
26
|
-
from operator import attrgetter
|
|
27
24
|
from pathlib import Path
|
|
28
25
|
from typing import Any, Generic, Iterable, no_type_check
|
|
29
26
|
|
|
@@ -31,7 +28,6 @@ import mne
|
|
|
31
28
|
import mne.io
|
|
32
29
|
import numpy as np
|
|
33
30
|
import pandas as pd
|
|
34
|
-
from mne.io.constants import FIFF
|
|
35
31
|
from mne.utils import _soft_import
|
|
36
32
|
from mne.utils.docs import deprecated
|
|
37
33
|
from torch.utils.data import ConcatDataset, Dataset, IterableDataset
|
|
@@ -224,125 +220,6 @@ def _compute_ch_pos(info, targets_from):
|
|
|
224
220
|
return pos
|
|
225
221
|
|
|
226
222
|
|
|
227
|
-
_TAG_ROW = attrgetter("kind", "type", "size", "next", "pos")
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
def _tag_rows(tags):
|
|
231
|
-
"""(kind, type, size, next, pos) of FIF tags as an int64 array (n, 5)."""
|
|
232
|
-
flat = chain.from_iterable(map(_TAG_ROW, tags))
|
|
233
|
-
return np.fromiter(flat, np.int64, 5 * len(tags)).reshape(-1, 5)
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
class _FifTagTable(Sequence):
|
|
237
|
-
"""The data-buffer tags of a lazy FIF raw as one int64 array.
|
|
238
|
-
|
|
239
|
-
mne's FIF reader keeps one ``Tag`` object per data buffer in
|
|
240
|
-
``raw._raw_extras[i]["ent"]`` (one per second of signal with mne's default
|
|
241
|
-
buffers), each with its attribute dict and integers once unpickled. A lazy
|
|
242
|
-
dataset of many recordings holds millions of them in RAM, and every forked
|
|
243
|
-
DataLoader worker copies the memory pages of those it reads (reference
|
|
244
|
-
counts). This holds the same fields in 40 bytes per buffer and returns an
|
|
245
|
-
equal ``Tag`` on access, so mne's own reads are unchanged.
|
|
246
|
-
"""
|
|
247
|
-
|
|
248
|
-
def __init__(self, tags):
|
|
249
|
-
self.tag_class = type(tags[0])
|
|
250
|
-
self.table = _tag_rows(tags)
|
|
251
|
-
|
|
252
|
-
def __len__(self):
|
|
253
|
-
return len(self.table)
|
|
254
|
-
|
|
255
|
-
def __getitem__(self, i):
|
|
256
|
-
if isinstance(i, slice):
|
|
257
|
-
return [self.tag_class(*row) for row in self.table[i].tolist()]
|
|
258
|
-
return self.tag_class(*self.table[i].tolist())
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
_TAG_FIELDS = ("kind", "type", "size", "next", "pos", "data")
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
def _compact_fif_tags(inst):
|
|
265
|
-
"""Swap the ``Tag`` lists of a FIF raw for `_FifTagTable` (in place).
|
|
266
|
-
|
|
267
|
-
Only gap-free lists of directory tags (no ``None``, no ``data``) with mne's
|
|
268
|
-
``Tag`` fields are swapped; anything else is left as mne built it.
|
|
269
|
-
"""
|
|
270
|
-
for extra in getattr(inst, "_raw_extras", ()):
|
|
271
|
-
tags = extra.get("ent")
|
|
272
|
-
if not isinstance(tags, list) or not tags:
|
|
273
|
-
continue
|
|
274
|
-
cls = type(tags[0])
|
|
275
|
-
if tuple(getattr(cls, "__dataclass_fields__", ())) == _TAG_FIELDS and all(
|
|
276
|
-
type(t) is cls and t.data is None for t in tags
|
|
277
|
-
):
|
|
278
|
-
extra["ent"] = _FifTagTable(tags)
|
|
279
|
-
return inst
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
def _read_fif_window(raw, start, stop, willneed=False):
|
|
283
|
-
"""Samples ``start:stop`` of a lazy FIF raw, copied from the file in one go.
|
|
284
|
-
|
|
285
|
-
mne reads, casts and calibrates the FIF data buffers of a range one at a
|
|
286
|
-
time (60 Python steps for a 60-s window saved with 1-s buffers, each through
|
|
287
|
-
a buffered file whose buffer is 4 MB on network file systems). Here one
|
|
288
|
-
slice of the memory-mapped file holds the bytes of every buffer in the
|
|
289
|
-
range and one multiply calibrates them, with mne's arithmetic (float64 data
|
|
290
|
-
times ``raw._cals``), so the values equal ``raw._getitem``'s. Returns None
|
|
291
|
-
(the caller uses mne) unless ``raw`` is a lazy, single-file, uncompressed
|
|
292
|
-
FIF raw of float32 buffers without projector, compensation or gaps.
|
|
293
|
-
|
|
294
|
-
With ``willneed=True`` nothing is read and None is returned: the OS is
|
|
295
|
-
only asked to start reading the window's bytes into the page cache in the
|
|
296
|
-
background (``posix_fadvise(POSIX_FADV_WILLNEED)``).
|
|
297
|
-
"""
|
|
298
|
-
if (
|
|
299
|
-
not isinstance(raw, mne.io.Raw)
|
|
300
|
-
or raw.preload
|
|
301
|
-
or len(raw._raw_extras) != 1
|
|
302
|
-
or raw._projector is not None
|
|
303
|
-
or raw._comp is not None
|
|
304
|
-
):
|
|
305
|
-
return None
|
|
306
|
-
extra = raw._raw_extras[0]
|
|
307
|
-
fname, bounds = extra["filename"], extra["bounds"]
|
|
308
|
-
if not isinstance(fname, Path) or fname.suffix == ".gz":
|
|
309
|
-
return None
|
|
310
|
-
start, stop = start + raw._first_samps[0], stop + raw._first_samps[0]
|
|
311
|
-
first = np.searchsorted(bounds, start, side="right") - 1
|
|
312
|
-
tags = extra["ent"]
|
|
313
|
-
if isinstance(tags, _FifTagTable):
|
|
314
|
-
rows = tags.table[first : np.searchsorted(bounds, stop)]
|
|
315
|
-
else:
|
|
316
|
-
tags = tags[first : np.searchsorted(bounds, stop)]
|
|
317
|
-
if any(t is None for t in tags):
|
|
318
|
-
return None
|
|
319
|
-
rows = _tag_rows(tags)
|
|
320
|
-
if not len(rows) or (rows[:, 1] != FIFF.FIFFT_FLOAT).any():
|
|
321
|
-
return None
|
|
322
|
-
size, pos = rows[:, 2].tolist(), rows[:, 4].tolist()
|
|
323
|
-
if willneed: # only a hint: any error is left to the read itself
|
|
324
|
-
try:
|
|
325
|
-
with open(fname, "rb") as f:
|
|
326
|
-
os.posix_fadvise(
|
|
327
|
-
f.fileno(),
|
|
328
|
-
pos[0],
|
|
329
|
-
pos[-1] + 16 + size[-1] - pos[0],
|
|
330
|
-
os.POSIX_FADV_WILLNEED,
|
|
331
|
-
)
|
|
332
|
-
except OSError:
|
|
333
|
-
pass
|
|
334
|
-
return None
|
|
335
|
-
# mmap: no copy through a 4 MB read buffer, and a cold file is read around
|
|
336
|
-
# the window by the kernel (as mne's 4 MB reads did), not window by window
|
|
337
|
-
with open(fname, "rb") as f, mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ) as m:
|
|
338
|
-
buf = m[pos[0] : pos[-1] + 16 + size[-1]]
|
|
339
|
-
one = np.concatenate(
|
|
340
|
-
[np.frombuffer(buf, ">f4", s // 4, p + 16 - pos[0]) for s, p in zip(size, pos)]
|
|
341
|
-
).reshape(-1, extra["orig_nchan"])[start - bounds[first] : stop - bounds[first]]
|
|
342
|
-
picked = one[:, raw._read_picks[0]].T
|
|
343
|
-
return np.multiply(picked, raw._cals[:, np.newaxis], order="C")
|
|
344
|
-
|
|
345
|
-
|
|
346
223
|
def _window_info(crop_inds, sfreq):
|
|
347
224
|
"""Extract window size from crop indices.
|
|
348
225
|
|
|
@@ -634,9 +511,7 @@ class RecordDataset(Dataset[tuple[np.ndarray, int | str, tuple[int, int, int]]])
|
|
|
634
511
|
f"'{key}' already in description. Please "
|
|
635
512
|
f"rename or set overwrite to True."
|
|
636
513
|
)
|
|
637
|
-
|
|
638
|
-
# Series of the dataset they were created from
|
|
639
|
-
self._description = self._description.drop(key)
|
|
514
|
+
self._description.pop(key)
|
|
640
515
|
self._description = pd.concat([self.description, description])
|
|
641
516
|
|
|
642
517
|
@property
|
|
@@ -948,11 +823,9 @@ class EEGWindowsDataset(_ZarrMixin, RecordDataset):
|
|
|
948
823
|
if self._zarr_data is not None:
|
|
949
824
|
X = self._zarr_data[:, i_start:i_stop]
|
|
950
825
|
else:
|
|
951
|
-
X =
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
(slice(None), slice(i_start, i_stop)), return_times=False
|
|
955
|
-
)
|
|
826
|
+
X = self.raw._getitem(
|
|
827
|
+
(slice(None), slice(i_start, i_stop)), return_times=False
|
|
828
|
+
)
|
|
956
829
|
X = np.array(X, dtype="float32")
|
|
957
830
|
if self.transform is not None:
|
|
958
831
|
X = self.transform(X)
|
|
@@ -1283,49 +1156,6 @@ class WindowsDataset(_ZarrMixin, RecordDataset):
|
|
|
1283
1156
|
)
|
|
1284
1157
|
|
|
1285
1158
|
|
|
1286
|
-
def _lazy_source_files(ds) -> list:
|
|
1287
|
-
"""Return the files ``ds`` still reads its signal from (none once preloaded)."""
|
|
1288
|
-
signal = ds.raw if hasattr(ds, "raw") else getattr(ds, "windows", None)
|
|
1289
|
-
if signal is None or getattr(signal, "preload", True):
|
|
1290
|
-
return []
|
|
1291
|
-
files = list(
|
|
1292
|
-
getattr(signal, "filenames", None) or [getattr(signal, "filename", None)]
|
|
1293
|
-
)
|
|
1294
|
-
raw = getattr(signal, "_raw", None)
|
|
1295
|
-
if isinstance(raw, mne.io.BaseRaw) and not raw.preload:
|
|
1296
|
-
files += raw.filenames # mne.Epochs of a lazily read Raw read through it
|
|
1297
|
-
return [f for f in files if f is not None]
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
def _dir_key(directory):
|
|
1301
|
-
"""Identify a directory by device and inode, whatever its spelling."""
|
|
1302
|
-
stat = os.stat(directory)
|
|
1303
|
-
return stat.st_dev, stat.st_ino
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
def _overwrite_conflicts(datasets, path, offset):
|
|
1307
|
-
"""Yield ``(i_ds, i_target, target_dir)`` for each dataset ``i_ds`` that
|
|
1308
|
-
lazily reads from inside ``target_dir = path/<i_target + offset>``, which
|
|
1309
|
-
``save(overwrite=True)`` deletes before writing dataset ``i_target``.
|
|
1310
|
-
"""
|
|
1311
|
-
targets = {}
|
|
1312
|
-
for i in range(len(datasets)):
|
|
1313
|
-
target_dir = os.path.join(path, str(i + offset))
|
|
1314
|
-
if os.path.isdir(target_dir):
|
|
1315
|
-
targets[_dir_key(target_dir)] = (i, target_dir)
|
|
1316
|
-
if not targets:
|
|
1317
|
-
return
|
|
1318
|
-
for i_ds, ds in enumerate(datasets):
|
|
1319
|
-
for file in _lazy_source_files(ds):
|
|
1320
|
-
# ancestors of the name and of the file it links to (DataLad)
|
|
1321
|
-
parents = {
|
|
1322
|
-
*Path(os.path.abspath(file)).parents,
|
|
1323
|
-
*Path(os.path.realpath(file)).parents,
|
|
1324
|
-
}
|
|
1325
|
-
for key in {_dir_key(p) for p in parents if p.is_dir()} & targets.keys():
|
|
1326
|
-
yield (i_ds, *targets[key])
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
1159
|
@register_dataset
|
|
1330
1160
|
class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
1331
1161
|
"""A base class for concatenated datasets.
|
|
@@ -1423,8 +1253,7 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1423
1253
|
def __len__(self):
|
|
1424
1254
|
return self._ensure_cumulative_sizes()[-1]
|
|
1425
1255
|
|
|
1426
|
-
def
|
|
1427
|
-
"""The dataset that holds item ``idx`` and the item's index in it."""
|
|
1256
|
+
def _get_single_item(self, idx: int):
|
|
1428
1257
|
if idx < 0:
|
|
1429
1258
|
if -idx > len(self):
|
|
1430
1259
|
raise ValueError(
|
|
@@ -1438,33 +1267,7 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1438
1267
|
sample_idx = idx
|
|
1439
1268
|
else:
|
|
1440
1269
|
sample_idx = idx - cumulative_sizes[dataset_idx - 1]
|
|
1441
|
-
return self.datasets[dataset_idx]
|
|
1442
|
-
|
|
1443
|
-
def _get_single_item(self, idx: int):
|
|
1444
|
-
ds, i = self._locate(idx)
|
|
1445
|
-
return ds[i]
|
|
1446
|
-
|
|
1447
|
-
def __getitems__(self, indices):
|
|
1448
|
-
"""Items ``indices``, as ``[self[i] for i in indices]``.
|
|
1449
|
-
|
|
1450
|
-
A :class:`~torch.utils.data.DataLoader` fetches each batch through
|
|
1451
|
-
this. The lazy FIF windows of the batch are first requested from the
|
|
1452
|
-
OS all at once (``posix_fadvise(POSIX_FADV_WILLNEED)``, where it
|
|
1453
|
-
exists), so their reads from disk overlap instead of running one after
|
|
1454
|
-
another: on a network file system a batch read from cold files then
|
|
1455
|
-
costs about one round trip, not one per window.
|
|
1456
|
-
"""
|
|
1457
|
-
# ponytail: advises the whole batch at once; chunk it if a batch's
|
|
1458
|
-
# windows ever outgrow the page cache
|
|
1459
|
-
if hasattr(os, "posix_fadvise"):
|
|
1460
|
-
for idx in indices:
|
|
1461
|
-
if not isinstance(idx, (int, np.integer)):
|
|
1462
|
-
continue # e.g. a SequenceSampler tuple: read, not advised
|
|
1463
|
-
ds, i = self._locate(idx)
|
|
1464
|
-
if isinstance(ds, EEGWindowsDataset) and ds._zarr_data is None:
|
|
1465
|
-
_, start, stop = ds.crop_inds[i].tolist()
|
|
1466
|
-
_read_fif_window(ds.raw, start, stop, willneed=True)
|
|
1467
|
-
return [self[idx] for idx in indices]
|
|
1270
|
+
return self.datasets[dataset_idx][sample_idx]
|
|
1468
1271
|
|
|
1469
1272
|
def __getitem__(self, idx: int | list):
|
|
1470
1273
|
"""
|
|
@@ -1563,9 +1366,7 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1563
1366
|
metadata : pd.DataFrame
|
|
1564
1367
|
DataFrame containing as many rows as there are windows in the
|
|
1565
1368
|
BaseConcatDataset, with the metadata and description information
|
|
1566
|
-
for each window
|
|
1567
|
-
in ``datasets`` of the dataset (recording) each window comes from.
|
|
1568
|
-
Samplers use it to keep recordings apart.
|
|
1369
|
+
for each window.
|
|
1569
1370
|
"""
|
|
1570
1371
|
if not all(
|
|
1571
1372
|
[
|
|
@@ -1591,15 +1392,9 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1591
1392
|
"Dataset descriptions cannot contain the reserved window "
|
|
1592
1393
|
"metadata key 'i_trial_in_dataset'."
|
|
1593
1394
|
)
|
|
1594
|
-
if "i_dataset" in df.columns or "i_dataset" in ds.description:
|
|
1595
|
-
raise ValueError(
|
|
1596
|
-
"Window metadata and dataset descriptions cannot contain the "
|
|
1597
|
-
"key 'i_dataset', which get_metadata() reserves for the "
|
|
1598
|
-
"position of the dataset each window comes from. Rename it."
|
|
1599
|
-
)
|
|
1600
1395
|
|
|
1601
1396
|
all_dfs = list()
|
|
1602
|
-
for
|
|
1397
|
+
for ds in self.datasets:
|
|
1603
1398
|
if hasattr(ds, "_windows") and ds._windows is not None:
|
|
1604
1399
|
df = ds._windows.metadata
|
|
1605
1400
|
else:
|
|
@@ -1609,7 +1404,6 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1609
1404
|
df = df.copy()
|
|
1610
1405
|
for k, v in ds.description.items():
|
|
1611
1406
|
df[k] = v
|
|
1612
|
-
df["i_dataset"] = i_ds
|
|
1613
1407
|
all_dfs.append(df)
|
|
1614
1408
|
|
|
1615
1409
|
return pd.concat(all_dfs)
|
|
@@ -1878,8 +1672,7 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1878
1672
|
kwargs_path = os.path.join(path, ".".join([kwarg_name, "json"]))
|
|
1879
1673
|
kwargs = getattr(self, kwarg_name)
|
|
1880
1674
|
if kwargs is not None:
|
|
1881
|
-
|
|
1882
|
-
json.dump(kwargs, f)
|
|
1675
|
+
json.dump(kwargs, open(kwargs_path, "w"))
|
|
1883
1676
|
|
|
1884
1677
|
@property
|
|
1885
1678
|
def description(self) -> pd.DataFrame:
|
|
@@ -1902,11 +1695,6 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1902
1695
|
dataset description.
|
|
1903
1696
|
"""
|
|
1904
1697
|
description = pd.DataFrame(description)
|
|
1905
|
-
if len(description.columns) and len(description) != len(self.datasets):
|
|
1906
|
-
raise ValueError(
|
|
1907
|
-
f"Length of values ({len(description)}) does not match "
|
|
1908
|
-
f"number of datasets ({len(self.datasets)})."
|
|
1909
|
-
)
|
|
1910
1698
|
for key, value in description.items():
|
|
1911
1699
|
for ds, value_ in zip(self.datasets, value):
|
|
1912
1700
|
ds.set_description({key: value_}, overwrite=overwrite)
|
|
@@ -1937,9 +1725,7 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1937
1725
|
-raw.fif | -epo.fif and .json files to.
|
|
1938
1726
|
overwrite : bool
|
|
1939
1727
|
Whether to delete old subdirectories that will be saved to in this
|
|
1940
|
-
call.
|
|
1941
|
-
``ValueError`` is raised before anything is deleted: load the data
|
|
1942
|
-
into memory first (``preload=True``) or save to another directory.
|
|
1728
|
+
call.
|
|
1943
1729
|
offset : int
|
|
1944
1730
|
If provided, the integer is added to the id of the dataset in the
|
|
1945
1731
|
concat. This is useful in the setting of very large datasets, where
|
|
@@ -1952,13 +1738,6 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1952
1738
|
hasattr(self.datasets[0], "raw") or hasattr(self.datasets[0], "windows")
|
|
1953
1739
|
):
|
|
1954
1740
|
raise ValueError("dataset should have either raw or windows attribute")
|
|
1955
|
-
if overwrite:
|
|
1956
|
-
for _, _, target_dir in _overwrite_conflicts(self.datasets, path, offset):
|
|
1957
|
-
raise ValueError(
|
|
1958
|
-
f"Saving with overwrite=True would delete {target_dir} while "
|
|
1959
|
-
"a dataset still reads its data from it. Load the data into "
|
|
1960
|
-
"memory first (preload=True) or save to another directory."
|
|
1961
|
-
)
|
|
1962
1741
|
|
|
1963
1742
|
# Create path if it doesn't exist
|
|
1964
1743
|
os.makedirs(path, exist_ok=True)
|
{braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/mne.py
RENAMED
|
@@ -159,11 +159,6 @@ def create_from_mne_epochs(
|
|
|
159
159
|
|
|
160
160
|
list_of_windows_ds = []
|
|
161
161
|
for i, epochs in enumerate(list_of_epochs):
|
|
162
|
-
# drop rejected epochs first (on a copy) so that iterating over the
|
|
163
|
-
# epochs stays aligned with ``epochs.events``; preloaded epochs have
|
|
164
|
-
# already dropped them, so skip copying their data
|
|
165
|
-
if not epochs.preload:
|
|
166
|
-
epochs = epochs.copy().drop_bad()
|
|
167
162
|
event_descriptions = epochs.events[:, 2]
|
|
168
163
|
original_trial_starts = epochs.events[:, 0]
|
|
169
164
|
stop = len(epochs.times) - window_size_samples
|
{braindecode-1.8.1.dev182039595 → braindecode-1.8.1.dev182199177}/braindecode/datasets/tuh.py
RENAMED
|
@@ -122,8 +122,7 @@ class TUH(BaseConcatDataset):
|
|
|
122
122
|
# Assume it is an integer specifying number
|
|
123
123
|
# of recordings to load
|
|
124
124
|
recording_ids = range(recording_ids)
|
|
125
|
-
|
|
126
|
-
descriptions = descriptions.iloc[:, list(recording_ids)]
|
|
125
|
+
descriptions = descriptions[recording_ids]
|
|
127
126
|
|
|
128
127
|
# workaround to ensure warnings are suppressed when running in parallel
|
|
129
128
|
def create_dataset(*args, **kwargs):
|
|
@@ -242,11 +241,7 @@ class TUH(BaseConcatDataset):
|
|
|
242
241
|
# file paths, use this instead as before
|
|
243
242
|
if "year" in description:
|
|
244
243
|
meas_date = meas_date.replace(*description[["year", "month", "day"]])
|
|
245
|
-
|
|
246
|
-
# 2038-01-19 only: undated recordings (year 1 above) and de-identified ones
|
|
247
|
-
# (TUAB has 1899-12-30) keep their date in the description only.
|
|
248
|
-
in_fif_range = -(2**31) <= meas_date.timestamp() < 2**31
|
|
249
|
-
raw.set_meas_date(meas_date if in_fif_range else None)
|
|
244
|
+
raw.set_meas_date(meas_date)
|
|
250
245
|
|
|
251
246
|
d = {
|
|
252
247
|
"age": int(age),
|
|
@@ -256,9 +251,9 @@ class TUH(BaseConcatDataset):
|
|
|
256
251
|
# if not, get it from meas_date in raw.info and add to description
|
|
257
252
|
# if meas_date is None, create fake one
|
|
258
253
|
if "year" not in description:
|
|
259
|
-
d["year"] = meas_date.year
|
|
260
|
-
d["month"] = meas_date.month
|
|
261
|
-
d["day"] = meas_date.day
|
|
254
|
+
d["year"] = raw.info["meas_date"].year
|
|
255
|
+
d["month"] = raw.info["meas_date"].month
|
|
256
|
+
d["day"] = raw.info["meas_date"].day
|
|
262
257
|
|
|
263
258
|
# read info relevant for preprocessing from raw without loading it
|
|
264
259
|
if add_physician_reports:
|
|
@@ -21,7 +21,6 @@ from ..datasets.base import (
|
|
|
21
21
|
EEGWindowsDataset,
|
|
22
22
|
RawDataset,
|
|
23
23
|
WindowsDataset,
|
|
24
|
-
_compact_fif_tags,
|
|
25
24
|
)
|
|
26
25
|
|
|
27
26
|
|
|
@@ -80,8 +79,7 @@ def _outdated_load_concat_dataset(path, preload, ids_to_load=None, target_name=N
|
|
|
80
79
|
for path in paths:
|
|
81
80
|
if is_raw and target_name is None:
|
|
82
81
|
target_file_name = path / "target_name.json"
|
|
83
|
-
|
|
84
|
-
target_name = json.load(f)["target_name"]
|
|
82
|
+
target_name = json.load(open(target_file_name, "r"))["target_name"]
|
|
85
83
|
|
|
86
84
|
all_signals, description = _load_signals_and_description(
|
|
87
85
|
path=path, preload=preload, is_raw=is_raw, ids_to_load=ids_to_load
|
|
@@ -140,19 +138,15 @@ def _load_signals(fif_file, preload, is_raw):
|
|
|
140
138
|
with open(pkl_file, "rb") as f:
|
|
141
139
|
signals = pickle.load(f)
|
|
142
140
|
|
|
143
|
-
|
|
144
|
-
# this fif file, not to the folder the dataset was copied from.
|
|
145
|
-
if all(Path(f).exists() for f in signals.filenames) and (
|
|
146
|
-
Path(signals.filenames[0]).resolve() == fif_file.resolve()
|
|
147
|
-
):
|
|
141
|
+
if all(Path(f).exists() for f in signals.filenames):
|
|
148
142
|
if preload:
|
|
149
143
|
signals.load_data()
|
|
150
|
-
return
|
|
144
|
+
return signals
|
|
151
145
|
else: # This may happen if the file has been moved together with the pickle file.
|
|
152
146
|
warnings.warn(
|
|
153
147
|
f"Pickle file {pkl_file} exists, but the referenced fif "
|
|
154
|
-
"file(s) do not exist
|
|
155
|
-
"
|
|
148
|
+
"file(s) do not exist. Will read the fif file(s) directly "
|
|
149
|
+
"and re-create the pickle file.",
|
|
156
150
|
UserWarning,
|
|
157
151
|
)
|
|
158
152
|
|
|
@@ -177,8 +171,7 @@ def _load_signals(fif_file, preload, is_raw):
|
|
|
177
171
|
if preload:
|
|
178
172
|
signals._data, signals.preload = data, True
|
|
179
173
|
|
|
180
|
-
|
|
181
|
-
return _compact_fif_tags(signals)
|
|
174
|
+
return signals
|
|
182
175
|
|
|
183
176
|
|
|
184
177
|
def load_concat_dataset(path, preload, ids_to_load=None, target_name=None, n_jobs=1):
|
|
@@ -224,10 +217,7 @@ def load_concat_dataset(path, preload, ids_to_load=None, target_name=None, n_job
|
|
|
224
217
|
# target_name.json, raw_preproc_kwargs.json, window_kwargs.json,
|
|
225
218
|
# window_preproc_kwargs.json
|
|
226
219
|
if ids_to_load is None:
|
|
227
|
-
|
|
228
|
-
ids_to_load = [
|
|
229
|
-
p.name for p in path.iterdir() if p.is_dir() and p.name.isdigit()
|
|
230
|
-
]
|
|
220
|
+
ids_to_load = [p.name for p in path.iterdir()]
|
|
231
221
|
ids_to_load = sorted(ids_to_load, key=lambda i: int(i))
|
|
232
222
|
ids_to_load = [str(i) for i in ids_to_load]
|
|
233
223
|
first_raw_fif_path = path / ids_to_load[0] / f"{ids_to_load[0]}-raw.fif"
|
|
@@ -274,8 +264,7 @@ def _load_parallel(path, i, preload, is_raw, has_stored_windows):
|
|
|
274
264
|
target_file_path = sub_dir / "target_name.json"
|
|
275
265
|
target_name = None
|
|
276
266
|
if target_file_path.exists():
|
|
277
|
-
|
|
278
|
-
target_name = json.load(f)["target_name"]
|
|
267
|
+
target_name = json.load(open(target_file_path, "r"))["target_name"]
|
|
279
268
|
|
|
280
269
|
if is_raw and (not has_stored_windows):
|
|
281
270
|
dataset = RawDataset(signals, description, target_name)
|
|
@@ -315,8 +304,8 @@ def _load_kwargs_json(kwargs_name, sub_dir):
|
|
|
315
304
|
kwargs_file_name = ".".join([kwargs_name, "json"])
|
|
316
305
|
kwargs_file_path = os.path.join(sub_dir, kwargs_file_name)
|
|
317
306
|
if os.path.exists(kwargs_file_path):
|
|
318
|
-
|
|
319
|
-
|
|
307
|
+
kwargs = json.load(open(kwargs_file_path, "r"))
|
|
308
|
+
return kwargs
|
|
320
309
|
|
|
321
310
|
|
|
322
311
|
def _is_outdated_saved(path):
|