Braindecode 1.3.0.dev175368549__py3-none-any.whl → 1.3.0.dev175415232__py3-none-any.whl

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 (76) hide show
  1. braindecode/augmentation/base.py +1 -1
  2. braindecode/datasets/__init__.py +4 -12
  3. braindecode/datasets/base.py +152 -131
  4. braindecode/datasets/bcicomp.py +4 -4
  5. braindecode/datasets/bids.py +3 -3
  6. braindecode/datasets/experimental.py +2 -2
  7. braindecode/datasets/mne.py +5 -3
  8. braindecode/datasets/moabb.py +7 -17
  9. braindecode/datasets/nmt.py +2 -2
  10. braindecode/datasets/sleep_physio_challe_18.py +2 -2
  11. braindecode/datasets/sleep_physionet.py +2 -2
  12. braindecode/datasets/tuh.py +2 -2
  13. braindecode/datasets/xy.py +2 -2
  14. braindecode/datautil/__init__.py +1 -11
  15. braindecode/datautil/serialization.py +8 -7
  16. braindecode/eegneuralnet.py +0 -2
  17. braindecode/functional/functions.py +2 -6
  18. braindecode/functional/initialization.py +3 -2
  19. braindecode/models/__init__.py +1 -14
  20. braindecode/models/atcnet.py +27 -26
  21. braindecode/models/attentionbasenet.py +32 -39
  22. braindecode/models/attn_sleep.py +0 -2
  23. braindecode/models/base.py +2 -280
  24. braindecode/models/biot.py +0 -2
  25. braindecode/models/contrawr.py +0 -2
  26. braindecode/models/ctnet.py +3 -8
  27. braindecode/models/deepsleepnet.py +19 -28
  28. braindecode/models/eegconformer.py +2 -2
  29. braindecode/models/eeginception_erp.py +25 -31
  30. braindecode/models/eegitnet.py +0 -2
  31. braindecode/models/eegminer.py +0 -2
  32. braindecode/models/eegnet.py +1 -1
  33. braindecode/models/eegtcnet.py +0 -2
  34. braindecode/models/fbcnet.py +1 -5
  35. braindecode/models/fblightconvnet.py +0 -2
  36. braindecode/models/fbmsnet.py +6 -20
  37. braindecode/models/ifnet.py +0 -2
  38. braindecode/models/labram.py +87 -193
  39. braindecode/models/msvtnet.py +0 -2
  40. braindecode/models/patchedtransformer.py +1 -1
  41. braindecode/models/signal_jepa.py +27 -111
  42. braindecode/models/sinc_shallow.py +9 -12
  43. braindecode/models/sstdpn.py +11 -11
  44. braindecode/models/summary.csv +0 -4
  45. braindecode/models/syncnet.py +0 -2
  46. braindecode/models/tcn.py +0 -2
  47. braindecode/models/usleep.py +21 -26
  48. braindecode/models/util.py +0 -87
  49. braindecode/modules/attention.py +10 -10
  50. braindecode/modules/blocks.py +3 -3
  51. braindecode/modules/filter.py +9 -2
  52. braindecode/modules/layers.py +17 -18
  53. braindecode/preprocessing/__init__.py +3 -237
  54. braindecode/preprocessing/mne_preprocess.py +12 -175
  55. braindecode/preprocessing/preprocess.py +51 -146
  56. braindecode/preprocessing/windowers.py +20 -26
  57. braindecode/samplers/base.py +8 -8
  58. braindecode/version.py +1 -1
  59. {braindecode-1.3.0.dev175368549.dist-info → braindecode-1.3.0.dev175415232.dist-info}/METADATA +3 -13
  60. braindecode-1.3.0.dev175415232.dist-info/RECORD +103 -0
  61. braindecode/datasets/hub.py +0 -962
  62. braindecode/datasets/hub_validation.py +0 -113
  63. braindecode/datasets/registry.py +0 -120
  64. braindecode/datautil/channel_utils.py +0 -114
  65. braindecode/datautil/hub_formats.py +0 -180
  66. braindecode/models/bendr.py +0 -469
  67. braindecode/models/eegsym.py +0 -917
  68. braindecode/models/luna.py +0 -836
  69. braindecode/models/medformer.py +0 -758
  70. braindecode/preprocessing/eegprep_preprocess.py +0 -1317
  71. braindecode/preprocessing/util.py +0 -177
  72. braindecode-1.3.0.dev175368549.dist-info/RECORD +0 -114
  73. {braindecode-1.3.0.dev175368549.dist-info → braindecode-1.3.0.dev175415232.dist-info}/WHEEL +0 -0
  74. {braindecode-1.3.0.dev175368549.dist-info → braindecode-1.3.0.dev175415232.dist-info}/licenses/LICENSE.txt +0 -0
  75. {braindecode-1.3.0.dev175368549.dist-info → braindecode-1.3.0.dev175415232.dist-info}/licenses/NOTICE.txt +0 -0
  76. {braindecode-1.3.0.dev175368549.dist-info → braindecode-1.3.0.dev175415232.dist-info}/top_level.txt +0 -0
