braindecode 2.1.0.dev182447370__tar.gz → 2.1.0.dev182653083__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.
Files changed (239) hide show
  1. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/NOTICE.txt +5 -0
  2. {braindecode-2.1.0.dev182447370/braindecode.egg-info → braindecode-2.1.0.dev182653083}/PKG-INFO +26 -10
  3. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/README.rst +22 -7
  4. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/augmentation/functional.py +1 -3
  5. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/augmentation/transforms.py +1 -1
  6. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/classifier.py +11 -0
  7. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datasets/base.py +105 -53
  8. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datasets/bids/hub.py +15 -1
  9. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datasets/tuh.py +31 -19
  10. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datasets/utils.py +15 -0
  11. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datautil/hub_formats.py +76 -15
  12. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datautil/serialization.py +8 -1
  13. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datautil/util.py +50 -12
  14. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/functional/__init__.py +12 -0
  15. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/functional/_real_dft.py +4 -4
  16. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/functional/attention.py +4 -14
  17. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/functional/channel_mask.py +27 -0
  18. braindecode-2.1.0.dev182653083/braindecode/functional/channels.py +294 -0
  19. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/functional/functions.py +55 -33
  20. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/functional/patches.py +17 -9
  21. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/__init__.py +7 -0
  22. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/attn_sleep.py +40 -6
  23. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/axon.py +9 -1
  24. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/base.py +91 -17
  25. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/bbl.py +16 -0
  26. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/bendr.py +13 -3
  27. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/biot.py +11 -9
  28. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/brainmodule.py +1 -13
  29. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/brainomni.py +63 -1
  30. braindecode-2.1.0.dev182653083/braindecode/models/caresleepnet.py +356 -0
  31. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/cbramod.py +19 -1
  32. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/codebrain.py +15 -19
  33. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/corteg.py +18 -0
  34. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/csbrain.py +32 -1
  35. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/duin.py +8 -0
  36. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/eeg_clip.py +27 -0
  37. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/eegpt.py +10 -3
  38. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/eegtcnet.py +31 -4
  39. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/emg2qwerty.py +8 -2
  40. braindecode-2.1.0.dev182653083/braindecode/models/fnirs4d.py +761 -0
  41. braindecode-2.1.0.dev182653083/braindecode/models/fnirs_cnn1d.py +339 -0
  42. braindecode-2.1.0.dev182653083/braindecode/models/fnirs_t.py +785 -0
  43. braindecode-2.1.0.dev182653083/braindecode/models/fnirsnet.py +374 -0
  44. braindecode-2.1.0.dev182653083/braindecode/models/geonirs.py +1563 -0
  45. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/guetschel2026.py +1 -1
  46. braindecode-2.1.0.dev182653083/braindecode/models/jung_mae.py +624 -0
  47. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/labram.py +1 -1
  48. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/luna.py +44 -34
  49. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/mapa.py +32 -5
  50. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/medformer.py +16 -1
  51. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/meggpt.py +33 -1
  52. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/megxl.py +23 -0
  53. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/meta_neuromotor.py +3 -1
  54. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/mirepnet.py +8 -0
  55. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/model.html.jinja +24 -9
  56. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/msvtnet.py +1 -2
  57. braindecode-2.1.0.dev182653083/braindecode/models/mtrenirs.py +1071 -0
  58. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/neurorvq.py +25 -0
  59. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/neurorvq_tokenizer.py +16 -0
  60. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/patchedtransformer.py +44 -16
  61. braindecode-2.1.0.dev182653083/braindecode/models/pratibha2.py +518 -0
  62. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/reve.py +26 -7
  63. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/signal_jepa.py +34 -6
  64. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/sleepfm.py +105 -23
  65. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/summary.csv +7 -0
  66. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/syncnet.py +20 -8
  67. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/tfm_tokenizer.py +11 -0
  68. braindecode-2.1.0.dev182653083/braindecode/models/tinymyo.py +367 -0
  69. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/util.py +50 -2
  70. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/vemg2pose.py +2 -1
  71. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/zuna.py +19 -25
  72. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/modules/attention.py +47 -6
  73. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/modules/blocks.py +15 -35
  74. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/modules/channels.py +243 -57
  75. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/modules/filter.py +54 -24
  76. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/modules/layers.py +7 -9
  77. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/preprocessing/mne_preprocess.py +5 -1
  78. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/preprocessing/preprocess.py +4 -0
  79. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/preprocessing/windowers.py +14 -6
  80. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/samplers/ssl.py +8 -10
  81. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/training/losses.py +83 -18
  82. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/util.py +29 -36
  83. braindecode-2.1.0.dev182653083/braindecode/version.py +1 -0
  84. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/visualization/attribution.py +25 -6
  85. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/visualization/frequency.py +22 -3
  86. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/visualization/metrics.py +2 -7
  87. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/visualization/sanity.py +8 -6
  88. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083/braindecode.egg-info}/PKG-INFO +26 -10
  89. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode.egg-info/SOURCES.txt +8 -0
  90. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode.egg-info/requires.txt +3 -2
  91. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/api.rst +31 -6
  92. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/cite.rst +25 -7
  93. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/conf.py +3 -1
  94. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/install/gaudi.rst +15 -0
  95. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/install/install_pip.rst +3 -3
  96. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/install/install_source.rst +3 -3
  97. braindecode-2.1.0.dev182653083/docs/user_guide/channel_strategies.rst +110 -0
  98. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/whats_new.rst +475 -19
  99. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/pyproject.toml +3 -3
  100. braindecode-2.1.0.dev182447370/braindecode/models/fnirs4d.py +0 -419
  101. braindecode-2.1.0.dev182447370/braindecode/models/fnirs_t.py +0 -477
  102. braindecode-2.1.0.dev182447370/braindecode/models/fnirsnet.py +0 -192
  103. braindecode-2.1.0.dev182447370/braindecode/version.py +0 -1
  104. braindecode-2.1.0.dev182447370/docs/user_guide/channel_strategies.rst +0 -59
  105. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/LICENSE.txt +0 -0
  106. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/MANIFEST.in +0 -0
  107. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/__init__.py +0 -0
  108. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/augmentation/__init__.py +0 -0
  109. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/augmentation/base.py +0 -0
  110. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datasets/__init__.py +0 -0
  111. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datasets/_notebook_viewer.py +0 -0
  112. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datasets/bbci.py +0 -0
  113. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datasets/bcicomp.py +0 -0
  114. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datasets/bids/__init__.py +0 -0
  115. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datasets/bids/datasets.py +0 -0
  116. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datasets/bids/hub_format.py +0 -0
  117. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datasets/bids/hub_io.py +0 -0
  118. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datasets/bids/hub_validation.py +0 -0
  119. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datasets/bids/iterable.py +0 -0
  120. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datasets/chb_mit.py +0 -0
  121. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datasets/collate.py +0 -0
  122. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datasets/mne.py +0 -0
  123. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datasets/moabb.py +0 -0
  124. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datasets/nmt.py +0 -0
  125. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datasets/registry.py +0 -0
  126. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datasets/siena.py +0 -0
  127. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datasets/sleep_physio_challe_18.py +0 -0
  128. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datasets/sleep_physionet.py +0 -0
  129. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datasets/xy.py +0 -0
  130. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datautil/__init__.py +0 -0
  131. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/datautil/channel_utils.py +0 -0
  132. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/eegneuralnet.py +0 -0
  133. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/functional/_lfilter.py +0 -0
  134. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/functional/initialization.py +0 -0
  135. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/atcnet.py +0 -0
  136. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/attentionbasenet.py +0 -0
  137. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/barista.py +0 -0
  138. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/brainbert.py +0 -0
  139. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/brant.py +0 -0
  140. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/config.py +0 -0
  141. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/contrawr.py +0 -0
  142. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/ctnet.py +0 -0
  143. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/dance.py +0 -0
  144. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/deep4.py +0 -0
  145. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/deepsleepnet.py +0 -0
  146. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/dgcnn.py +0 -0
  147. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/diver1.py +0 -0
  148. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/eegconformer.py +0 -0
  149. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/eegdino.py +0 -0
  150. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/eeginception_erp.py +0 -0
  151. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/eeginception_mi.py +0 -0
  152. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/eegitnet.py +0 -0
  153. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/eegminer.py +0 -0
  154. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/eegnet.py +0 -0
  155. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/eegnex.py +0 -0
  156. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/eegsimpleconv.py +0 -0
  157. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/eegsym.py +0 -0
  158. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/epint.py +0 -0
  159. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/fbcnet.py +0 -0
  160. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/fblightconvnet.py +0 -0
  161. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/fbmsnet.py +0 -0
  162. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/gcnsnet.py +0 -0
  163. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/hybrid.py +0 -0
  164. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/ifnet.py +0 -0
  165. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/mscformer.py +0 -0
  166. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/mvpformer.py +0 -0
  167. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/neuropose.py +0 -0
  168. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/nice.py +0 -0
  169. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/popt.py +0 -0
  170. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/sccnet.py +0 -0
  171. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/seizure_transformer.py +0 -0
  172. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/sensingdynamics.py +0 -0
  173. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/shallow_fbcsp.py +0 -0
  174. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/sinc_shallow.py +0 -0
  175. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/sleep_stager_blanco_2020.py +0 -0
  176. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/sleep_stager_chambon_2018.py +0 -0
  177. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/sparcnet.py +0 -0
  178. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/sstdpn.py +0 -0
  179. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/steegformer.py +0 -0
  180. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/tccnet.py +0 -0
  181. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/tcformer.py +0 -0
  182. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/tcn.py +0 -0
  183. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/tidnet.py +0 -0
  184. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/tmsanet.py +0 -0
  185. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/tsinception.py +0 -0
  186. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/models/usleep.py +0 -0
  187. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/modules/__init__.py +0 -0
  188. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/modules/activation.py +0 -0
  189. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/modules/convolution.py +0 -0
  190. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/modules/dance_modules.py +0 -0
  191. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/modules/linear.py +0 -0
  192. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/modules/linear_attention.py +0 -0
  193. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/modules/parametrization.py +0 -0
  194. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/modules/quantization.py +0 -0
  195. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/modules/seanet.py +0 -0
  196. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/modules/stats.py +0 -0
  197. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/modules/util.py +0 -0
  198. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/modules/wrapper.py +0 -0
  199. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/preprocessing/__init__.py +0 -0
  200. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/preprocessing/eegprep_preprocess.py +0 -0
  201. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/preprocessing/util.py +0 -0
  202. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/regressor.py +0 -0
  203. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/samplers/__init__.py +0 -0
  204. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/samplers/base.py +0 -0
  205. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/training/__init__.py +0 -0
  206. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/training/_trial_aggregation.py +0 -0
  207. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/training/callbacks.py +0 -0
  208. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/training/scoring.py +0 -0
  209. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/visualization/__init__.py +0 -0
  210. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/visualization/activations.py +0 -0
  211. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/visualization/confusion_matrices.py +0 -0
  212. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode/visualization/topology.py +0 -0
  213. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode.egg-info/dependency_links.txt +0 -0
  214. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/braindecode.egg-info/top_level.txt +0 -0
  215. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/Makefile +0 -0
  216. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/_templates/autosummary/class.rst +0 -0
  217. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/_templates/autosummary/class_in_subdir.rst +0 -0
  218. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/_templates/autosummary/function.rst +0 -0
  219. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/_templates/autosummary/function_in_subdir.rst +0 -0
  220. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/agent_docs.rst +0 -0
  221. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/help.rst +0 -0
  222. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/index.rst +0 -0
  223. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/install/install.rst +0 -0
  224. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/models/categorization/attention.rst +0 -0
  225. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/models/categorization/channel.rst +0 -0
  226. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/models/categorization/convolution.rst +0 -0
  227. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/models/categorization/filterbank.rst +0 -0
  228. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/models/categorization/gnn.rst +0 -0
  229. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/models/categorization/interpretable.rst +0 -0
  230. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/models/categorization/lbm.rst +0 -0
  231. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/models/categorization/recurrent.rst +0 -0
  232. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/models/categorization/spd.rst +0 -0
  233. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/models/models.rst +0 -0
  234. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/models/models_categorization.rst +0 -0
  235. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/models/models_table.rst +0 -0
  236. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/models/models_visualization.rst +0 -0
  237. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/sg_execution_times.rst +0 -0
  238. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/docs/user_guide/cropped_inference.rst +0 -0
  239. {braindecode-2.1.0.dev182447370 → braindecode-2.1.0.dev182653083}/setup.cfg +0 -0
