eegdash 0.3.9.dev182388821__py3-none-any.whl → 0.4.0__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.

Potentially problematic release.


This version of eegdash might be problematic. Click here for more details.

@@ -1,4 +1,22 @@
1
+ """Public API for dataset helpers and dynamically generated datasets."""
2
+
3
+ from . import dataset as _dataset_mod # triggers dynamic class registration
1
4
  from .dataset import EEGChallengeDataset
2
5
  from .registry import register_openneuro_datasets
3
6
 
4
- __all__ = ["EEGChallengeDataset", "register_openneuro_datasets"]
7
+ # Re-export dynamically generated dataset classes at the package level so that
8
+ # ``eegdash.dataset`` shows them in the API docs and users can import as
9
+ # ``from eegdash.dataset import DSXXXXX``.
10
+ _dyn_names = []
11
+ for _name in getattr(_dataset_mod, "__all__", []):
12
+ if _name == "EEGChallengeDataset":
13
+ # Already imported explicitly above
14
+ continue
15
+ _obj = getattr(_dataset_mod, _name, None)
16
+ if _obj is not None:
17
+ globals()[_name] = _obj
18
+ _dyn_names.append(_name)
19
+
20
+ __all__ = ["EEGChallengeDataset", "register_openneuro_datasets"] + _dyn_names
21
+
22
+ del _dataset_mod, _name, _obj, _dyn_names
@@ -1,39 +1,59 @@
1
- import logging
2
1
  from pathlib import Path
3
2
 
4
- from mne.utils import warn
3
+ from rich.console import Console
4
+ from rich.panel import Panel
5
+ from rich.text import Text
5
6
 
6
7
  from ..api import EEGDashDataset
7
8
  from ..bids_eeg_metadata import build_query_from_kwargs
8
9
  from ..const import RELEASE_TO_OPENNEURO_DATASET_MAP, SUBJECT_MINI_RELEASE_MAP
10
+ from ..logging import logger
9
11
  from .registry import register_openneuro_datasets
10
12
 
11
- logger = logging.getLogger("eegdash")
12
-
13
13
 
14
14
  class EEGChallengeDataset(EEGDashDataset):
15
- """EEG 2025 Challenge dataset helper.
15
+ """A dataset helper for the EEG 2025 Challenge.
16
16
 
17
- This class provides a convenient wrapper around :class:`EEGDashDataset`
18
- configured for the EEG 2025 Challenge releases. It maps a given
19
- ``release`` to its corresponding OpenNeuro dataset and optionally restricts
20
- to the official "mini" subject subset.
17
+ This class simplifies access to the EEG 2025 Challenge datasets. It is a
18
+ specialized version of :class:`~eegdash.api.EEGDashDataset` that is
19
+ pre-configured for the challenge's data releases. It automatically maps a
20
+ release name (e.g., "R1") to the corresponding OpenNeuro dataset and handles
21
+ the selection of subject subsets (e.g., "mini" release).
21
22
 
22
23
  Parameters
23
24
  ----------
24
25
  release : str
25
- Release name. One of ["R1", ..., "R11"].
26
+ The name of the challenge release to load. Must be one of the keys in
27
+ :const:`~eegdash.const.RELEASE_TO_OPENNEURO_DATASET_MAP`
28
+ (e.g., "R1", "R2", ..., "R11").
26
29
  cache_dir : str
27
- Local cache directory for data files.
30
+ The local directory where the dataset will be downloaded and cached.
28
31
  mini : bool, default True