@@ -189,7 +189,7 @@ class AugmentedDataLoader(DataLoader):
189
189
 
190
190
  Parameters
191
191
  ----------
192
- dataset : RecordDataset
192
+ dataset : BaseDataset
193
193
  The dataset containing the signals.
194
194
  transforms : list | Transform, optional
195
195
  Transform or sequence of Transform to be applied to each batch.
@@ -2,17 +2,11 @@
2
2
  Loader code for some datasets.
3
3
  """
4
4
 
5
- from .base import (
6
- BaseConcatDataset,
7
- EEGWindowsDataset,
8
- RawDataset,
9
- RecordDataset,
10
- WindowsDataset,
11
- )
5
+ from .base import BaseConcatDataset, BaseDataset, WindowsDataset
12
6
  from .bcicomp import BCICompetitionIVDataset4
13
7
  from .bids import BIDSDataset, BIDSEpochsDataset
14
8
  from .mne import create_from_mne_epochs, create_from_mne_raw
15
- from .moabb import BNCI2014_001, HGD, MOABBDataset
9
+ from .moabb import BNCI2014001, HGD, MOABBDataset
16
10
  from .nmt import NMT
17
11
  from .sleep_physio_challe_18 import SleepPhysionetChallenge2018
18
12
  from .sleep_physionet import SleepPhysionet
@@ -21,15 +15,13 @@ from .xy import create_from_X_y
21
15
 
22
16
  __all__ = [
23
17
  "WindowsDataset",
24
- "EEGWindowsDataset",
25
- "RecordDataset",
26
- "RawDataset",
18
+ "BaseDataset",
27
19
  "BaseConcatDataset",
28
20
  "BIDSDataset",
29
21
  "BIDSEpochsDataset",
30
22
  "MOABBDataset",
31
23
  "HGD",
32
- "BNCI2014_001",
24
+ "BNCI2014001",
33
25
  "create_from_mne_raw",
34
26
  "create_from_mne_epochs",
35
27
  "TUH",
@@ -16,20 +16,14 @@ import json
16
16
  import os
17
17
  import shutil
18
18
  import warnings
19
- from abc import abstractmethod
20
19
  from collections.abc import Callable
21
20
  from glob import glob
22
- from typing import Any, Generic, Iterable, no_type_check
21
+ from typing import Iterable, no_type_check
23
22
 
24
23
  import mne.io
25
24
  import numpy as np
26
25
  import pandas as pd
27
- from mne.utils.docs import deprecated
28
26
  from torch.utils.data import ConcatDataset, Dataset
29
- from typing_extensions import TypeVar
30
-
31
- from .hub import HubDatasetMixin
32
- from .registry import register_dataset
33
27
 
34
28
 
35
29
  def _create_description(description) -> pd.Series:
@@ -43,65 +37,7 @@ def _create_description(description) -> pd.Series:
43
37
  return description
44
38
 
45
39
 
46
- class RecordDataset(Dataset[tuple[np.ndarray, int | str, tuple[int, int, int]]]):
47
- def __init__(
48
- self,
49
- description: dict | pd.Series | None = None,
50
- transform: Callable | None = None,
51
- ):
52
- self._description = _create_description(description)
53
- self.transform = transform
54
-
55
- @abstractmethod
56
- def __len__(self) -> int:
57
- pass
58
-
59
- @property
60
- def description(self) -> pd.Series:
61
- return self._description
62
-
63
- def set_description(self, description: dict | pd.Series, overwrite: bool = False):
64
- """Update (add or overwrite) the dataset description.
65
-
66
- Parameters
67
- ----------
68
- description: dict | pd.Series
69
- Description in the form key: value.
70
- overwrite: bool
71
- Has to be True if a key in description already exists in the
72
- dataset description.
73
- """
74
- description = _create_description(description)
75
- if self.description is None:
76
- self._description = description
77
- else:
78
- for key, value in description.items():
79
- # if the key is already in the existing description, drop it
80
- if key in self._description:
81
- assert overwrite, (
82
- f"'{key}' already in description. Please "
83
- f"rename or set overwrite to True."
84
- )
85
- self._description.pop(key)
86
- self._description = pd.concat([self.description, description])
87
-
88
- @property
89
- def transform(self) -> Callable | None:
90
- return self._transform
91
-
92
- @transform.setter
93
- def transform(self, value: Callable | None):
94
- if value is not None and not callable(value):
95
- raise ValueError("Transform needs to be a callable.")
96
- self._transform = value
97
-
98
-
99
- # Type of the datasets contained in BaseConcatDataset
100
- T = TypeVar("T", bound=RecordDataset)
101
-
102
-
103
- @register_dataset
104
- class RawDataset(RecordDataset):
40
+ class BaseDataset(Dataset):
105
41
  """Returns samples from an mne.io.Raw object along with a target.