@@ -38,6 +38,7 @@ same noncommercial ShareAlike terms.
38
38
 
39
39
  The following components are licensed under the MIT License:
40
40
 
41
+ - `braindecode/models/caresleepnet.py`
41
42
  - `braindecode/models/ctnet.py`
42
43
  - `braindecode/models/dance.py`
43
44
  - `braindecode/models/duin.py`
@@ -64,6 +65,7 @@ The following components are licensed under the MIT License:
64
65
  - `braindecode/models/nice.py`
65
66
  - `braindecode/models/fnirs_t.py`
66
67
  - `docs/_static/model/fnirst.png` (wzhlearning/fNIRS-Transformer `fig/model.png`)
68
+ - `braindecode/models/mtrenirs.py`
67
69
  - `braindecode/models/tccnet.py`
68
70
  - `docs/_static/model/tccnet.png`
69
71
 
@@ -83,9 +85,11 @@ whose average-over-time and context-attention layers come from
83
85
  The following components are licensed under the Apache License 2.0:
84
86
 
85
87
  - `braindecode/models/axon.py`
88
+ - `braindecode/models/pratibha2.py`
86
89
  - `braindecode/models/mvpformer.py`
87
90
  - `braindecode/models/zuna.py`
88
91
  - `braindecode/models/luna.py`
