eegdash 0.3.3.dev61__tar.gz → 0.3.3.dev67__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.

Potentially problematic release.


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

Files changed (41) hide show
  1. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/PKG-INFO +2 -26
  2. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash/__init__.py +3 -1
  3. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash/data_utils.py +12 -1
  4. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash/dataset.py +13 -0
  5. eegdash-0.3.3.dev67/eegdash/registry.py +72 -0
  6. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash.egg-info/PKG-INFO +2 -26
  7. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash.egg-info/SOURCES.txt +2 -0
  8. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/pyproject.toml +1 -2
  9. eegdash-0.3.3.dev67/tests/test_dataset_registration.py +33 -0
  10. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/LICENSE +0 -0
  11. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/README.md +0 -0
  12. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash/api.py +0 -0
  13. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash/data_config.py +0 -0
  14. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash/features/__init__.py +0 -0
  15. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash/features/datasets.py +0 -0
  16. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash/features/decorators.py +0 -0
  17. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash/features/extractors.py +0 -0
  18. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash/features/feature_bank/__init__.py +0 -0
  19. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash/features/feature_bank/complexity.py +0 -0
  20. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash/features/feature_bank/connectivity.py +0 -0
  21. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash/features/feature_bank/csp.py +0 -0
  22. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash/features/feature_bank/dimensionality.py +0 -0
  23. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash/features/feature_bank/signal.py +0 -0
  24. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash/features/feature_bank/spectral.py +0 -0
  25. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash/features/feature_bank/utils.py +0 -0
  26. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash/features/inspect.py +0 -0
  27. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash/features/serialization.py +0 -0
  28. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash/features/utils.py +0 -0
  29. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash/mongodb.py +0 -0
  30. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash/preprocessing.py +0 -0
  31. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash/utils.py +0 -0
  32. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash.egg-info/dependency_links.txt +0 -0
  33. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash.egg-info/requires.txt +0 -0
  34. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/eegdash.egg-info/top_level.txt +0 -0
  35. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/setup.cfg +0 -0
  36. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/tests/test_correctness.py +0 -0
  37. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/tests/test_dataset.py +0 -0
  38. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/tests/test_eegdash.py +0 -0
  39. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/tests/test_functional.py +0 -0
  40. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/tests/test_init.py +0 -0
  41. {eegdash-0.3.3.dev61 → eegdash-0.3.3.dev67}/tests/test_mongo_connection.py +0 -0
@@ -1,35 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eegdash
3
- Version: 0.3.3.dev61
3
+ Version: 0.3.3.dev67
4
4
  Summary: EEG data for machine learning
5
5
  Author-email: Young Truong <dt.young112@gmail.com>, Arnaud Delorme <adelorme@gmail.com>, Aviv Dotan <avivd220@gmail.com>, Oren Shriki <oren70@gmail.com>, Bruno Aristimunha <b.aristimunha@gmail.com>
6
- License: GNU General Public License
7
-
8
- Copyright (C) 2024-2025
9
-
10
- Young Truong, UCSD, dt.young112@gmail.com
11
- Arnaud Delorme, UCSD, adelorme@ucsd.edu
12
- Aviv Dotan, BGU, avivdot@bgu.post.ac.il
13
- Oren Shriki, BGU, shrikio@bgu.ac.il
14
- Bruno Aristimunha, b.aristimunha@gmail.com
15
-
16
- This program is free software; you can redistribute it and/or modify
17
- it under the terms of the GNU General Public License as published by
18
- the Free Software Foundation; either version 2 of the License, or
19
- (at your option) any later version.
20
-
21
- This program is distributed in the hope that it will be useful,
22
- but WITHOUT ANY WARRANTY; without even the implied warranty of
23
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
- GNU General Public License for more details.
25
-
26
- You should have received a copy of the GNU General Public License
27
- along with this program; if not, write to the Free Software
28
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1.07 USA
29
-
6
+ License-Expression: GPL-3.0-only
30
7
  Project-URL: Homepage, https://github.com/sccn/EEG-Dash-Data
31
8
  Project-URL: Issues, https://github.com/sccn/EEG-Dash-Data/issues
32
- Classifier: License :: OSI Approved :: MIT License
33
9
  Classifier: Operating System :: OS Independent
34
10
  Classifier: Intended Audience :: Science/Research
35
11
  Classifier: Intended Audience :: Developers
@@ -4,5 +4,7 @@ from .utils import __init__mongo_client
4
4
 
5
5
  __init__mongo_client()
6
6
 