106
42
 
107
43
  Dataset which serves samples from an mne.io.Raw object along with a target.
@@ -128,12 +64,12 @@ class RawDataset(RecordDataset):
128
64
  target_name: str | tuple[str, ...] | None = None,
129
65
  transform: Callable | None = None,
130
66
  ):
131
- super().__init__(description, transform)
132
67
  self.raw = raw
68
+ self._description = _create_description(description)
69
+ self.transform = transform
133
70
 
134
71
  # save target name for load/save later
135
72
  self.target_name = self._target_name(target_name)
136
- self.raw_preproc_kwargs: list[dict[str, Any]] = []
137
73
 
138
74
  def __getitem__(self, index):
139
75
  X = self.raw[:, index][0]
@@ -149,6 +85,45 @@ class RawDataset(RecordDataset):
149
85
  def __len__(self):
150
86
  return len(self.raw)
151
87
 
88
+ @property
89
+ def transform(self):
90
+ return self._transform
91
+
92
+ @transform.setter
93
+ def transform(self, value):
94
+ if value is not None and not callable(value):
95
+ raise ValueError("Transform needs to be a callable.")
96
+ self._transform = value
97
+
98
+ @property
99
+ def description(self) -> pd.Series:
100
+ return self._description
101
+
102
+ def set_description(self, description: dict | pd.Series, overwrite: bool = False):
103
+ """Update (add or overwrite) the dataset description.
104
+
105
+ Parameters
106
+ ----------
107
+ description: dict | pd.Series
108
+ Description in the form key: value.
109
+ overwrite: bool
110
+ Has to be True if a key in description already exists in the
111
+ dataset description.
112
+ """
113
+ description = _create_description(description)
114
+ for key, value in description.items():
115
+ # if the key is already in the existing description, drop it
116
+ if self._description is not None and key in self._description:
117
+ assert overwrite, (
118
+ f"'{key}' already in description. Please "
119
+ f"rename or set overwrite to True."
120
+ )
121
+ self._description.pop(key)
122
+ if self._description is None:
123
+ self._description = description
124
+ else:
125
+ self._description = pd.concat([self.description, description])
126
+
152
127
  def _target_name(self, target_name):
153
128
  if target_name is not None and not isinstance(target_name, (str, tuple, list)):
154
129
  raise ValueError("target_name has to be None, str, tuple or list")
@@ -175,19 +150,7 @@ class RawDataset(RecordDataset):
175
150
  return target_name if len(target_name) > 1 else target_name[0]
176
151
 
177
152
 