92
+ - `braindecode/models/tinymyo.py`
89
93
  - `braindecode/models/mapa.py`
90
94
  - `braindecode/models/brant.py`
91
95
  - `braindecode/models/diver1.py`
@@ -101,6 +105,7 @@ Creative Commons Attribution 4.0 International License (each docstring
101
105
  cites the paper):
102
106
 
103
107
  - `docs/_static/model/fnirsnet.png` (Wang et al., IEEE TNSRE 2023, Fig. 2, cropped)
108
+ - `docs/_static/model/mtrenirs.png` (Chae et al., arXiv:2610.36159, Fig. 2, cropped)
104
109
 
105
110
  ### USC Academic License Files
106
111
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: braindecode
3
- Version: 2.1.0.dev182447370
3
+ Version: 2.1.0.dev182653083
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>
@@ -24,7 +24,7 @@ License-File: LICENSE.txt
24
24
  License-File: NOTICE.txt
25
25
  Requires-Dist: torch>=2.6
26
26
  Requires-Dist: torchaudio>=2.6
27
- Requires-Dist: mne>=1.11.0
27
+ Requires-Dist: mne>=1.13.0
28
28
  Requires-Dist: mne_bids>=0.19
29
29
  Requires-Dist: h5py
30
30
  Requires-Dist: skorch>=1.3.1
@@ -44,6 +44,7 @@ Requires-Dist: torch>=2.7; python_version < "3.12" and extra == "eegprep"
44
44
  Provides-Extra: hub
45
45
  Requires-Dist: huggingface_hub[torch]>=0.20.0; extra == "hub"
46
46
  Requires-Dist: zarr>=3.1; extra == "hub"
47
+ Requires-Dist: filelock; extra == "hub"
47
48
  Provides-Extra: viz
48
49
  Requires-Dist: captum>=0.7.0; extra == "viz"
49
50
  Provides-Extra: sae
@@ -57,6 +58,7 @@ Requires-Dist: codecov; extra == "tests"
57
58
  Requires-Dist: pytest_cases; extra == "tests"
58
59
  Requires-Dist: mypy; extra == "tests"
59
60
  Requires-Dist: ipython; extra == "tests"
61
+ Requires-Dist: PyYAML; extra == "tests"
60
62
  Requires-Dist: transformers>=4.57.0; extra == "tests"
61
63
  Requires-Dist: bids_validator; extra == "tests"
62
64
  Provides-Extra: typing