7
+
7
8
  __all__ = ["EEGDash", "EEGDashDataset", "EEGChallengeDataset"]
8
- __version__ = "0.3.3.dev61"
9
+
10
+ __version__ = "0.3.3.dev67"
@@ -2,10 +2,12 @@ import json
2
2
  import logging
3
3
  import os
4
4
  import re
5
+ import warnings
5
6
  from pathlib import Path
6
7
  from typing import Any
7
8
 
8
9
  import mne
10
+ import mne_bids
9
11
  import numpy as np
10
12
  import pandas as pd
11
13
  import s3fs
@@ -174,7 +176,16 @@ class EEGDashBaseDataset(BaseDataset):
174
176
  self._download_dependencies()
175
177
  self._download_s3()
176
178
  if self._raw is None:
177
- self._raw = mne.io.read_raw(fname=self.bidspath, verbose=False)
179
+ # capturing any warnings
180
+ # to-do: remove this once is fixed on the mne-bids side.
181
+ with warnings.catch_warnings(record=True) as w:
182
+ self._raw = mne_bids.read_raw_bids(
183
+ bids_path=self.bidspath, verbose="ERROR"
184
+ )
185
+ for warning in w:
186
+ logger.warning(
187
+ f"Warning while reading BIDS file: {warning.message}"
188
+ )
178
189
 
179
190
  # === BaseDataset and PyTorch Dataset interface ===
180
191
 
@@ -1,4 +1,7 @@
1
+ from pathlib import Path
2
+
1
3
  from .api import EEGDashDataset
4
+ from .registry import register_openneuro_datasets
2
5
 
3
6
  RELEASE_TO_OPENNEURO_DATASET_MAP = {
4
7
  "R11": "ds005516",
@@ -67,3 +70,13 @@ class EEGChallengeDataset(EEGDashDataset):
67
70
  s3_bucket=f"{s3_bucket}/{release}_L100",
68
71
  **kwargs,
69
72
  )
73
+
74
+
75
+ registered_classes = register_openneuro_datasets(
76
+ summary_file=Path(__file__).with_name("dataset_summary.csv"),
77
+ base_class=EEGDashDataset,
78
+ namespace=globals(),
79
+ )
80
+
81
+
82
+ __all__ = ["EEGChallengeDataset"] + list(registered_classes.keys())
@@ -0,0 +1,72 @@
1
+ from __future__ import annotations
2
+
3
+ import csv
4
+ from pathlib import Path
5
+ from typing import Any, Dict
6
+
7
+
8
+ def register_openneuro_datasets(
9
+ summary_file: str | Path,
10
+ *,
11
+ base_class=None,
12
+ namespace: Dict[str, Any] | None = None,
13
+ ) -> Dict[str, type]:
14
+ """Dynamically create dataset classes from a summary file.
15
+
16
+ Parameters
17
+ ----------
18
+ summary_file : str | Path
19
+ Path to a CSV file where each line starts with the dataset identifier.
20
+ base_class : type | None
21
+ Base class for the generated datasets. If ``None``, defaults to
22
+ :class:`eegdash.api.EEGDashDataset`.
23
+ namespace : dict | None
24
+ Mapping where the new classes will be registered. Defaults to the
25
+ module's global namespace.
26
+
27
+ Returns
28
+ -------
29
+ dict
30
+ Mapping from class names to the generated classes.
31
+
32
+ """
33
+ if base_class is None:
34
+ from .api import EEGDashDataset as base_class # lazy import
35
+
36
+ summary_path = Path(summary_file)
37
+ namespace = namespace if namespace is not None else globals()
38
+ registered: Dict[str, type] = {}
39
+
40
+ with summary_path.open() as f:
41
+ reader = csv.reader(f)
42
+ for row in reader:
43
+ if not row:
44
+ continue
45
+ dataset_id = row[0].strip()
46
+ if not dataset_id or dataset_id.startswith("#"):
47
+ continue
48
+ class_name = dataset_id.upper()
49
+
50
+ def __init__(
51
+ self,
52
+ cache_dir: str,
53
+ query: dict | None = None,
54
+ s3_bucket: str | None = None,
55
+ **kwargs,
56
+ ):
57
+ q = {"dataset": self._dataset}
58
+ if query:
59
+ q.update(query)
60
+ super().__init__(
61
+ query=q, cache_dir=cache_dir, s3_bucket=s3_bucket, **kwargs
62
+ )
63
+
64
+ cls = type(
65
+ class_name,
66
+ (base_class,),
67
+ {"_dataset": dataset_id, "__init__": __init__},
68
+ )
69
+ namespace[class_name] = cls
70
+ registered[class_name] = cls
71
+
72
+ return registered
@@ -1,35 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eegdash
3
- Version: 0.3.3.dev61
3
+ Version: 0.3.3.dev67
4
4
  Summary: EEG data for machine learning