178
- @deprecated(
179
- "The BaseDataset class is deprecated. "
180
- "If you want to instantiate a dataset containing raws, use RawDataset instead. "
181
- "If you want to type a Braindecode dataset (i.e. RawDataset|EEGWindowsDataset|WindowsDataset), "
182
- "use the RecordDataset class instead."
183
- )
184
- @register_dataset
185
- class BaseDataset(RawDataset):
186
- pass
187
-
188
-
189
- @register_dataset
190
- class EEGWindowsDataset(RecordDataset):
153
+ class EEGWindowsDataset(BaseDataset):
191
154
  """Returns windows from an mne.Raw object, its window indices, along with a target.
192
155
 
193
156
  Dataset which serves windows from an mne.Epochs object along with their
@@ -198,12 +161,12 @@ class EEGWindowsDataset(RecordDataset):
198
161
  required to serve information about the windowing (e.g., useful for cropped
199
162
  training).
200
163
  See `braindecode.datautil.windowers` to directly create a `WindowsDataset`
201
- from a `RawDataset` object.
164
+ from a `BaseDataset` object.
202
165
 
203
166
  Parameters
204
167
  ----------
205
168
  windows : mne.Raw or mne.Epochs (Epochs is outdated)
206
- Windows obtained through the application of a windower to a ``RawDataset``
169
+ Windows obtained through the application of a windower to a BaseDataset
207
170
  (see `braindecode.datautil.windowers`).
208
171
  description : dict | pandas.Series | None
209
172
  Holds additional info about the windows.
@@ -222,17 +185,18 @@ class EEGWindowsDataset(RecordDataset):
222
185
 
223
186
  def __init__(
224
187
  self,
225
- raw: mne.io.BaseRaw,
188
+ raw: mne.io.BaseRaw | mne.BaseEpochs,
226
189
  metadata: pd.DataFrame,
227
190
  description: dict | pd.Series | None = None,
228
191
  transform: Callable | None = None,
229
192
  targets_from: str = "metadata",
230
193
  last_target_only: bool = True,
231
194
  ):
232
- super().__init__(description, transform)
233
195
  self.raw = raw
234
196
  self.metadata = metadata
197
+ self._description = _create_description(description)
235
198
 
199
+ self.transform = transform
236
200
  self.last_target_only = last_target_only
237
201
  if targets_from not in ("metadata", "channels"):
238
202
  raise ValueError("Wrong value for parameter `targets_from`.")
@@ -242,7 +206,6 @@ class EEGWindowsDataset(RecordDataset):
242
206
  ].to_numpy()
243
207
  if self.targets_from == "metadata":
244
208
  self.y = metadata.loc[:, "target"].to_list()
245
- self.raw_preproc_kwargs: list[dict[str, Any]] = []
246
209
 
247
210
  def __getitem__(self, index: int):
248
211
  """Get a window and its target.
@@ -292,9 +255,44 @@ class EEGWindowsDataset(RecordDataset):
292
255
  def __len__(self):
293
256
  return len(self.crop_inds)
294
257
 
258
+ @property
259
+ def transform(self):
260
+ return self._transform
261
+
262
+ @transform.setter
263
+ def transform(self, value):
264
+ if value is not None and not callable(value):
265
+ raise ValueError("Transform needs to be a callable.")
266
+ self._transform = value
267
+
268
+ @property
269
+ def description(self) -> pd.Series:
270
+ return self._description
271
+
272
+ def set_description(self, description: dict | pd.Series, overwrite: bool = False):
273
+ """Update (add or overwrite) the dataset description.
274
+
275
+ Parameters
276
+ ----------
277
+ description: dict | pd.Series
278
+ Description in the form key: value.
279
+ overwrite: bool
280
+ Has to be True if a key in description already exists in the
281
+ dataset description.
282
+ """
283
+ description = _create_description(description)
284
+ for key, value in description.items():
285
+ # if they key is already in the existing description, drop it
286
+ if key in self._description:
287
+ assert overwrite, (
288
+ f"'{key}' already in description. Please "
289
+ f"rename or set overwrite to True."
290
+ )
291
+ self._description.pop(key)
292
+ self._description = pd.concat([self.description, description])
293
+
295
294
 