@@ -84,7 +86,6 @@ Requires-Dist: pre-commit; extra == "docs"
84
86
  Requires-Dist: openneuro-py>=2026.4.0; extra == "docs"
85
87
  Requires-Dist: plotly; extra == "docs"
86
88
  Requires-Dist: shap; extra == "docs"
87
- Requires-Dist: nbformat; extra == "docs"
88
89
  Requires-Dist: transformers; extra == "docs"
89
90
  Provides-Extra: all
90
91
  Requires-Dist: braindecode[moabb]; extra == "all"
@@ -96,8 +97,8 @@ Requires-Dist: braindecode[typing]; extra == "all"
96
97
  Requires-Dist: braindecode[viz]; extra == "all"
97
98
  Dynamic: license-file
98
99
 
99
- .. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.17699192.svg
100
- :target: https://doi.org/10.5281/zenodo.17699192
100
+ .. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.8214376.svg
101
+ :target: https://doi.org/10.5281/zenodo.8214376
101
102
  :alt: DOI
102
103
 
103
104
  .. image:: https://github.com/braindecode/braindecode/workflows/docs/badge.svg
@@ -188,15 +189,15 @@ https://github.com/braindecode/braindecode/blob/master/CONTRIBUTING.md
188
189
  If you use Braindecode in scientific work, please cite the software using the global
189
190
  Zenodo DOI shown in the badge below:
190
191
 
191
- .. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.17699192.svg
192
- :target: https://doi.org/10.5281/zenodo.17699192
192
+ .. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.8214376.svg
193
+ :target: https://doi.org/10.5281/zenodo.8214376
193
194
  :alt: DOI
194
195
 
195
196
  You can use the following BibTeX entry:
196
197
 
197
198
  .. code-block:: bibtex
198
199
 
