Braindecode 1.8.0__tar.gz → 1.8.0.dev580__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.0.dev580/NOTICE.txt +25 -0
- {braindecode-1.8.0/braindecode.egg-info → braindecode-1.8.0.dev580}/PKG-INFO +5 -8
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/README.rst +3 -6
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/augmentation/base.py +1 -25
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/augmentation/functional.py +4 -2
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/augmentation/transforms.py +3 -5
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datasets/base.py +0 -18
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datasets/bids/hub.py +25 -90
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datasets/bids/hub_io.py +5 -67
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/functional/functions.py +3 -4
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/atcnet.py +2 -2
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/attn_sleep.py +28 -87
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/base.py +4 -68
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/brainmodule.py +1 -1
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/ctnet.py +7 -10
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/dance.py +10 -2
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/eegconformer.py +1 -1
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/eegminer.py +1 -2
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/eegsimpleconv.py +7 -9
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/emg2qwerty.py +133 -9
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/ifnet.py +6 -10
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/luna.py +5 -31
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/medformer.py +1 -1
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/meta_neuromotor.py +1 -1
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/mvpformer.py +1 -1
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/sleep_stager_blanco_2020.py +9 -5
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/sleep_stager_chambon_2018.py +7 -1
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/sparcnet.py +2 -2
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/sstdpn.py +1 -1
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/summary.csv +1 -1
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/tcformer.py +1 -1
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/tidnet.py +7 -1
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/usleep.py +7 -3
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/zuna.py +12 -26
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/modules/__init__.py +2 -14
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/modules/blocks.py +0 -213
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/preprocessing/windowers.py +30 -126
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/samplers/base.py +2 -40
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/training/losses.py +4 -7
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/util.py +10 -16
- braindecode-1.8.0.dev580/braindecode/version.py +1 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/visualization/__init__.py +0 -6
- {braindecode-1.8.0 → braindecode-1.8.0.dev580/braindecode.egg-info}/PKG-INFO +5 -8
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode.egg-info/SOURCES.txt +0 -2
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode.egg-info/requires.txt +1 -1
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/api.rst +0 -12
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/whats_new.rst +3 -146
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/pyproject.toml +1 -1
- braindecode-1.8.0/NOTICE.txt +0 -65
- braindecode-1.8.0/braindecode/datasets/_notebook_viewer.py +0 -255
- braindecode-1.8.0/braindecode/version.py +0 -1
- braindecode-1.8.0/braindecode/visualization/activations.py +0 -77
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/LICENSE.txt +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/MANIFEST.in +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/__init__.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/augmentation/__init__.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/classifier.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datasets/__init__.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datasets/bbci.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datasets/bcicomp.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datasets/bids/__init__.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datasets/bids/datasets.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datasets/bids/format.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datasets/bids/hub_format.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datasets/bids/hub_validation.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datasets/bids/iterable.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datasets/chb_mit.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datasets/collate.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datasets/mne.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datasets/moabb.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datasets/nmt.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datasets/registry.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datasets/siena.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datasets/sleep_physio_challe_18.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datasets/sleep_physionet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datasets/tuh.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datasets/utils.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datasets/xy.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datautil/__init__.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datautil/channel_utils.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datautil/hub_formats.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datautil/serialization.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/datautil/util.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/eegneuralnet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/functional/__init__.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/functional/initialization.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/__init__.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/attentionbasenet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/bendr.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/biot.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/cbramod.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/codebrain.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/config.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/contrawr.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/deep4.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/deepsleepnet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/dgcnn.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/eegdino.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/eeginception_erp.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/eeginception_mi.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/eegitnet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/eegnet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/eegnex.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/eegpt.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/eegsym.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/eegtcnet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/fbcnet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/fblightconvnet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/fbmsnet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/hybrid.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/interpolated.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/labram.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/msvtnet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/patchedtransformer.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/reve.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/sccnet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/shallow_fbcsp.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/signal_jepa.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/sinc_shallow.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/steegformer.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/syncnet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/tcn.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/tsinception.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/models/util.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/modules/activation.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/modules/attention.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/modules/convolution.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/modules/dance_modules.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/modules/filter.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/modules/interpolation.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/modules/layers.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/modules/linear.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/modules/parametrization.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/modules/stats.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/modules/util.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/modules/wrapper.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/preprocessing/__init__.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/preprocessing/eegprep_preprocess.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/preprocessing/mne_preprocess.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/preprocessing/preprocess.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/preprocessing/util.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/regressor.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/samplers/__init__.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/samplers/ssl.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/training/__init__.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/training/callbacks.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/training/scoring.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/visualization/attribution.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/visualization/confusion_matrices.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/visualization/frequency.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/visualization/metrics.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/visualization/sanity.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode/visualization/topology.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode.egg-info/dependency_links.txt +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/braindecode.egg-info/top_level.txt +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/Makefile +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/_templates/autosummary/class.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/_templates/autosummary/class_in_subdir.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/_templates/autosummary/function.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/_templates/autosummary/function_in_subdir.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/cite.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/conf.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/help.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/index.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/install/install.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/install/install_pip.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/install/install_source.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/models/categorization/attention.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/models/categorization/channel.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/models/categorization/convolution.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/models/categorization/filterbank.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/models/categorization/gnn.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/models/categorization/interpretable.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/models/categorization/lbm.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/models/categorization/recurrent.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/models/categorization/spd.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/models/models.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/models/models_categorization.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/models/models_table.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/models/models_visualization.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/docs/sg_execution_times.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev580}/setup.cfg +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# BRAINDECODE Notice
|
|
2
|
+
|
|
3
|
+
## Licensed Components
|
|
4
|
+
|
|
5
|
+
### BSD-3-Clause Licensed Files
|
|
6
|
+
|
|
7
|
+
All files within the `src/` directory are licensed under the BSD-3-Clause License.
|
|
8
|
+
|
|
9
|
+
### CC BY-NC 4.0 Licensed Files
|
|
10
|
+
|
|
11
|
+
The following components are licensed under the Creative Commons Attribution-NonCommercial 4.0 International License:
|
|
12
|
+
|
|
13
|
+
- `braindecode/models/eegminer.py`
|
|
14
|
+
- `braindecode/models/meta_neuromotor.py`
|
|
15
|
+
|
|
16
|
+
As well as class later imported into the `braindecode.models.module` named as GeneralizedGaussianFilter.
|
|
17
|
+
|
|
18
|
+
The `meta_neuromotor.py` file is a derivative of
|
|
19
|
+
`facebookresearch/generic-neuromotor-interface`, released by Meta Platforms,
|
|
20
|
+
Inc. under CC BY-NC 4.0, and inherits the same noncommercial terms.
|
|
21
|
+
|
|
22
|
+
## License Links
|
|
23
|
+
|
|
24
|
+
- [BSD-3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
|
|
25
|
+
- [CC BY-NC 4.0 License](https://creativecommons.org/licenses/by-nc/4.0/)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: braindecode
|
|
3
|
-
Version: 1.8.0
|
|
3
|
+
Version: 1.8.0.dev580
|
|
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>
|
|
@@ -34,6 +34,7 @@ Requires-Dist: pandas
|
|
|
34
34
|
Requires-Dist: wfdb>=4.3.1
|
|
35
35
|
Requires-Dist: linear_attention_transformer
|
|
36
36
|
Requires-Dist: docstring_inheritance
|
|
37
|
+
Requires-Dist: rotary_embedding_torch
|
|
37
38
|
Requires-Dist: pydantic>=2.0
|
|
38
39
|
Provides-Extra: moabb
|
|
39
40
|
Requires-Dist: moabb>=1.4.3; extra == "moabb"
|
|
@@ -50,7 +51,6 @@ Requires-Dist: pytest-cov; extra == "tests"
|
|
|
50
51
|
Requires-Dist: codecov; extra == "tests"
|
|
51
52
|
Requires-Dist: pytest_cases; extra == "tests"
|
|
52
53
|
Requires-Dist: mypy; extra == "tests"
|
|
53
|
-
Requires-Dist: ipython; extra == "tests"
|
|
54
54
|
Requires-Dist: transformers>=4.57.0; extra == "tests"
|
|
55
55
|
Requires-Dist: bids_validator; extra == "tests"
|
|
56
56
|
Provides-Extra: typing
|
|
@@ -260,10 +260,7 @@ This project is primarily licensed under the BSD-3-Clause License.
|
|
|
260
260
|
Additional Components
|
|
261
261
|
=====================
|
|
262
262
|
|
|
263
|
-
Some components within this repository are licensed under
|
|
264
|
-
|
|
265
|
-
Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0), MIT
|
|
266
|
-
and Apache-2.0.
|
|
263
|
+
Some components within this repository are licensed under the Creative Commons
|
|
264
|
+
Attribution-NonCommercial 4.0 International License.
|
|
267
265
|
|
|
268
|
-
Please refer to the ``LICENSE`` and ``NOTICE`` files for
|
|
269
|
-
detailed information.
|
|
266
|
+
Please refer to the ``LICENSE`` and ``NOTICE`` files for more detailed information.
|
|
@@ -170,10 +170,7 @@ This project is primarily licensed under the BSD-3-Clause License.
|
|
|
170
170
|
Additional Components
|
|
171
171
|
=====================
|
|
172
172
|
|
|
173
|
-
Some components within this repository are licensed under
|
|
174
|
-
|
|
175
|
-
Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0), MIT
|
|
176
|
-
and Apache-2.0.
|
|
173
|
+
Some components within this repository are licensed under the Creative Commons
|
|
174
|
+
Attribution-NonCommercial 4.0 International License.
|
|
177
175
|
|
|
178
|
-
Please refer to the ``LICENSE`` and ``NOTICE`` files for
|
|
179
|
-
detailed information.
|
|
176
|
+
Please refer to the ``LICENSE`` and ``NOTICE`` files for more detailed information.
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
# Bruno Aristimunha <b.aristimunha@gmail.com>
|
|
4
4
|
# Martin Wimpff <martin.wimpff@iss.uni-stuttgart.de>
|
|
5
5
|
# Valentin Iovene <val@too.gy>
|
|
6
|
-
# Sarthak Tayal <sarthaktayal2@gmail.com>
|
|
7
6
|
# License: BSD (3-clause)
|
|
8
7
|
|
|
9
8
|
from numbers import Real
|
|
@@ -177,14 +176,6 @@ class Compose(Transform):
|
|
|
177
176
|
return X, y
|
|
178
177
|
|
|
179
178
|
|
|
180
|
-
def _as_mixed_target(y, lam_dtype):
|
|
181
|
-
# an untouched target is the same as being mixed with itself with lam of one
|
|
182
|
-
if isinstance(y, (tuple, list)) and len(y) == 3:
|
|
183
|
-
return tuple(y)
|
|
184
|
-
lam = torch.ones(y.shape[0], device=y.device, dtype=lam_dtype)
|
|
185
|
-
return y, y, lam
|
|
186
|
-
|
|
187
|
-
|
|
188
179
|
class _AugmentationCollate:
|
|
189
180
|
"""Collate that applies a transform to each batch, with optional expansion.
|
|
190
181
|
|
|
@@ -202,10 +193,7 @@ class _AugmentationCollate:
|
|
|
202
193
|
``0`` (default) applies the transform in place (batch size unchanged).
|
|
203
194
|
``> 0`` keeps the clean originals and appends ``n_augmentation``
|
|
204
195
|
independently transformed copies, returning ``(X, y)`` of
|
|
205
|
-
``(1 + n_augmentation)`` times the original size.
|
|
206
|
-
mixes targets, as :class:`braindecode.augmentation.Mixup` does, ``y``
|
|
207
|
-
stays the ``(y_a, y_b, lam)`` triple and the clean originals get a
|
|
208
|
-
mixing coefficient of one.
|
|
196
|
+
``(1 + n_augmentation)`` times the original size.
|
|
209
197
|
"""
|
|
210
198
|
|
|
211
199
|
def __init__(self, transform, device=None, n_augmentation=0):
|
|
@@ -228,18 +216,6 @@ class _AugmentationCollate:
|
|
|
228
216
|
aug_X, aug_y = self.transform(X, y)
|
|
229
217
|
xs.append(aug_X)
|
|
230
218
|
ys.append(aug_y)
|
|
231
|
-
mixed_ys = [
|
|
232
|
-
aug_y
|
|
233
|
-
for aug_y in ys
|
|
234
|
-
if isinstance(aug_y, (tuple, list)) and len(aug_y) == 3
|
|
235
|
-
]
|
|
236
|
-
if mixed_ys:
|
|
237
|
-
# a target-mixing transform such as Mixup returns (y_a, y_b, lam),
|
|
238
|
-
# so the parts are concatenated one by one and the untouched copies
|
|
239
|
-
# are given a mixing coefficient of one
|
|
240
|
-
lam_dtype = mixed_ys[0][2].dtype
|
|
241
|
-
ys = [_as_mixed_target(aug_y, lam_dtype) for aug_y in ys]
|
|
242
|
-
return torch.cat(xs), tuple(torch.cat(part) for part in zip(*ys))
|
|
243
219
|
return torch.cat(xs), torch.cat(ys)
|
|
244
220
|
|
|
245
221
|
|
|
@@ -1065,11 +1065,13 @@ def mixup(
|
|
|
1065
1065
|
batch_size, n_channels, n_times = X.shape
|
|
1066
1066
|
|
|
1067
1067
|
X_mix = torch.zeros((batch_size, n_channels, n_times)).to(device)
|
|
1068
|
-
y_a =
|
|
1069
|
-
y_b =
|
|
1068
|
+
y_a = torch.arange(batch_size).to(device)
|
|
1069
|
+
y_b = torch.arange(batch_size).to(device)
|
|
1070
1070
|
|
|
1071
1071
|
for idx in range(batch_size):
|
|
1072
1072
|
X_mix[idx] = lam[idx] * X[idx] + (1 - lam[idx]) * X[idx_perm[idx]]
|
|
1073
|
+
y_a[idx] = y[idx]
|
|
1074
|
+
y_b[idx] = y[idx_perm[idx]]
|
|
1073
1075
|
|
|
1074
1076
|
return X_mix, (y_a, y_b, lam)
|
|
1075
1077
|
|
|
@@ -1068,18 +1068,16 @@ class Mixup(Transform):
|
|
|
1068
1068
|
device = X.device
|
|
1069
1069
|
batch_size, _, _ = X.shape
|
|
1070
1070
|
|
|
1071
|
-
# lam follows the dtype of X, numpy draws float64 and that would leak
|
|
1072
|
-
# into the mixed signal and into the loss returned by mixup_criterion
|
|
1073
1071
|
if self.alpha > 0:
|
|
1074
1072
|
if self.beta_per_sample:
|
|
1075
1073
|
lam = torch.as_tensor(
|
|
1076
1074
|
self.rng.beta(self.alpha, self.alpha, batch_size)
|
|
1077
|
-
).to(device
|
|
1075
|
+
).to(device)
|
|
1078
1076
|
else:
|
|
1079
|
-
lam = torch.ones(batch_size
|
|
1077
|
+
lam = torch.ones(batch_size).to(device)
|
|
1080
1078
|
lam *= self.rng.beta(self.alpha, self.alpha)
|
|
1081
1079
|
else:
|
|
1082
|
-
lam = torch.ones(batch_size
|
|
1080
|
+
lam = torch.ones(batch_size).to(device)
|
|
1083
1081
|
|
|
1084
1082
|
idx_perm = torch.as_tensor(
|
|
1085
1083
|
self.rng.permutation(
|
|
@@ -32,7 +32,6 @@ from mne.utils.docs import deprecated
|
|
|
32
32
|
from torch.utils.data import ConcatDataset, Dataset, IterableDataset
|
|
33
33
|
from typing_extensions import TypeVar
|
|
34
34
|
|
|
35
|
-
from ._notebook_viewer import plot as _viewer_plot
|
|
36
35
|
from .bids.hub import HubDatasetMixin
|
|
37
36
|
from .bids.hub_io import _restore_nan_from_json
|
|
38
37
|
from .registry import register_dataset
|
|
@@ -60,7 +59,6 @@ def _html_row(label, value):
|
|
|
60
59
|
|
|
61
60
|
_METADATA_INTERNAL_COLS = {
|
|
62
61
|
"i_window_in_trial",
|
|
63
|
-
"i_trial_in_dataset",
|
|
64
62
|
"i_start_in_trial",
|
|
65
63
|
"i_stop_in_trial",
|
|
66
64
|
"target",
|
|
@@ -1175,8 +1173,6 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1175
1173
|
If True, defer computing cumulative sizes until length or item access.
|
|
1176
1174
|
"""
|
|
1177
1175
|
|
|
1178
|
-
plot = _viewer_plot # eegdash-viewer embed; a direct member so the API docs list it
|
|
1179
|
-
|
|
1180
1176
|
datasets: list[T]
|
|
1181
1177
|
|
|
1182
1178
|
def __init__(
|
|
@@ -1378,20 +1374,6 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1378
1374
|
"datasets are WindowsDataset."
|
|
1379
1375
|
)
|
|
1380
1376
|
|
|
1381
|
-
for ds in self.datasets:
|
|
1382
|
-
if hasattr(ds, "_windows") and ds._windows is not None:
|
|
1383
|
-
df = ds._windows.metadata
|
|
1384
|
-
else:
|
|
1385
|
-
df = ds.metadata
|
|
1386
|
-
if (
|
|
1387
|
-
"i_trial_in_dataset" in df.columns
|
|
1388
|
-
and "i_trial_in_dataset" in ds.description
|
|
1389
|
-
):
|
|
1390
|
-
raise ValueError(
|
|
1391
|
-
"Dataset descriptions cannot contain the reserved window "
|
|
1392
|
-
"metadata key 'i_trial_in_dataset'."
|
|
1393
|
-
)
|
|
1394
|
-
|
|
1395
1377
|
all_dfs = list()
|
|
1396
1378
|
for ds in self.datasets:
|
|
1397
1379
|
if hasattr(ds, "_windows") and ds._windows is not None:
|
|
@@ -28,7 +28,6 @@ The format follows a BIDS-inspired sourcedata structure:
|
|
|
28
28
|
# License: BSD (3-clause)
|
|
29
29
|
|
|
30
30
|
import contextlib
|
|
31
|
-
import copy
|
|
32
31
|
import json
|
|
33
32
|
import logging
|
|
34
33
|
import tempfile
|
|
@@ -57,7 +56,6 @@ from .hub_io import (
|
|
|
57
56
|
_load_eegwindows_from_zarr,
|
|
58
57
|
_load_raw_from_zarr,
|
|
59
58
|
_load_windows_from_zarr,
|
|
60
|
-
_prepare_info_for_json,
|
|
61
59
|
_save_eegwindows_to_zarr,
|
|
62
60
|
_save_raw_to_zarr,
|
|
63
61
|
_save_windows_to_zarr,
|
|
@@ -74,33 +72,6 @@ log = logging.getLogger(__name__)
|
|
|
74
72
|
_LOCK_FILE = "format_info.json"
|
|
75
73
|
|
|
76
74
|
|
|
77
|
-
def _normalize_kwargs_for_json(value, field_name):
|
|
78
|
-
"""Return one preprocessing-kwargs value as native strict JSON."""
|
|
79
|
-
|
|
80
|
-
def _convert(obj):
|
|
81
|
-
if isinstance(obj, np.ndarray):
|
|
82
|
-
return _convert(obj.tolist())
|
|
83
|
-
if isinstance(obj, dict):
|
|
84
|
-
return {key: _convert(item) for key, item in obj.items()}
|
|
85
|
-
if isinstance(obj, (list, tuple)):
|
|
86
|
-
return [_convert(item) for item in obj]
|
|
87
|
-
if isinstance(obj, np.generic):
|
|
88
|
-
return _convert(obj.item())
|
|
89
|
-
return obj
|
|
90
|
-
|
|
91
|
-
try:
|
|
92
|
-
converted = _convert(value)
|
|
93
|
-
if isinstance(converted, str):
|
|
94
|
-
raise ValueError(
|
|
95
|
-
"a root string is ambiguous with the legacy encoded format"
|
|
96
|
-
)
|
|
97
|
-
return json.loads(json.dumps(converted, allow_nan=False))
|
|
98
|
-
except (OverflowError, RecursionError, TypeError, ValueError) as error:
|
|
99
|
-
raise ValueError(
|
|
100
|
-
f"{field_name} must contain only finite JSON-serializable values"
|
|
101
|
-
) from error
|
|
102
|
-
|
|
103
|
-
|
|
104
75
|
class HubDatasetMixin:
|
|
105
76
|
"""
|
|
106
77
|
Mixin class for Hugging Face Hub integration with EEG datasets.
|
|
@@ -714,57 +685,14 @@ class HubDatasetMixin:
|
|
|
714
685
|
f"{output_path} already exists. Set overwrite=True to replace it."
|
|
715
686
|
)
|
|
716
687
|
|
|
688
|
+
# Create zarr store (zarr v3 API)
|
|
689
|
+
root = zarr.open(str(output_path), mode="w")
|
|
690
|
+
|
|
717
691
|
# Validate uniformity across all datasets using shared validation
|
|
718
692
|
dataset_type, _, _ = hub_validation.validate_dataset_uniformity(self.datasets)
|
|
719
693
|
|
|
720
|
-
#
|
|
721
|
-
|
|
722
|
-
prepared_infos = []
|
|
723
|
-
for ds in self.datasets:
|
|
724
|
-
if dataset_type == "WindowsDataset":
|
|
725
|
-
info = ds.windows.info
|
|
726
|
-
elif dataset_type in ("EEGWindowsDataset", "RawDataset"):
|
|
727
|
-
info = ds.raw.info
|
|
728
|
-
prepared_infos.append(_prepare_info_for_json(info.to_json_dict()))
|
|
729
|
-
|
|
730
|
-
prepared_kwargs = {}
|
|
731
|
-
for kwarg_name in [
|
|
732
|
-
"raw_preproc_kwargs",
|
|
733
|
-
"window_kwargs",
|
|
734
|
-
"window_preproc_kwargs",
|
|
735
|
-
]:
|
|
736
|
-
expected_present = hasattr(self.datasets[0], kwarg_name)
|
|
737
|
-
expected_value = None
|
|
738
|
-
expected_token = None
|
|
739
|
-
for i_ds, ds in enumerate(self.datasets):
|
|
740
|
-
present = hasattr(ds, kwarg_name)
|
|
741
|
-
if present != expected_present:
|
|
742
|
-
raise ValueError(
|
|
743
|
-
f"{kwarg_name} on dataset {i_ds} has inconsistent presence; "
|
|
744
|
-
"the Zarr format stores one global value"
|
|
745
|
-
)
|
|
746
|
-
if not present:
|
|
747
|
-
continue
|
|
748
|
-
value = _normalize_kwargs_for_json(
|
|
749
|
-
getattr(ds, kwarg_name), f"{kwarg_name} on dataset {i_ds}"
|
|
750
|
-
)
|
|
751
|
-
value_token = json.dumps(
|
|
752
|
-
value, sort_keys=True, separators=(",", ":"), allow_nan=False
|
|
753
|
-
)
|
|
754
|
-
if i_ds == 0:
|
|
755
|
-
expected_value = value
|
|
756
|
-
expected_token = value_token
|
|
757
|
-
elif value_token != expected_token:
|
|
758
|
-
raise ValueError(
|
|
759
|
-
f"{kwarg_name} on dataset {i_ds} differs from dataset 0; "
|
|
760
|
-
"the Zarr format stores one global value"
|
|
761
|
-
)
|
|
762
|
-
if expected_present:
|
|
763
|
-
prepared_kwargs[kwarg_name] = expected_value
|
|
764
|
-
|
|
765
|
-
# Create compressor and zarr store (zarr v3 API) only after preflight.
|
|
766
|
-
compressor = _create_compressor(compression, compression_level)
|
|
767
|
-
root = zarr.open(str(output_path), mode="w")
|
|
694
|
+
# Keep reference to first dataset for preprocessing kwargs
|
|
695
|
+
first_ds = self.datasets[0]
|
|
768
696
|
|
|
769
697
|
# Store global metadata
|
|
770
698
|
root.attrs["n_datasets"] = len(self.datasets)
|
|
@@ -778,10 +706,21 @@ class HubDatasetMixin:
|
|
|
778
706
|
root.attrs["zarr_version"] = zarr.__version__
|
|
779
707
|
root.attrs["scipy_version"] = scipy.__version__
|
|
780
708
|
|
|
781
|
-
# Save preprocessing kwargs
|
|
782
|
-
# typically set by windowing functions on individual datasets
|
|
783
|
-
for kwarg_name
|
|
784
|
-
|
|
709
|
+
# Save preprocessing kwargs (check first dataset, assuming uniform preprocessing)
|
|
710
|
+
# These are typically set by windowing functions on individual datasets
|
|
711
|
+
for kwarg_name in [
|
|
712
|
+
"raw_preproc_kwargs",
|
|
713
|
+
"window_kwargs",
|
|
714
|
+
"window_preproc_kwargs",
|
|
715
|
+
]:
|
|
716
|
+
# Check first dataset for these attributes
|
|
717
|
+
if hasattr(first_ds, kwarg_name):
|
|
718
|
+
kwargs = getattr(first_ds, kwarg_name)
|
|
719
|
+
if kwargs:
|
|
720
|
+
root.attrs[kwarg_name] = json.dumps(kwargs)
|
|
721
|
+
|
|
722
|
+
# Create compressor
|
|
723
|
+
compressor = _create_compressor(compression, compression_level)
|
|
785
724
|
|
|
786
725
|
# Save each recording
|
|
787
726
|
for i_ds, ds in enumerate(self.datasets):
|
|
@@ -792,7 +731,7 @@ class HubDatasetMixin:
|
|
|
792
731
|
data = ds.windows.get_data()
|
|
793
732
|
metadata = ds.windows.metadata
|
|
794
733
|
description = ds.description
|
|
795
|
-
info_dict =
|
|
734
|
+
info_dict = ds.windows.info.to_json_dict()
|
|
796
735
|
target_name = ds.target_name if hasattr(ds, "target_name") else None
|
|
797
736
|
|
|
798
737
|
# Save using inlined function
|
|
@@ -811,7 +750,7 @@ class HubDatasetMixin:
|
|
|
811
750
|
raw = ds.raw
|
|
812
751
|
metadata = ds.metadata
|
|
813
752
|
description = ds.description
|
|
814
|
-
info_dict =
|
|
753
|
+
info_dict = ds.raw.info.to_json_dict()
|
|
815
754
|
targets_from = ds.targets_from
|
|
816
755
|
last_target_only = ds.last_target_only
|
|
817
756
|
|
|
@@ -832,7 +771,7 @@ class HubDatasetMixin:
|
|
|
832
771
|
# Get continuous raw data from RawDataset
|
|
833
772
|
raw = ds.raw
|
|
834
773
|
description = ds.description
|
|
835
|
-
info_dict =
|
|
774
|
+
info_dict = ds.raw.info.to_json_dict()
|
|
836
775
|
target_name = ds.target_name if hasattr(ds, "target_name") else None
|
|
837
776
|
|
|
838
777
|
# Save using inlined function
|
|
@@ -1017,14 +956,10 @@ class HubDatasetMixin:
|
|
|
1017
956
|
"window_preproc_kwargs",
|
|
1018
957
|
]:
|
|
1019
958
|
if kwarg_name in root.attrs:
|
|
1020
|
-
kwargs = root.attrs[kwarg_name]
|
|
1021
|
-
if isinstance(kwargs, str):
|
|
1022
|
-
# Stores written by older braindecode versions kept
|
|
1023
|
-
# these attributes as double-encoded JSON strings.
|
|
1024
|
-
kwargs = json.loads(kwargs)
|
|
959
|
+
kwargs = json.loads(root.attrs[kwarg_name])
|
|
1025
960
|
# Set on each individual dataset (where they were originally stored)
|
|
1026
961
|
for ds in datasets:
|
|
1027
|
-
setattr(ds, kwarg_name,
|
|
962
|
+
setattr(ds, kwarg_name, kwargs)
|
|
1028
963
|
|
|
1029
964
|
return concat_ds
|
|
1030
965
|
|
|
@@ -8,7 +8,6 @@ These functions keep the Zarr serialization details isolated from hub.py.
|
|
|
8
8
|
from __future__ import annotations
|
|
9
9
|
|
|
10
10
|
import json
|
|
11
|
-
from numbers import Real
|
|
12
11
|
from pathlib import Path
|
|
13
12
|
|
|
14
13
|
import numpy as np
|
|
@@ -18,78 +17,17 @@ from mne.utils import _soft_import
|
|
|
18
17
|
zarr = _soft_import("zarr", purpose="hugging face integration", strict=False)
|
|
19
18
|
|
|
20
19
|
|
|
21
|
-
def _is_non_bool_real(value):
|
|
22
|
-
return not isinstance(value, (bool, np.bool_)) and isinstance(
|
|
23
|
-
value, (Real, np.integer, np.floating)
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def _prepare_info_for_json(obj, path="info", *, _in_numeric_sequence=False):
|
|
28
|
-
"""Normalize an MNE Info value to strict JSON without losing sequence NaNs."""
|
|
29
|
-
if isinstance(obj, np.ndarray):
|
|
30
|
-
obj = obj.tolist()
|
|
31
|
-
|
|
32
|
-
if isinstance(obj, dict):
|
|
33
|
-
return {
|
|
34
|
-
key: _prepare_info_for_json(value, f"{path}.{key}")
|
|
35
|
-
for key, value in obj.items()
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if isinstance(obj, (list, tuple)):
|
|
39
|
-
values = list(obj)
|
|
40
|
-
has_none = any(value is None for value in values)
|
|
41
|
-
has_number = any(_is_non_bool_real(value) for value in values)
|
|
42
|
-
all_none = bool(values) and all(value is None for value in values)
|
|
43
|
-
if all_none or (has_none and has_number):
|
|
44
|
-
raise ValueError(
|
|
45
|
-
f"{path} is ambiguous: numeric sequences cannot contain JSON null"
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
is_numeric_sequence = bool(values) and all(
|
|
49
|
-
_is_non_bool_real(value) for value in values
|
|
50
|
-
)
|
|
51
|
-
return [
|
|
52
|
-
_prepare_info_for_json(
|
|
53
|
-
value,
|
|
54
|
-
f"{path}[{index}]",
|
|
55
|
-
_in_numeric_sequence=is_numeric_sequence,
|
|
56
|
-
)
|
|
57
|
-
for index, value in enumerate(values)
|
|
58
|
-
]
|
|
59
|
-
|
|
60
|
-
if isinstance(obj, (bool, np.bool_)):
|
|
61
|
-
return bool(obj)
|
|
62
|
-
if isinstance(obj, (int, np.integer)):
|
|
63
|
-
return int(obj)
|
|
64
|
-
if _is_non_bool_real(obj):
|
|
65
|
-
value = float(obj)
|
|
66
|
-
if np.isnan(value):
|
|
67
|
-
if _in_numeric_sequence:
|
|
68
|
-
return None
|
|
69
|
-
raise ValueError(f"{path} contains unsupported NaN")
|
|
70
|
-
if np.isposinf(value):
|
|
71
|
-
raise ValueError(f"{path} contains positive infinity")
|
|
72
|
-
if np.isneginf(value):
|
|
73
|
-
raise ValueError(f"{path} contains negative infinity")
|
|
74
|
-
return value
|
|
75
|
-
if obj is None or isinstance(obj, str):
|
|
76
|
-
return obj
|
|
77
|
-
raise ValueError(f"{path} contains a non-JSON-serializable value")
|
|
78
|
-
|
|
79
|
-
|
|
80
20
|
def _restore_nan_from_json(obj):
|
|
81
|
-
"""Restore NaN values from None in
|
|
21
|
+
"""Restore NaN values from None in legacy zarr stores.
|
|
82
22
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
23
|
+
Datasets saved before zarr v3 native NaN support used
|
|
24
|
+
``_sanitize_for_json`` to convert NaN/Inf → None. This restores them
|
|
25
|
+
on load so ``mne.Info.from_json_dict`` gets proper NaN arrays.
|
|
86
26
|
"""
|
|
87
27
|
if isinstance(obj, dict):
|
|
88
28
|
return {k: _restore_nan_from_json(v) for k, v in obj.items()}
|
|
89
29
|
if isinstance(obj, list):
|
|
90
|
-
if len(obj) > 0 and all(
|
|
91
|
-
value is None or _is_non_bool_real(value) for value in obj
|
|
92
|
-
):
|
|
30
|
+
if len(obj) > 0 and all(isinstance(x, (int, float, type(None))) for x in obj):
|
|
93
31
|
return [np.nan if x is None else x for x in obj]
|
|
94
32
|
return [_restore_nan_from_json(v) for v in obj]
|
|
95
33
|
return obj
|
|
@@ -40,7 +40,7 @@ def drop_path(
|
|
|
40
40
|
x : torch.Tensor
|
|
41
41
|
input tensor
|
|
42
42
|
drop_prob : float, optional
|
|
43
|
-
probability of
|
|
43
|
+
survival rate (i.e. probability of being kept), by default 0.0
|
|
44
44
|
training : bool, optional
|
|
45
45
|
whether the model is in training mode, by default False
|
|
46
46
|
scale_by_keep : bool, optional
|
|
@@ -68,10 +68,9 @@ def drop_path(
|
|
|
68
68
|
shape = (x.shape[0],) + (1,) * (
|
|
69
69
|
x.ndim - 1
|
|
70
70
|
) # work with diff dim tensors, not just 2D ConvNets
|
|
71
|
-
|
|
72
|
-
random_tensor = torch.bernoulli(probabilities).to(dtype=x.dtype)
|
|
71
|
+
random_tensor = x.new_empty(shape).bernoulli_(keep_prob)
|
|
73
72
|
if keep_prob > 0.0 and scale_by_keep:
|
|
74
|
-
random_tensor
|
|
73
|
+
random_tensor.div_(keep_prob)
|
|
75
74
|
return x * random_tensor
|
|
76
75
|
|
|
77
76
|
|
|
@@ -196,7 +196,7 @@ class ATCNet(EEGModuleMixin, nn.Module):
|
|
|
196
196
|
num_heads : int
|
|
197
197
|
Number of attention heads, denoted H in table 1 of the paper [1]_.
|
|
198
198
|
Defaults to 2 as in [1]_.
|
|
199
|
-
|
|
199
|
+
att_dropout : float
|
|
200
200
|
Dropout probability used in the attention block, denoted pa in table 1
|
|
201
201
|
of the paper [1]_. Defaults to 0.5 as in [1]_.
|
|
202
202
|
tcn_depth : int
|
|
@@ -206,7 +206,7 @@ class ATCNet(EEGModuleMixin, nn.Module):
|
|
|
206
206
|
tcn_kernel_size : int
|
|
207
207
|
Temporal kernel size used in TCN block, denoted Kt in table 1 of the
|
|
208
208
|
paper [1]_. Defaults to 4 as in [1]_.
|
|
209
|
-
|
|
209
|
+
tcn_dropout : float
|
|
210
210
|
Dropout probability used in the TCN block, denoted pt in table 1
|
|
211
211
|
of the paper [1]_. Defaults to 0.3 as in [1]_.
|
|
212
212
|
tcn_activation : torch.nn.Module
|