296
- @register_dataset
297
- class WindowsDataset(RecordDataset):
295
+ class WindowsDataset(BaseDataset):
298
296
  """Returns windows from an mne.Epochs object along with a target.
299
297
 
300
298
  Dataset which serves windows from an mne.Epochs object along with their
@@ -305,12 +303,12 @@ class WindowsDataset(RecordDataset):
305
303
  required to serve information about the windowing (e.g., useful for cropped
306
304
  training).
307
305
  See `braindecode.datautil.windowers` to directly create a `WindowsDataset`
308
- from a ``RawDataset`` object.
306
+ from a `BaseDataset` object.
309
307
 
310
308
  Parameters
311
309
  ----------
312
310
  windows : mne.Epochs
313
- Windows obtained through the application of a windower to a RawDataset
311
+ Windows obtained through the application of a windower to a BaseDataset
314
312
  (see `braindecode.datautil.windowers`).
315
313
  description : dict | pandas.Series | None
316
314
  Holds additional info about the windows.
@@ -329,22 +327,19 @@ class WindowsDataset(RecordDataset):
329
327
  targets_from: str = "metadata",
330
328
  last_target_only: bool = True,
331
329
  ):
332
- super().__init__(description, transform)
333
330
  self.windows = windows
331
+ self._description = _create_description(description)
332
+ self.transform = transform
334
333
  self.last_target_only = last_target_only
335
334
  if targets_from not in ("metadata", "channels"):
336
335
  raise ValueError("Wrong value for parameter `targets_from`.")
337
336
  self.targets_from = targets_from
338
337
 
339
- metadata = self.windows.metadata
340
- assert metadata is not None, "WindowsDataset requires windows with metadata."
341
- self.crop_inds = metadata.loc[
338
+ self.crop_inds = self.windows.metadata.loc[
342
339
  :, ["i_window_in_trial", "i_start_in_trial", "i_stop_in_trial"]
343
340
  ].to_numpy()
344
341
  if self.targets_from == "metadata":
345
- self.y = metadata.loc[:, "target"].to_list()
346
- self.raw_preproc_kwargs: list[dict[str, Any]] = []
347
- self.window_preproc_kwargs: list[dict[str, Any]] = []
342
+ self.y = self.windows.metadata.loc[:, "target"].to_list()
348
343
 
349
344
  def __getitem__(self, index: int):
350
345
  """Get a window and its target.
@@ -384,41 +379,68 @@ class WindowsDataset(RecordDataset):
384
379
  def __len__(self) -> int:
385
380
  return len(self.windows.events)
386
381
 
382
+ @property
383
+ def transform(self):
384
+ return self._transform
385
+
386
+ @transform.setter
387
+ def transform(self, value):
388
+ if value is not None and not callable(value):
389
+ raise ValueError("Transform needs to be a callable.")
390
+ self._transform = value
391
+
392
+ @property
393
+ def description(self) -> pd.Series:
394
+ return self._description
395
+
396
+ def set_description(self, description: dict | pd.Series, overwrite: bool = False):
397
+ """Update (add or overwrite) the dataset description.
398
+
399
+ Parameters
400
+ ----------
401
+ description: dict | pd.Series
402
+ Description in the form key: value.
403
+ overwrite: bool
404
+ Has to be True if a key in description already exists in the
405
+ dataset description.
406
+ """
407
+ description = _create_description(description)
408
+ for key, value in description.items():
409
+ # if they key is already in the existing description, drop it
410
+ if key in self._description:
411
+ assert overwrite, (
412
+ f"'{key}' already in description. Please "
413
+ f"rename or set overwrite to True."
414
+ )
415
+ self._description.pop(key)
416
+ self._description = pd.concat([self.description, description])
387
417
 
388
- @register_dataset
389
- class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
418
+
419
+ class BaseConcatDataset(ConcatDataset):
390
420
  """A base class for concatenated datasets.
391
421
 
392
422
  Holds either mne.Raw or mne.Epoch in self.datasets and has
393
423
  a pandas DataFrame with additional description.
394
424
 
395
- Includes Hugging Face Hub integration via HubDatasetMixin for
396
- uploading and downloading datasets.
397
-
398
425
  Parameters
399
426
  ----------
400
427
  list_of_ds : list
401
- list of RecordDataset
428
+ list of BaseDataset, BaseConcatDataset or WindowsDataset
402
429
  target_transform : callable | None
403
430
  Optional function to call on targets before returning them.
404
431
 
405
432
  """
406
433
 
407
- datasets: list[T]
408
-
409
434
  def __init__(
410
435
  self,
411
- list_of_ds: list[T | BaseConcatDataset[T]],
436
+ list_of_ds: list[BaseDataset | BaseConcatDataset | WindowsDataset]
437
+ | None = None,
412
438
  target_transform: Callable | None = None,
413
439
  ):