29
- If True, restrict subjects to the challenge mini subset.
30
- query : dict | None
31
- Additional MongoDB-style filters to AND with the release selection.
32
- Must not contain the key ``dataset``.
33
- s3_bucket : str | None, default "s3://nmdatasets/NeurIPS25"
34
- Base S3 bucket used to locate the challenge data.
32
+ If True, the dataset is restricted to the official "mini" subset of
33
+ subjects for the specified release. If False, all subjects for the
34
+ release are included.
35
+ query : dict, optional
36
+ An additional MongoDB-style query to apply as a filter. This query is
37
+ combined with the release and subject filters using a logical AND.
38
+ The query must not contain the ``dataset`` key, as this is determined
39
+ by the ``release`` parameter.
40
+ s3_bucket : str, optional
41
+ The base S3 bucket URI where the challenge data is stored. Defaults to
42
+ the official challenge bucket.
35
43
  **kwargs
36
- Passed through to :class:`EEGDashDataset`.
44
+ Additional keyword arguments that are passed directly to the
45
+ :class:`~eegdash.api.EEGDashDataset` constructor.
46
+
47
+ Raises
48
+ ------
49
+ ValueError
50
+ If the specified ``release`` is unknown, or if the ``query`` argument
51
+ contains a ``dataset`` key. Also raised if ``mini`` is True and a
52
+ requested subject is not part of the official mini-release subset.
53
+
54
+ See Also
55
+ --------
56
+ EEGDashDataset : The base class for creating datasets from queries.
37
57
 
38
58
  """
39
59
 
@@ -123,24 +143,32 @@ class EEGChallengeDataset(EEGDashDataset):
123
143
  else:
124
144
  s3_bucket = f"{s3_bucket}/{release}_L100_bdf"
125
145
 
126
- warn(
127
- "\n\n"
128
- "[EEGChallengeDataset] EEG 2025 Competition Data Notice:\n"
129
- "-------------------------------------------------------\n"
146
+ message_text = Text.from_markup(
130
147
  "This object loads the HBN dataset that has been preprocessed for the EEG Challenge:\n"
131
- " - Downsampled from 500Hz to 100Hz\n"
132
- " - Bandpass filtered (0.550 Hz)\n"
133
- "\n"
134
- "For full preprocessing details, see:\n"
135
- " https://github.com/eeg2025/downsample-datasets\n"
136
- "\n"
137
- "IMPORTANT: The data accessed via `EEGChallengeDataset` is NOT identical to what you get from `EEGDashDataset` directly.\n"
138
- "If you are participating in the competition, always use `EEGChallengeDataset` to ensure consistency with the challenge data.\n"
139
- "\n",
140
- UserWarning,
141
- module="eegdash",
148
+ " * Downsampled from 500Hz to 100Hz\n"
149
+ " * Bandpass filtered (0.5-50 Hz)\n\n"
150
+ "For full preprocessing applied for competition details, see:\n"
151
+ " [link=https://github.com/eeg2025/downsample-datasets]https://github.com/eeg2025/downsample-datasets[/link]\n\n"
152
+ "The HBN dataset have some preprocessing applied by the HBN team:\n"
153
+ " * Re-reference (Cz Channel)\n\n"
154
+ "[bold red]IMPORTANT[/bold red]: The data accessed via `EEGChallengeDataset` is [u]NOT[/u] identical to what you get from [link=https://github.com/sccn/EEGDash/blob/develop/eegdash/api.py]EEGDashDataset[/link] directly.\n"
155
+ "If you are participating in the competition, always use `EEGChallengeDataset` to ensure consistency with the challenge data."
142
156
  )
143
157
 
158
+ warning_panel = Panel(
159
+ message_text,
160
+ title="[yellow]EEG 2025 Competition Data Notice[/yellow]",
161
+ subtitle="[cyan]Source: EEGChallengeDataset[/cyan]",
162
+ border_style="yellow",
163
+ )
164
+
165
+ # Render the panel directly to the console so it displays in IPython/terminals
166
+ try:
167
+ Console().print(warning_panel)
168
+ except Exception:
169
+ warning_message = str(message_text)
170
+ logger.warning(warning_message)
171
+
144
172
  super().__init__(
145
173
  dataset=RELEASE_TO_OPENNEURO_DATASET_MAP[release],
146
174
  query=query,