5
5
  Author-email: Young Truong <dt.young112@gmail.com>, Arnaud Delorme <adelorme@gmail.com>, Aviv Dotan <avivd220@gmail.com>, Oren Shriki <oren70@gmail.com>, Bruno Aristimunha <b.aristimunha@gmail.com>
6
- License: GNU General Public License
7
-
8
- Copyright (C) 2024-2025
9
-
10
- Young Truong, UCSD, dt.young112@gmail.com
11
- Arnaud Delorme, UCSD, adelorme@ucsd.edu
12
- Aviv Dotan, BGU, avivdot@bgu.post.ac.il
13
- Oren Shriki, BGU, shrikio@bgu.ac.il
14
- Bruno Aristimunha, b.aristimunha@gmail.com
15
-
16
- This program is free software; you can redistribute it and/or modify
17
- it under the terms of the GNU General Public License as published by
18
- the Free Software Foundation; either version 2 of the License, or
19
- (at your option) any later version.
20
-
21
- This program is distributed in the hope that it will be useful,
22
- but WITHOUT ANY WARRANTY; without even the implied warranty of
23
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
- GNU General Public License for more details.
25
-
26
- You should have received a copy of the GNU General Public License
27
- along with this program; if not, write to the Free Software
28
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1.07 USA
29
-
6
+ License-Expression: GPL-3.0-only
30
7
  Project-URL: Homepage, https://github.com/sccn/EEG-Dash-Data
31
8
  Project-URL: Issues, https://github.com/sccn/EEG-Dash-Data/issues
32
- Classifier: License :: OSI Approved :: MIT License
33
9
  Classifier: Operating System :: OS Independent
34
10
  Classifier: Intended Audience :: Science/Research
35
11
  Classifier: Intended Audience :: Developers
@@ -8,6 +8,7 @@ eegdash/data_utils.py
8
8
  eegdash/dataset.py
9
9
  eegdash/mongodb.py
10
10
  eegdash/preprocessing.py
11
+ eegdash/registry.py
11
12
  eegdash/utils.py
12
13
  eegdash.egg-info/PKG-INFO
13
14
  eegdash.egg-info/SOURCES.txt
@@ -31,6 +32,7 @@ eegdash/features/feature_bank/spectral.py
31
32
  eegdash/features/feature_bank/utils.py
32
33
  tests/test_correctness.py
33
34
  tests/test_dataset.py
35
+ tests/test_dataset_registration.py
34
36
  tests/test_eegdash.py
35
37
  tests/test_functional.py
36
38
  tests/test_init.py
@@ -14,11 +14,10 @@ authors = [
14
14
  ]
15
15
  description = "EEG data for machine learning"
16
16
  readme = "README.md"
17
- license = { file = "LICENSE" }
17
+ license = "GPL-3.0-only"
18
18
  requires-python = ">=3.10"
19
19
 
20
20
  classifiers = [
21
- "License :: OSI Approved :: MIT License",
22
21
  "Operating System :: OS Independent",
23
22
  "Intended Audience :: Science/Research",
24
23
  "Intended Audience :: Developers",
@@ -0,0 +1,33 @@
1
+ import importlib.util
2
+ from pathlib import Path
3
+
4
+
5
+ class DummyBase:
6
+ pass
7
+
8
+
9
+ def test_register_openneuro_datasets(tmp_path: Path):
10
+ module_path = Path(__file__).resolve().parents[1] / "eegdash" / "registry.py"
11
+ spec = importlib.util.spec_from_file_location("registry", module_path)
12
+ registry = importlib.util.module_from_spec(spec)
13
+ spec.loader.exec_module(registry)
14
+
15
+ summary = tmp_path / "dataset_summary.csv"
16
+ summary.write_text(
17
+ "\n".join(
18
+ [
19
+ "ds002718,18,18,1,74,250,14.844",
20
+ "ds000001,1,1,1,1,1,1",
21
+ ]
22
+ )
23
+ )
24
+ namespace = {}
25
+ registered = registry.register_openneuro_datasets(
26
+ summary, namespace=namespace, base_class=DummyBase
27
+ )
28
+
29
+ assert set(registered) == {"DS002718", "DS000001"}
30
+ ds_class = registered["DS002718"]
31
+ assert ds_class is namespace["DS002718"]
32
+ assert issubclass(ds_class, DummyBase)
33
+ assert ds_class._dataset == "ds002718"
File without changes
File without changes
File without changes