414
440
  # if we get a list of BaseConcatDataset, get all the individual datasets
415
- flattened_list_of_ds: list[T] = []
416
- for ds in list_of_ds:
417
- if isinstance(ds, BaseConcatDataset):
418
- flattened_list_of_ds.extend(ds.datasets)
419
- else:
420
- flattened_list_of_ds.append(ds)
421
- super().__init__(flattened_list_of_ds)
441
+ if list_of_ds and isinstance(list_of_ds[0], BaseConcatDataset):
442
+ list_of_ds = [d for ds in list_of_ds for d in ds.datasets]
443
+ super().__init__(list_of_ds)
422
444
 
423
445
  self.target_transform = target_transform
424
446
 
@@ -681,23 +703,22 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
681
703
  ds.set_description({key: value_}, overwrite=overwrite)
682
704
 
683
705
  def save(self, path: str, overwrite: bool = False, offset: int = 0):
684
- """Save datasets to files by creating one subdirectory for each dataset::
685
-
686
- path/
687
- 0/
688
- 0-raw.fif | 0-epo.fif
689
- description.json
690
- raw_preproc_kwargs.json (if raws were preprocessed)
691
- window_kwargs.json (if this is a windowed dataset)
692
- window_preproc_kwargs.json (if windows were preprocessed)
693
- target_name.json (if target_name is not None and dataset is raw)
694
- 1/
695
- 1-raw.fif | 1-epo.fif
696
- description.json
697
- raw_preproc_kwargs.json (if raws were preprocessed)
698
- window_kwargs.json (if this is a windowed dataset)
699
- window_preproc_kwargs.json (if windows were preprocessed)
700
- target_name.json (if target_name is not None and dataset is raw)
706
+ """Save datasets to files by creating one subdirectory for each dataset:
707
+ path/
708
+ 0/
709
+ 0-raw.fif | 0-epo.fif
710
+ description.json
711
+ raw_preproc_kwargs.json (if raws were preprocessed)
712
+ window_kwargs.json (if this is a windowed dataset)
713
+ window_preproc_kwargs.json (if windows were preprocessed)
714
+ target_name.json (if target_name is not None and dataset is raw)
715
+ 1/
716
+ 1-raw.fif | 1-epo.fif
717
+ description.json
718
+ raw_preproc_kwargs.json (if raws were preprocessed)
719
+ window_kwargs.json (if this is a windowed dataset)
720
+ window_preproc_kwargs.json (if windows were preprocessed)
721
+ target_name.json (if target_name is not None and dataset is raw)
701
722
 
702
723
  Parameters
703
724
  ----------
@@ -809,7 +830,7 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
809
830
  kwargs = getattr(ds, kwargs_name)
810
831
  if kwargs is not None:
811
832
  with open(kwargs_file_path, "w") as f:
812
- json.dump(kwargs, f, indent=2)
833
+ json.dump(kwargs, f)
813
834
 
814
835
  @staticmethod
815
836
  def _save_target_name(sub_dir, ds):
@@ -16,7 +16,7 @@ import numpy as np
16
16
  from mne.utils import verbose
17
17
  from scipy.io import loadmat
18
18
 
19
- from braindecode.datasets import BaseConcatDataset, RawDataset
19
+ from braindecode.datasets import BaseConcatDataset, BaseDataset
20
20
 
21
21
  DATASET_URL = (
22
22
  "https://stacks.stanford.edu/file/druid:zk881ps0522/"
@@ -73,8 +73,8 @@ class BCICompetitionIVDataset4(BaseConcatDataset):
73
73
  file_name=file_path.split("/")[-1],
74
74
  session="test",
75
75
  )
76
- datasets.append(RawDataset(raw_train, description=desc_train))
77
- datasets.append(RawDataset(raw_test, description=desc_test))
76
+ datasets.append(BaseDataset(raw_train, description=desc_train))
77
+ datasets.append(BaseDataset(raw_test, description=desc_test))
78
78
  super().__init__(datasets)
79
79
 
80
80
  @staticmethod
@@ -85,7 +85,7 @@ class BCICompetitionIVDataset4(BaseConcatDataset):
85
85
  ----------