199
- @software{braindecode,
200
+ @misc{braindecode,
200
201
  author = {Aristimunha, Bruno and
201
202
  Guetschel, Pierre and
202
203
  Wimpff, Martin and
@@ -208,17 +209,32 @@ You can use the following BibTeX entry:
208
209
  Brandt, Simon and
209
210
  Gnassounou, Théo and
210
211
  Paillard, Joseph and
212
+ Srivastava, Aman and
211
213
  {Junqueira Lopes}, Bruna and
212
214
  Sedlar, Sara and
215
+ Tayal, Sarthak and
216
+ Truong, Young and
217
+ Gadonneix, Julien and
218
+ Mounir, Adam and
219
+ Zhang, Zhibo and
220
+ Soloviev, Anton and
221
+ Li, Qing and
222
+ Rathi, Raghav and
223
+ Shah, Vandit and
224
+ Arthur and
225
+ Jain, Mahir and
226
+ Kowshik, Bhargav and
227
+ Li, Yiheng and
228
+ Siddique, Fashad Ahmed and
213
229
  Moreau, Thomas and
214
230
  Chevallier, Sylvain and
215
231
  Gramfort, Alexandre and
216
232
  Schirrmeister, Robin Tibor},
217
233
  title = {Braindecode: toolbox for decoding raw electrophysiological brain data
218
234
  with deep learning models},
235
+ howpublished = {Zenodo},
219
236
  url = {https://github.com/braindecode/braindecode},
220
- doi = {10.5281/zenodo.17699192},
221
- publisher = {Zenodo},
237
+ doi = {10.5281/zenodo.8214376},
222
238
  license = {BSD-3-Clause},
223
239
  }
224
240
 
@@ -1,5 +1,5 @@
1
- .. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.17699192.svg
2
- :target: https://doi.org/10.5281/zenodo.17699192
1
+ .. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.8214376.svg
2
+ :target: https://doi.org/10.5281/zenodo.8214376
3
3
  :alt: DOI
4
4
 
5
5
  .. image:: https://github.com/braindecode/braindecode/workflows/docs/badge.svg
@@ -90,15 +90,15 @@ https://github.com/braindecode/braindecode/blob/master/CONTRIBUTING.md
90
90
  If you use Braindecode in scientific work, please cite the software using the global
91
91
  Zenodo DOI shown in the badge below:
92
92
 
93
- .. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.17699192.svg
94
- :target: https://doi.org/10.5281/zenodo.17699192
93
+ .. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.8214376.svg
94
+ :target: https://doi.org/10.5281/zenodo.8214376
95
95
  :alt: DOI
96
96
 
97
97
  You can use the following BibTeX entry:
98
98
 
99
99
  .. code-block:: bibtex
100
100
 
101
- @software{braindecode,
101
+ @misc{braindecode,
102
102
  author = {Aristimunha, Bruno and
103
103
  Guetschel, Pierre and
104
104
  Wimpff, Martin and
@@ -110,17 +110,32 @@ You can use the following BibTeX entry:
110
110
  Brandt, Simon and
111
111
  Gnassounou, Théo and
112
112
  Paillard, Joseph and
113
+ Srivastava, Aman and
113
114
  {Junqueira Lopes}, Bruna and
114
115
  Sedlar, Sara and
116
+ Tayal, Sarthak and
117
+ Truong, Young and
118
+ Gadonneix, Julien and
119
+ Mounir, Adam and
120
+ Zhang, Zhibo and
121
+ Soloviev, Anton and
122
+ Li, Qing and
123
+ Rathi, Raghav and
124
+ Shah, Vandit and
125
+ Arthur and
126
+ Jain, Mahir and
127
+ Kowshik, Bhargav and
128
+ Li, Yiheng and
129
+ Siddique, Fashad Ahmed and
115
130
  Moreau, Thomas and
116
131
  Chevallier, Sylvain and
117
132
  Gramfort, Alexandre and
118
133
  Schirrmeister, Robin Tibor},
119
134
  title = {Braindecode: toolbox for decoding raw electrophysiological brain data
120
135
  with deep learning models},
136
+ howpublished = {Zenodo},
121
137
  url = {https://github.com/braindecode/braindecode},
122
- doi = {10.5281/zenodo.17699192},
123
- publisher = {Zenodo},
138
+ doi = {10.5281/zenodo.8214376},
124
139
  license = {BSD-3-Clause},
125
140
  }
126
141
 
@@ -206,8 +206,6 @@ def ft_surrogate(
206
206
  device=device,
207
207
  random_state=random_state,
208
208
  )
209
- if not channel_indep:
210
- random_phase = torch.tile(random_phase, (1, f.shape[-2], 1))
211
209
  if isinstance(phase_noise_magnitude, torch.Tensor):
212
210
  phase_noise_magnitude = phase_noise_magnitude.to(device)
213
211
  f_shifted = f * torch.exp(phase_noise_magnitude * random_phase)
@@ -1030,7 +1028,7 @@ def sensors_rotation(
1030
1028
  ``mne`` through::
1031
1029
 
1032
1030
  >>> ten_twenty_montage = mne.channels.make_standard_montage(
1033
- ... 'standard_1020' # 'colin27_1020' on MNE >= 1.13
1031
+ ... 'colin27_1020'
1034
1032
  ... ).get_positions()['ch_pos']
1035
1033
  axis : 'x' | 'y' | 'z'
1036
1034
  Axis around which to rotate.
@@ -740,7 +740,7 @@ class SensorsRotation(Transform):
740
740
  `mne` through::
741
741
 
742
742
  >>> ten_twenty_montage = mne.channels.make_standard_montage(
743
- ... 'standard_1020' # 'colin27_1020' on MNE >= 1.13
743
+ ... 'colin27_1020'
744
744
  ... ).get_positions()['ch_pos']
745
745
 
746
746
  axis : 'x' | 'y' | 'z', optional
@@ -12,9 +12,11 @@ import warnings
12
12
  from skorch import NeuralNet
13
13
  from skorch.callbacks import EpochScoring
14
14
  from skorch.classifier import NeuralNetClassifier
15
+ from torch import Tensor
15
16
  from torch.nn import CrossEntropyLoss
16
17
 
17
18
  from .eegneuralnet import _EEGNeuralNet
19
+ from .training.losses import CroppedLoss, _class_target
18
20
  from .training.scoring import predict_trials
19
21
  from .util import ThrowAwayIndexLoader, update_estimator_docstring
20
22
 
@@ -173,6 +175,15 @@ class EEGClassifier(_EEGNeuralNet, NeuralNetClassifier):
173
175
  loss : float
174
176
  The loss value.
175
177
  """
178
+ # CroppedLoss pools logits before comparing them with trial targets.
179
+ # Composite inputs have their own target dtype contract in the loader.
180
+ if (
181
+ isinstance(y_pred, Tensor)
182
+ and isinstance(y_true, Tensor)
183
+ and not isinstance(self.criterion_, CroppedLoss)
184
+ and not isinstance(kwargs.get("X"), (tuple, list))
185
+ ):
186
+ y_true = _class_target(y_pred, y_true)
176
187
  return NeuralNet.get_loss(self, y_pred, y_true, *args, **kwargs)
177
188
 
178
189
  def predict(self, X):
@@ -26,7 +26,7 @@ from itertools import chain
26
26
  from operator import attrgetter
27
27
  from pathlib import Path
28
28
  from typing import Any, Generic, Iterable, no_type_check
29
- from uuid import uuid4
29
+ from uuid import UUID, uuid4
30
30
 
31
31
  import mne
32
32
  import mne.io
@@ -204,6 +204,19 @@ def _channel_info(mne_obj):
204
204
  return n_ch, type_str, sfreq
205
205
 
206
206
 
207
+ def _check_window_targets(targets_from, info):
208
+ if targets_from not in ("metadata", "channels"):
209
+ raise ValueError("Wrong value for parameter `targets_from`.")
210
+ if targets_from == "channels":
211
+ if not isinstance(info, mne.Info): # lazy Zarr stores hold serialized Info
212
+ info = mne.Info.from_json_dict(info)
213
+ if "misc" not in info.get_channel_types():
214
+ raise ValueError(
215
+ "targets_from='channels' requires a misc channel in the selected channels."
216
+ )
217
+ return targets_from
218
+
219
+
207
220
  def _compute_ch_pos(info, targets_from):
208
221
  """Return ``(n_ch, 3)`` float32 electrode positions aligned to ``X``'s rows.
209
222
 
@@ -500,20 +513,23 @@ def _zarr_to_memmap(zarr_path, group_name):
500
513
  so they can never collide with a live writer, they are never
501
514
  read by the fast path, and they do not prevent subsequent
502
515
  callers from producing a correct result. Caches written by
503
- earlier braindecode versions remain valid: the fast path only
504
- requires ``<group>.npy`` to exist.
516
+ earlier braindecode versions remain valid for stores without a store ID.
517
+ New stores have a separate cache for each export, including overwrites.
505
518
  """
506
- zarr_p = Path(zarr_path)
519
+ zarr_p = Path(zarr_path).absolute()
507
520
  cache_dir = zarr_p.parent / f".{zarr_p.name}_memmap"
521
+ store_stat = zarr_p.stat()
522
+ root = zarr.open(str(zarr_p), mode="r")
523
+ store_id = root.attrs.get("store_id")
524
+ if store_id is not None:
525
+ cache_dir /= UUID(store_id).hex
508
526
  npy_path = cache_dir / f"{group_name}.npy"
509
527
 
510
- # Fast path: the file is already fully materialised. A single
511
- # stat() is all the steady-state workload pays.
512
528
  if npy_path.exists():
513
529
  return npy_path
514
530
 
515
531
  cache_dir.mkdir(parents=True, exist_ok=True)
516
- arr = zarr.open(zarr_path, mode="r")[group_name]["data"]
532
+ arr = root[group_name]["data"]
517
533
  # Unique per call, not per pid: threads of one process must not share it.
518
534
  # Exclusive creation, not tempfile.mkstemp, which would make it 0600.
519
535
  tmp_path = cache_dir / f"{group_name}.{uuid4().hex}.tmp.npy"
@@ -533,6 +549,11 @@ def _zarr_to_memmap(zarr_path, group_name):
533
549
  finally:
534
550
  del mm
535
551
 
552
+ # A reader on read-only media may be unable to acquire the store lock.
553
+ # Never publish a mixture of chunks under the previous store's ID.
554
+ if not os.path.samestat(store_stat, zarr_p.stat()):
555
+ raise OSError(f"Zarr store {zarr_p} changed while populating its cache.")
556
+
536
557
  # Atomic publication. ``os.link`` never replaces an existing
537
558
  # destination, so the published inode is immutable for the
538
559
  # lifetime of the cache directory. Concurrent readers never
@@ -567,7 +588,14 @@ class _ZarrMixin:
567
588
  _zarr_data = None
568
589
 
569
590
  def _open_zarr(self):
570
- npy_path = _zarr_to_memmap(self._zarr_path, self._group_name)
591
+ npy_path = getattr(self, "_zarr_cache_path", None)
592
+ if npy_path is None or not npy_path.exists():
593
+ current = _zarr_to_memmap(self._zarr_path, self._group_name)
594
+ if npy_path is not None and current != npy_path:
595
+ raise FileNotFoundError(
596
+ f"The cache for the original Zarr store was removed: {npy_path}"
597
+ )
598
+ self._zarr_cache_path = npy_path = current
571
599
  # 'c' = copy-on-write: reads from file, writes to RAM
572
600
  self._zarr_data = np.load(npy_path, mmap_mode="c")
573
601
 
@@ -870,9 +898,7 @@ class EEGWindowsDataset(_ZarrMixin, RecordDataset):
870
898
  self.metadata = metadata
871
899
 
872
900
  self.last_target_only = last_target_only
873
- if targets_from not in ("metadata", "channels"):
874
- raise ValueError("Wrong value for parameter `targets_from`.")
875
- self.targets_from = targets_from
901
+ self.targets_from = _check_window_targets(targets_from, raw.info)
876
902
  self.crop_inds = metadata.loc[
877
903
  :, ["i_window_in_trial", "i_start_in_trial", "i_stop_in_trial"]
878
904
  ].to_numpy()
@@ -899,9 +925,7 @@ class EEGWindowsDataset(_ZarrMixin, RecordDataset):
899
925
  obj._raw = None
900
926
  obj.metadata = metadata
901
927
  obj.last_target_only = last_target_only
902
- if targets_from not in ("metadata", "channels"):
903
- raise ValueError("Wrong value for parameter `targets_from`.")
904
- obj.targets_from = targets_from
928
+ obj.targets_from = _check_window_targets(targets_from, info_dict)
905
929
  obj.crop_inds = metadata.loc[
906
930
  :, ["i_window_in_trial", "i_start_in_trial", "i_stop_in_trial"]
907
931
  ].to_numpy()
@@ -960,6 +984,10 @@ class EEGWindowsDataset(_ZarrMixin, RecordDataset):
960
984
  i_window_in_trial, i_start, i_stop = crop_inds
961
985
  if self._zarr_data is not None:
962
986
  X = self._zarr_data[:, i_start:i_stop]
987
+ elif isinstance(self.raw, mne.io.BaseRaw) and self.raw.preload:
988
+ # what raw._getitem returns, without parsing the picks on every call
989
+ # (an Epochs' 3-D _data must not be sliced as channels x times)
990
+ X = self.raw._data[:, i_start:i_stop]
963
991
  else:
964
992
  X = _read_fif_window(self.raw, i_start, i_stop)
965
993
  if X is None:
@@ -976,7 +1004,10 @@ class EEGWindowsDataset(_ZarrMixin, RecordDataset):
976
1004
  if self.targets_from == "metadata":
977
1005
  y = self.y[index]
978
1006
  else:
979
- misc_mask = np.array(self.raw.get_channel_types()) == "misc"
1007
+ # same as get_channel_types() == "misc", which is slow to call per window
1008
+ misc_mask = np.array(
1009
+ [ch["kind"] == FIFF.FIFFV_MISC_CH for ch in self.raw.info["chs"]]
1010
+ )
980
1011
  if self.last_target_only:
981
1012
  y = X[misc_mask, -1]
982
1013
  else:
@@ -1133,9 +1164,7 @@ class WindowsDataset(_ZarrMixin, RecordDataset):
1133
1164
  )
1134
1165
  self.windows = windows
1135
1166
  self.last_target_only = last_target_only
1136
- if targets_from not in ("metadata", "channels"):
1137
- raise ValueError("Wrong value for parameter `targets_from`.")
1138
- self.targets_from = targets_from
1167
+ self.targets_from = _check_window_targets(targets_from, windows.info)
1139
1168
 
1140
1169
  metadata = self.windows.metadata
1141
1170
  assert metadata is not None, "WindowsDataset requires windows with metadata."
@@ -1169,9 +1198,7 @@ class WindowsDataset(_ZarrMixin, RecordDataset):
1169
1198
  obj.target_name = target_name
1170
1199
  obj._fast_disk = False
1171
1200
  obj.last_target_only = last_target_only
1172
- if targets_from not in ("metadata", "channels"):
1173
- raise ValueError("Wrong value for parameter `targets_from`.")
1174
- obj.targets_from = targets_from
1201
+ obj.targets_from = _check_window_targets(targets_from, info_dict)
1175
1202
  obj.metadata = metadata
1176
1203
  obj.crop_inds = metadata.loc[
1177
1204
  :, ["i_window_in_trial", "i_start_in_trial", "i_stop_in_trial"]
@@ -1649,7 +1676,11 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
1649
1676
  BaseConcatDataset, with the metadata and description information
1650
1677
  for each window, and an ``i_dataset`` column giving the position
1651
1678
  in ``datasets`` of the dataset (recording) each window comes from.
1652
- Samplers use it to keep recordings apart.
1679
+ Samplers use it to keep recordings apart. If a recording description
1680
+ and a window have a column with the same name, the window value is
1681
+ retained. The recording value remains accessible on the dataset's
1682
+ description. For lazy fixed windows this accessor materializes the
1683
+ table. It reports the stored labels before any ``target_transform``.
1653
1684
  """
1654
1685
  if not all(
1655
1686
  [
@@ -1662,7 +1693,8 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
1662
1693
  "datasets are WindowsDataset."
1663
1694
  )
1664
1695
 
1665
- for ds in self.datasets:
1696
+ all_dfs = []
1697
+ for i_ds, ds in enumerate(self.datasets):
1666
1698
  if hasattr(ds, "_windows") and ds._windows is not None:
1667
1699
  df = ds._windows.metadata
1668
1700
  else:
@@ -1684,18 +1716,19 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
1684
1716
  "position of the dataset each window comes from. Rename it."
1685
1717
  )
1686
1718
 
1687
- all_dfs = list()
1688
- for i_ds, ds in enumerate(self.datasets):
1689
- if hasattr(ds, "_windows") and ds._windows is not None:
1690
- df = ds._windows.metadata
1691
- else:
1692
- df = ds.metadata
1693
1719
  if isinstance(df, pd.DataFrame):
1694
- # copy so the description columns stay out of the dataset
1695
1720
  df = df.copy()
1696
- description = ds.description if ds.description is not None else {}
1721
+ else:
1722
+ # Only this public accessor materializes fixed-window lazy metadata.
1723
+ df = pd.DataFrame(
1724
+ {
1725
+ col: [df.loc[i, col] for i in range(len(df))]
1726
+ for col in df.columns
1727
+ }
1728
+ )
1697
1729
  for k, v in description.items():
1698
- df[k] = v
1730
+ if k not in df.columns:
1731
+ df[k] = v
1699
1732
  df["i_dataset"] = i_ds
1700
1733
  all_dfs.append(df)
1701
1734
 
@@ -1761,6 +1794,8 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
1761
1794
  no-op since ``__getitem__`` reads y from misc channels, not
1762
1795
  from ``metadata['target']``).
1763
1796
  """
1797
+ windows_to_update = []
1798
+ raw_to_update = []
1764
1799
  for i, ds in enumerate(self.datasets):
1765
1800
  if isinstance(ds, (WindowsDataset, EEGWindowsDataset)):
1766
1801
  if not isinstance(ds.metadata, pd.DataFrame):
@@ -1803,19 +1838,15 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
1803
1838
  f"metadata cols={list(md.columns)}, "
1804
1839
  f"description keys={desc_keys}."
1805
1840
  )
1806
- # In-place write so the WindowsDataset's metadata and the
1807
- # underlying mne.Epochs.metadata (which start as the same
1808
- # object reference) both reflect the new target. Defensive
1809
- # second write covers the case where they got de-aliased
1810
- # earlier by a caller-side reassignment.
1811
- md["target"] = values
1812
- windows_obj = getattr(ds, "_windows", None)
1813
- if windows_obj is not None and windows_obj.metadata is not md:
1814
- windows_obj.metadata["target"] = values
1815
- # values is already a fresh list (Series.to_list() / [x] * n);
1816
- # no defensive copy needed — pandas keeps its own representation
1817
- # for md["target"] so mutating ds.y won't reach back into it.
1818
- ds.y = values
1841
+ frames = [md]
1842
+ epochs = getattr(ds, "_windows", None)
1843
+ if epochs is not None and epochs.metadata is not md:
1844
+ frames.append(epochs.metadata)
1845
+ if any(frame is None or len(frame) != len(values) for frame in frames):
1846
+ raise ValueError(
1847
+ f"Window metadata must have one row per window in datasets[{i}]."
1848
+ )
1849
+ windows_to_update.append((ds, frames, values))
1819
1850
  elif isinstance(ds, RawDataset):
1820
1851
  if (
1821
1852
  not isinstance(ds.description, pd.Series)
@@ -1830,12 +1861,19 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
1830
1861
  f"Column {column!r} not found on datasets[{i}] "
1831
1862
  f"description (keys={desc_keys})."
1832
1863
  )
1833
- ds.target_name = column
1864
+ raw_to_update.append(ds)
1834
1865
  else:
1835
1866
  raise TypeError(
1836
1867
  "set_target requires WindowsDataset, EEGWindowsDataset, "
1837
1868
  f"or RawDataset; datasets[{i}] is {type(ds).__name__}."
1838
1869
  )
1870
+ # Preserve shared DataFrame objects while changing all recordings together.
1871
+ for ds, frames, values in windows_to_update:
1872
+ for frame in frames:
1873
+ frame["target"] = values
1874
+ ds.y = values
1875
+ for ds in raw_to_update:
1876
+ ds.target_name = column
1839
1877
  return self
1840
1878
 
1841
1879
  def set_return_ch_pos(self, value: bool = True) -> "BaseConcatDataset":
@@ -2129,6 +2167,8 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
2129
2167
  @staticmethod
2130
2168
  def _save_description(sub_dir, description):
2131
2169
  description_file_path = os.path.join(sub_dir, "description.json")
2170
+ if description is None:
2171
+ description = pd.Series(dtype=object)
2132
2172
  description.to_json(description_file_path, default_handler=str)
2133
2173
 
2134
2174
  @staticmethod
@@ -2138,13 +2178,25 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
2138
2178
  "window_kwargs",
2139
2179
  "window_preproc_kwargs",
2140
2180
  ]:
2141
- if hasattr(ds, kwargs_name):
2142
- kwargs_file_name = ".".join([kwargs_name, "json"])
2143
- kwargs_file_path = os.path.join(sub_dir, kwargs_file_name)
2144
- kwargs = getattr(ds, kwargs_name)
2145
- if kwargs is not None:
2146
- with open(kwargs_file_path, "w") as f:
2147
- json.dump(kwargs, f, indent=2)
2181
+ kwargs = getattr(ds, kwargs_name, None)
2182
+ if (
2183
+ kwargs_name == "window_kwargs"
2184
+ and not kwargs
2185
+ and isinstance(ds, (EEGWindowsDataset, WindowsDataset))
2186
+ ):
2187
+ # Directly constructed windows have no windower history.
2188
+ cls = (
2189
+ EEGWindowsDataset
2190
+ if isinstance(ds, EEGWindowsDataset)
2191
+ else WindowsDataset
2192
+ )
2193
+ settings = dict(
2194
+ targets_from=ds.targets_from, last_target_only=ds.last_target_only
2195
+ )
2196
+ kwargs = [(cls.__name__, settings)]
2197
+ if kwargs is not None:
2198
+ with open(os.path.join(sub_dir, f"{kwargs_name}.json"), "w") as f:
2199
+ json.dump(kwargs, f, indent=2)
2148
2200
 
2149
2201
  @staticmethod
2150
2202
  def _save_target_name(sub_dir, ds):
@@ -35,6 +35,7 @@ import tempfile
35
35
  from datetime import timedelta
36
36
  from pathlib import Path
37
37
  from typing import TYPE_CHECKING, List, Optional, Union
38
+ from uuid import uuid4
38
39
 
39
40
  import mne
40
41
  import numpy as np
@@ -769,6 +770,7 @@ class HubDatasetMixin:
769
770
  # Store global metadata
770
771
  root.attrs["n_datasets"] = len(self.datasets)
771
772
  root.attrs["dataset_type"] = dataset_type
773
+ root.attrs["store_id"] = uuid4().hex
772
774
  root.attrs["braindecode_version"] = braindecode.__version__
773
775
 
774
776
  # Track dependency versions for reproducibility
@@ -805,6 +807,8 @@ class HubDatasetMixin:
805
807
  compressor,
806
808
  target_name,
807
809
  )
810
+ grp.attrs["targets_from"] = ds.targets_from
811
+ grp.attrs["last_target_only"] = ds.last_target_only
808
812
 
809
813
  elif dataset_type == "EEGWindowsDataset":
810
814
  # Get continuous raw data and metadata from EEGWindowsDataset
@@ -913,6 +917,9 @@ class HubDatasetMixin:
913
917
  data, metadata, description, info_dict, target_name = (
914
918
  _load_windows_from_zarr(grp, preload)
915
919
  )
920
+ # Stores written before these attributes existed used metadata.
921
+ targets_from = grp.attrs.get("targets_from", "metadata")
922
+ last_target_only = grp.attrs.get("last_target_only", True)
916
923
 
917
924
  if preload:
918
925
  # Convert to MNE objects and create dataset
@@ -932,7 +939,12 @@ class HubDatasetMixin:
932
939
  epochs = mne.EpochsArray(
933
940
  data, info, events=events, metadata=metadata
934
941
  )
935
- ds = WindowsDataset(epochs, description)
942
+ ds = WindowsDataset(
943
+ epochs,
944
+ description,
945
+ targets_from=targets_from,
946
+ last_target_only=last_target_only,
947
+ )
936
948
  if target_name is not None:
937
949
  ds.target_name = target_name
938
950
  else:
@@ -943,6 +955,8 @@ class HubDatasetMixin:
943
955
  description=description,
944
956
  info_dict=info_dict,
945
957
  target_name=target_name,
958
+ targets_from=targets_from,
959
+ last_target_only=last_target_only,
946
960
  )
947
961
 
948
962
  elif dataset_type == "EEGWindowsDataset":