86
86
  path (None | str) – Location of where to look for the data storing location.
87
87
  If None, the environment variable or config parameter
88
- MNE_DATASETS_(dataset)_PATH is used. If it doesn't exist, the “~/mne_data”
88
+ MNE_DATASETS_(dataset)_PATH is used. If it doesn’t exist, the “~/mne_data”
89
89
  directory is used. If the dataset is not found under the given path, the data
90
90
  will be automatically downloaded to the specified folder.
91
91
  force_update (bool) – Force update of the dataset even if a local copy exists.
@@ -19,7 +19,7 @@ import numpy as np
19
19
  import pandas as pd
20
20
  from joblib import Parallel, delayed
21
21
 
22
- from .base import BaseConcatDataset, RawDataset, WindowsDataset
22
+ from .base import BaseConcatDataset, BaseDataset, WindowsDataset
23
23
 
24
24
 
25
25
  def _description_from_bids_path(bids_path: mne_bids.BIDSPath) -> dict[str, Any]:
@@ -186,12 +186,12 @@ class BIDSDataset(BaseConcatDataset):
186
186
  )
187
187
  super().__init__(all_base_ds)
188
188
 
189
- def _get_dataset(self, bids_path: mne_bids.BIDSPath) -> RawDataset:
189
+ def _get_dataset(self, bids_path: mne_bids.BIDSPath) -> BaseDataset:
190
190
  description = _description_from_bids_path(bids_path)
191
191
  raw = mne_bids.read_raw_bids(bids_path, verbose=False)
192
192
  if self.preload:
193
193
  raw.load_data()
194
- return RawDataset(raw, description)
194
+ return BaseDataset(raw, description)
195
195
 
196
196
 
197
197
  class BIDSEpochsDataset(BIDSDataset):
@@ -25,14 +25,14 @@ class BIDSIterableDataset(IterableDataset):
25
25
 
26
26
  Examples
27
27
  --------
28
- >>> from braindecode.datasets import RecordDataset, BaseConcatDataset
28
+ >>> from braindecode.datasets import BaseDataset, BaseConcatDataset
29
29
  >>> from braindecode.datasets.bids import BIDSIterableDataset, _description_from_bids_path
30
30
  >>> from braindecode.preprocessing import create_fixed_length_windows
31
31
  >>>
32
32
  >>> def my_reader_fn(path):
33
33
  ... raw = mne_bids.read_raw_bids(path)
34
34
  ... desc = _description_from_bids_path(path)
35
- ... ds = RawDataset(raw, description=desc)
35
+ ... ds = BaseDataset(raw, description=desc)
36
36
  ... windows_ds = create_fixed_length_windows(
37
37
  ... BaseConcatDataset([ds]),
38
38
  ... window_size_samples=400,
@@ -9,7 +9,7 @@ import mne
9
9
  import numpy as np
10
10
  import pandas as pd
11
11
 
12
- from .base import BaseConcatDataset, RawDataset, WindowsDataset
12
+ from .base import BaseConcatDataset, BaseDataset, WindowsDataset
13
13
 
14
14
 
15
15
  def create_from_mne_raw(
@@ -75,9 +75,11 @@ def create_from_mne_raw(
75
75
  f"length of 'raws' ({len(raws)}) and 'description' "
76
76
  f"({len(descriptions)}) has to match"
77
77
  )
78
- base_datasets = [RawDataset(raw, desc) for raw, desc in zip(raws, descriptions)]
78
+ base_datasets = [
79
+ BaseDataset(raw, desc) for raw, desc in zip(raws, descriptions)
80
+ ]
79
81
  else:
80
- base_datasets = [RawDataset(raw) for raw in raws]
82
+ base_datasets = [BaseDataset(raw) for raw in raws]
81
83
 
82
84
  base_datasets = BaseConcatDataset(base_datasets)
83
85
  windows_datasets = create_windows_from_events(
@@ -15,11 +15,10 @@ from typing import Any
15
15
 
16
16
  import mne
17
17
  import pandas as pd
18
- from mne.utils import deprecated
19
18
 
20
19
  from braindecode.util import _update_moabb_docstring
21
20
 
22
- from .base import BaseConcatDataset, RawDataset
21
+ from .base import BaseConcatDataset, BaseDataset
23
22
 
24
23
 
25
24
  def _find_dataset_in_moabb(dataset_name, dataset_kwargs=None):
@@ -165,13 +164,13 @@ class MOABBDataset(BaseConcatDataset):
165
164
  dataset_load_kwargs=dataset_load_kwargs,
166
165
  )
167
166
  all_base_ds = [
168
- RawDataset(raw, row) for raw, (_, row) in zip(raws, description.iterrows())
167
+ BaseDataset(raw, row) for raw, (_, row) in zip(raws, description.iterrows())
169
168
  ]
170
169
  super().__init__(all_base_ds)
171
170
 
172
171
 
173
- class BNCI2014_001(MOABBDataset):
174
- doc = """See moabb.datasets.bnci.BNCI2014_001
172
+ class BNCI2014001(MOABBDataset):
173
+ doc = """See moabb.datasets.bnci.BNCI2014001
175
174
 
176
175
  Parameters
177
176
  ----------
@@ -180,14 +179,14 @@ class BNCI2014_001(MOABBDataset):
180
179
  subjects is fetched.
181
180
  """
182
181
  try:
183
- from moabb.datasets import BNCI2014_001
182
+ from moabb.datasets import BNCI2014001
184
183
 
185
- __doc__ = _update_moabb_docstring(BNCI2014_001, doc)
184
+ __doc__ = _update_moabb_docstring(BNCI2014001, doc)
186
185
  except ModuleNotFoundError:
187
186
  pass # keep moabb soft dependency, otherwise crash on loading of datasets.__init__.py
188
187
 
189
188
  def __init__(self, subject_ids):
190
- super().__init__("BNCI2014_001", subject_ids=subject_ids)
189
+ super().__init__("BNCI2014001", subject_ids=subject_ids)
191
190
 
192
191
 
193
192
  class HGD(MOABBDataset):
@@ -208,12 +207,3 @@ class HGD(MOABBDataset):
208
207
 
209
208
  def __init__(self, subject_ids):
210
209
  super().__init__("Schirrmeister2017", subject_ids=subject_ids)
211
-
212
-
213
- @deprecated(
214
- "`BNCI2014001` was renamed to `BNCI2014_001` in v1.13; this alias will be removed in v1.14."
215
- )
216
- class BNCI2014001(BNCI2014_001):
217
- """Deprecated alias for BNCI2014001."""
218
-
219
- pass
@@ -31,7 +31,7 @@ import pandas as pd
31
31
  from joblib import Parallel, delayed
32
32
  from mne.datasets import fetch_dataset
33
33
 
34
- from braindecode.datasets.base import BaseConcatDataset, RawDataset
34
+ from braindecode.datasets.base import BaseConcatDataset, BaseDataset
35
35
 
36
36
  NMT_URL = "https://zenodo.org/record/10909103/files/NMT.zip"
37
37
  NMT_archive_name = "NMT.zip"
@@ -172,7 +172,7 @@ class NMT(BaseConcatDataset):
172
172
  d["n_samples"] = raw.n_times
173
173
  d["sfreq"] = raw.info["sfreq"]
174
174
  d["train"] = "train" in d.path.split(os.sep)
175
- base_dataset = RawDataset(raw, d, target_name)
175
+ base_dataset = BaseDataset(raw, d, target_name)
176
176
  return base_dataset
177
177
 
178
178
 
@@ -21,7 +21,7 @@ from mne.datasets.sleep_physionet._utils import _fetch_one
21
21
  from mne.datasets.utils import _get_path
22
22
  from mne.utils import warn
23
23
 
24
- from braindecode.datasets import BaseConcatDataset, RawDataset
24
+ from braindecode.datasets import BaseConcatDataset, BaseDataset
25
25
 
26
26
  PC18_DIR = op.join(op.dirname(__file__), "data", "pc18")
27
27
  PC18_RECORDS = op.join(PC18_DIR, "sleep_records.csv")
@@ -403,7 +403,7 @@ class SleepPhysionetChallenge2018(BaseConcatDataset):
403
403
  },
404
404
  name="",
405
405
  )
406
- base_dataset = RawDataset(raw_file, desc)
406
+ base_dataset = BaseDataset(raw_file, desc)
407
407
 
408
408
  if preproc is not None:
409
409
  from braindecode.preprocessing.preprocess import _preprocess