eegdash 0.4.0.dev132__tar.gz → 0.4.0.dev144__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 (72) hide show
  1. {eegdash-0.4.0.dev132/eegdash.egg-info → eegdash-0.4.0.dev144}/PKG-INFO +2 -1
  2. eegdash-0.4.0.dev144/docs/Makefile +69 -0
  3. {eegdash-0.4.0.dev132/docs/source → eegdash-0.4.0.dev144/docs/source/api}/api.rst +10 -12
  4. {eegdash-0.4.0.dev132/docs/source → eegdash-0.4.0.dev144/docs/source/api}/api_core.rst +1 -1
  5. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/docs/source/conf.py +10 -12
  6. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/docs/source/dataset_summary.rst +2 -2
  7. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/docs/source/index.rst +3 -3
  8. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/docs/source/install/install.rst +1 -1
  9. eegdash-0.4.0.dev144/eegdash/__init__.py +21 -0
  10. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/api.py +60 -10
  11. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/bids_eeg_metadata.py +11 -0
  12. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/const.py +18 -0
  13. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/data_utils.py +11 -0
  14. eegdash-0.4.0.dev144/eegdash/dataset/__init__.py +22 -0
  15. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/dataset/dataset_summary.csv +0 -1
  16. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/dataset/registry.py +96 -9
  17. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/downloader.py +11 -0
  18. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/features/serialization.py +8 -4
  19. eegdash-0.4.0.dev144/eegdash/hbn/__init__.py +28 -0
  20. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/hbn/preprocessing.py +11 -0
  21. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/hbn/windows.py +12 -0
  22. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/logging.py +10 -0
  23. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/mongodb.py +11 -0
  24. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/paths.py +11 -0
  25. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/utils.py +10 -0
  26. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144/eegdash.egg-info}/PKG-INFO +2 -1
  27. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash.egg-info/SOURCES.txt +3 -3
  28. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash.egg-info/requires.txt +1 -0
  29. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/pyproject.toml +1 -0
  30. eegdash-0.4.0.dev132/docs/Makefile +0 -33
  31. eegdash-0.4.0.dev132/eegdash/__init__.py +0 -10
  32. eegdash-0.4.0.dev132/eegdash/dataset/__init__.py +0 -4
  33. eegdash-0.4.0.dev132/eegdash/hbn/__init__.py +0 -17
  34. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/LICENSE +0 -0
  35. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/MANIFEST.in +0 -0
  36. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/README.md +0 -0
  37. {eegdash-0.4.0.dev132/docs/source → eegdash-0.4.0.dev144/docs/source/api}/api_features.rst +0 -0
  38. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/docs/source/install/install_pip.rst +0 -0
  39. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/docs/source/install/install_source.rst +0 -0
  40. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/docs/source/overview.rst +0 -0
  41. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/dataset/dataset.py +0 -0
  42. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/features/__init__.py +0 -0
  43. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/features/datasets.py +0 -0
  44. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/features/decorators.py +0 -0
  45. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/features/extractors.py +0 -0
  46. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/features/feature_bank/__init__.py +0 -0
  47. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/features/feature_bank/complexity.py +0 -0
  48. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/features/feature_bank/connectivity.py +0 -0
  49. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/features/feature_bank/csp.py +0 -0
  50. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/features/feature_bank/dimensionality.py +0 -0
  51. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/features/feature_bank/signal.py +0 -0
  52. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/features/feature_bank/spectral.py +0 -0
  53. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/features/feature_bank/utils.py +0 -0
  54. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/features/inspect.py +0 -0
  55. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash/features/utils.py +0 -0
  56. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash.egg-info/dependency_links.txt +0 -0
  57. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/eegdash.egg-info/top_level.txt +0 -0
  58. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/setup.cfg +0 -0
  59. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/tests/test_api.py +0 -0
  60. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/tests/test_bids_dependencies.py +0 -0
  61. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/tests/test_cache_folder_suffix.py +0 -0
  62. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/tests/test_challenge_kwargs.py +0 -0
  63. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/tests/test_correctness.py +0 -0
  64. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/tests/test_dataset.py +0 -0
  65. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/tests/test_dataset_registration.py +0 -0
  66. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/tests/test_downloader.py +0 -0
  67. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/tests/test_eegdash.py +0 -0
  68. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/tests/test_init.py +0 -0
  69. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/tests/test_minirelease.py +0 -0
  70. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/tests/test_mongo_connection.py +0 -0
  71. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/tests/test_offline.py +0 -0
  72. {eegdash-0.4.0.dev132 → eegdash-0.4.0.dev144}/tests/test_query.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eegdash
3
- Version: 0.4.0.dev132
3
+ Version: 0.4.0.dev144
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
6
  License-Expression: GPL-3.0-only
@@ -65,6 +65,7 @@ Requires-Dist: ipython; extra == "docs"
65
65
  Requires-Dist: lightgbm; extra == "docs"
66
66
  Requires-Dist: plotly; extra == "docs"
67
67
  Requires-Dist: nbformat; extra == "docs"
68
+ Requires-Dist: graphviz; extra == "docs"
68
69
  Provides-Extra: all
69
70
  Requires-Dist: eegdash[docs]; extra == "all"
70
71
  Requires-Dist: eegdash[dev]; extra == "all"
@@ -0,0 +1,69 @@
1
+ # Minimal makefile for Sphinx documentation
2
+ SPHINXOPTS ?=
3
+ SPHINXBUILD ?= sphinx-build
4
+ SOURCEDIR = source
5
+ BUILDDIR = build
6
+ PKG ?= eegdash
7
+ APIDIR := $(SOURCEDIR)/api
8
+
9
+ help:
10
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
11
+
12
+ .PHONY: apidoc
13
+ apidoc:
14
+ # Generate full API docs, then prune duplicates covered by autosummary
15
+ @python -m sphinx.ext.apidoc -f -e -M -o "$(APIDIR)/dataset" "../$(PKG)"
16
+ # Remove top-level package page and modules covered elsewhere
17
+ @rm -f "$(APIDIR)/dataset/eegdash.rst"
18
+ @rm -f "$(APIDIR)/dataset/eegdash.api.rst"
19
+ @rm -f "$(APIDIR)/dataset/eegdash.bids_eeg_metadata.rst"
20
+ @rm -f "$(APIDIR)/dataset/eegdash.const.rst"
21
+ @rm -f "$(APIDIR)/dataset/eegdash.data_utils.rst"
22
+ @rm -f "$(APIDIR)/dataset/eegdash.logging.rst"
23
+ @rm -f "$(APIDIR)/dataset/eegdash.mongodb.rst"
24
+ @rm -f "$(APIDIR)/dataset/eegdash.paths.rst"
25
+ @rm -f "$(APIDIR)/dataset/eegdash.utils.rst"
26
+ @rm -f "$(APIDIR)/dataset/eegdash.features.rst"
27
+ @rm -f $(APIDIR)/dataset/eegdash.features.*.rst
28
+ @rm -f "$(APIDIR)/dataset/eegdash.hbn.rst"
29
+ @rm -f $(APIDIR)/dataset/eegdash.hbn.*.rst
30
+ @rm -f "$(APIDIR)/dataset/modules.rst"
31
+
32
+ .PHONY: dataset-pages
33
+ dataset-pages:
34
+ # Generate individual dataset documentation pages
35
+ @python generate_dataset_pages.py
36
+
37
+ # Standard build runs examples
38
+ html: apidoc dataset-pages
39
+
40
+ # Fast build: do NOT execute examples (sphinx-gallery)
41
+ .PHONY: html-noplot
42
+ html-noplot: apidoc dataset-pages
43
+ @python prepare_summary_tables.py ../eegdash/ $(BUILDDIR)
44
+ @$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" \
45
+ $(SPHINXOPTS) -D sphinx_gallery_conf.plot_gallery=0 $(O)
46
+
47
+ # Custom clean target to remove generated API docs and build files
48
+ .PHONY: clean
49
+ clean:
50
+ @echo "Removing generated API documentation..."
51
+ @rm -rf "$(APIDIR)/dataset"
52
+ @rm -rf "$(APIDIR)/generated"
53
+ @echo "Removing generated dataset pages..."
54
+ @rm -rf "$(APIDIR)/datasets"
55
+ @rm -f "$(APIDIR)/api_dataset.rst"
56
+ @echo "Removing other generated directories..."
57
+ @rm -rf "$(SOURCEDIR)/generated"
58
+ @rm -rf "$(SOURCEDIR)/gen_modules"
59
+ @echo "Removing build directory..."
60
+ @rm -rf "$(BUILDDIR)"
61
+ @echo "Clean completed."
62
+
63
+ .PHONY: help apidoc
64
+ Makefile: ;
65
+
66
+ %: Makefile
67
+ @python prepare_summary_tables.py ../eegdash/ $(BUILDDIR)
68
+ @python generate_dataset_pages.py
69
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@@ -1,10 +1,12 @@
1
+ :html_theme.sidebar_primary.remove: true
2
+
1
3
  .. _api:
2
4
 
3
5
  API Reference
4
6
  =============
5
7
 
6
- .. grid:: 2
7
- :gutter: 2
8
+ .. grid:: 1
9
+ :gutter: 3
8
10
 
9
11
  .. grid-item-card:: Core
10
12
  :class-header: sd-bg-primary sd-text-white sd-font-weight-bold
@@ -20,20 +22,16 @@ API Reference
20
22
 
21
23
  Feature extraction and processing routines.
22
24
 
23
- Datasets
24
- --------
25
-
26
- .. toctree::
27
- :maxdepth: 2
28
-
29
- api/dataset/modules
25
+ .. grid-item-card:: Dataset
26
+ :class-header: sd-bg-primary sd-text-white sd-font-weight-bold
27
+ :link: api_dataset
28
+ :link-type: doc
30
29
 
31
- .. note::
32
- The dataset API above is generated automatically during the build.
30
+ Datasets available at EEGDash.
33
31
 
34
32
  .. toctree::
35
33
  :hidden:
36
34
 
37
35
  api_core
38
36
  api_features
39
-
37
+ api_dataset
@@ -11,8 +11,8 @@ Core API
11
11
  bids_eeg_metadata
12
12
  const
13
13
  data_utils
14
+ logging
14
15
  hbn
15
16
  mongodb
16
17
  paths
17
18
  utils
18
-
@@ -32,16 +32,20 @@ extensions = [
32
32
  "sphinx.ext.linkcode",
33
33
  "sphinx.ext.napoleon",
34
34
  "sphinx_design",
35
- # "autoapi.extension",
36
35
  "numpydoc",
37
36
  "sphinx_gallery.gen_gallery",
38
- # Generate sitemap.xml for search engines
39
37
  "sphinx_sitemap",
40
38
  ]
41
39
 
42
40
  templates_path = ["_templates"]
43
41
  exclude_patterns = ["build", "Thumbs.db", ".DS_Store"]
44
42
 
43
+ # Suppress benign warnings
44
+ suppress_warnings = [
45
+ # Sphinx-Gallery uses functions/classes in config which are not picklable
46
+ "config.cache",
47
+ ]
48
+
45
49
  # -- Options for HTML output -------------------------------------------------
46
50
 
47
51
  html_theme = "pydata_sphinx_theme"
@@ -55,7 +59,7 @@ html_js_files = []
55
59
 
56
60
  # Required for sphinx-sitemap: set the canonical base URL of the site
57
61
  # Make sure this matches the actual published docs URL and ends with '/'
58
- html_baseurl = "https://sccn.github.io/eegdash/"
62
+ html_baseurl = "https://eegdash.org/"
59
63
 
60
64
  html_theme_options = {
61
65
  "icon_links_label": "External Links", # for screen reader
@@ -91,7 +95,7 @@ html_theme_options = {
91
95
  },
92
96
  {
93
97
  "name": "Docs (Stable)",
94
- "url": "https://sccn.github.io/EEGDash",
98
+ "url": "https://eegdash.org/EEGDash",
95
99
  "icon": "fa-solid fa-book",
96
100
  "type": "fontawesome",
97
101
  },
@@ -182,7 +186,7 @@ numpydoc_show_class_members = False
182
186
  # Sphinx Gallery
183
187
  EX_DIR = "../../examples" # relative to docs/source
184
188
  sphinx_gallery_conf = {
185
- "examples_dirs": [EX_DIR],
189
+ "examples_dirs": [f"{EX_DIR}"],
186
190
  "gallery_dirs": ["generated/auto_examples"],
187
191
  "nested_sections": False,
188
192
  "backreferences_dir": "gen_modules/backreferences",
@@ -198,13 +202,7 @@ sphinx_gallery_conf = {
198
202
  "# `pip install eegdash`\n"
199
203
  "%matplotlib inline"
200
204
  ),
201
- "subsection_order": ExplicitOrder(
202
- [
203
- f"{EX_DIR}/core",
204
- # f"{EX_DIR}/eeg2025",
205
- "*",
206
- ]
207
- ),
205
+ "subsection_order": ExplicitOrder([f"{EX_DIR}/core", "*"]),
208
206
  "within_subsection_order": FileNameSortKey,
209
207
  }
210
208
 
@@ -4,8 +4,8 @@
4
4
 
5
5
  .. _data_summary:
6
6
 
7
- EEGDash
8
- ========
7
+ Dataset Summary
8
+ ===============
9
9
 
10
10
  To leverage recent and ongoing advancements in large-scale computational methods and to ensure the preservation of scientific data generated from publicly funded research, the EEG-DaSh data archive will create a data-sharing resource for MEEG (EEG, MEG) data contributed by collaborators for machine learning (ML) and deep learning (DL) applications.
11
11
 
@@ -1,7 +1,7 @@
1
1
  :html_theme.sidebar_secondary.remove: true
2
2
 
3
- EEGDASH Documentation
4
- =====================
3
+ EEGDASH Homepage
4
+ =================
5
5
 
6
6
  .. title:: EEG Dash
7
7
 
@@ -55,6 +55,6 @@ The archive is currently still in :bdg-danger:`beta testing` mode, so be kind.
55
55
 
56
56
  Overview <overview>
57
57
  Install <install/install>
58
- API <api>
58
+ API <api/api>
59
59
  Dataset Summary <dataset_summary>
60
60
  Examples <generated/auto_examples/index>
@@ -6,7 +6,7 @@
6
6
  Installation
7
7
  ================
8
8
 
9
- EEGDash is written in Python 3, specifically for version 3.8 or above.
9
+ EEGDash is written in Python 3, specifically for version 3.10 or above.
10
10
 
11
11
  The package is distributed via Python package index (`PyPI <eegdash-pypi_>`_), and you can access the
12
12
  source code via `Github <eegdash-github_>`_ repository.
@@ -0,0 +1,21 @@
1
+ # Authors: The EEGDash contributors.
2
+ # License: GNU General Public License
3
+ # Copyright the EEGDash contributors.
4
+
5
+ """EEGDash: A comprehensive platform for EEG data management and analysis.
6
+
7
+ EEGDash provides a unified interface for accessing, querying, and analyzing large-scale
8
+ EEG datasets. It integrates with cloud storage, MongoDB databases, and machine learning
9
+ frameworks to streamline EEG research workflows.
10
+ """
11
+
12
+ from .api import EEGDash, EEGDashDataset
13
+ from .dataset import EEGChallengeDataset
14
+ from .hbn import preprocessing
15
+ from .utils import _init_mongo_client
16
+
17
+ _init_mongo_client()
18
+
19
+ __all__ = ["EEGDash", "EEGDashDataset", "EEGChallengeDataset", "preprocessing"]
20
+
21
+ __version__ = "0.4.0.dev144"
@@ -1,3 +1,15 @@
1
+ # Authors: The EEGDash contributors.
2
+ # License: GNU General Public License
3
+ # Copyright the EEGDash contributors.
4
+
5
+ """High-level interface to the EEGDash metadata database.
6
+
7
+ This module provides the main EEGDash class which serves as the primary entry point for
8
+ interacting with the EEGDash ecosystem. It offers methods to query, insert, and update
9
+ metadata records stored in the EEGDash MongoDB database, and includes utilities to load
10
+ EEG data from S3 for matched records.
11
+ """
12
+
1
13
  import os
2
14
  from pathlib import Path
3
15
  from typing import Any, Mapping
@@ -549,16 +561,54 @@ class EEGDashDataset(BaseConcatDataset, metaclass=NumpyDocstringInheritanceInitM
549
561
 
550
562
  Examples
551
563
  --------
552
- # Find by single subject
553
- >>> ds = EEGDashDataset(dataset="ds005505", subject="NDARCA153NKE")
554
-
555
- # Find by a list of subjects and a specific task
556
- >>> subjects = ["NDARCA153NKE", "NDARXT792GY8"]
557
- >>> ds = EEGDashDataset(dataset="ds005505", subject=subjects, task="RestingState")
558
-
559
- # Use a raw MongoDB query for advanced filtering
560
- >>> raw_query = {"dataset": "ds005505", "subject": {"$in": subjects}}
561
- >>> ds = EEGDashDataset(query=raw_query)
564
+ Basic usage with dataset and subject filtering:
565
+
566
+ >>> from eegdash import EEGDashDataset
567
+ >>> dataset = EEGDashDataset(
568
+ ... cache_dir="./data",
569
+ ... dataset="ds002718",
570
+ ... subject="012"
571
+ ... )
572
+ >>> print(f"Number of recordings: {len(dataset)}")
573
+
574
+ Filter by multiple subjects and specific task:
575
+
576
+ >>> subjects = ["012", "013", "014"]
577
+ >>> dataset = EEGDashDataset(
578
+ ... cache_dir="./data",
579
+ ... dataset="ds002718",
580
+ ... subject=subjects,
581
+ ... task="RestingState"
582
+ ... )
583
+
584
+ Load and inspect EEG data from recordings:
585
+
586
+ >>> if len(dataset) > 0:
587
+ ... recording = dataset[0]
588
+ ... raw = recording.load()
589
+ ... print(f"Sampling rate: {raw.info['sfreq']} Hz")
590
+ ... print(f"Number of channels: {len(raw.ch_names)}")
591
+ ... print(f"Duration: {raw.times[-1]:.1f} seconds")
592
+
593
+ Advanced filtering with raw MongoDB queries:
594
+
595
+ >>> from eegdash import EEGDashDataset
596
+ >>> query = {
597
+ ... "dataset": "ds002718",
598
+ ... "subject": {"$in": ["012", "013"]},
599
+ ... "task": "RestingState"
600
+ ... }
601
+ >>> dataset = EEGDashDataset(cache_dir="./data", query=query)
602
+
603
+ Working with dataset collections and braindecode integration:
604
+
605
+ >>> # EEGDashDataset is a braindecode BaseConcatDataset
606
+ >>> for i, recording in enumerate(dataset):
607
+ ... if i >= 2: # limit output
608
+ ... break
609
+ ... print(f"Recording {i}: {recording.description}")
610
+ ... raw = recording.load()
611
+ ... print(f" Channels: {len(raw.ch_names)}, Duration: {raw.times[-1]:.1f}s")
562
612
 
563
613
  Parameters
564
614
  ----------
@@ -1,3 +1,14 @@
1
+ # Authors: The EEGDash contributors.
2
+ # License: GNU General Public License
3
+ # Copyright the EEGDash contributors.
4
+
5
+ """BIDS metadata processing and query building utilities.
6
+
7
+ This module provides functions for processing BIDS-formatted EEG metadata, building database
8
+ queries from user parameters, and enriching metadata records with participant information.
9
+ It handles the translation between user-friendly query parameters and MongoDB query syntax.
10
+ """
11
+
1
12
  import re
2
13
  from pathlib import Path
3
14
  from typing import Any
@@ -1,3 +1,21 @@
1
+ # Authors: The EEGDash contributors.
2
+ # License: GNU General Public License
3
+ # Copyright the EEGDash contributors.
4
+
5
+ """Configuration constants and mappings for EEGDash.
6
+
7
+ This module contains global configuration settings, allowed query fields, and mapping
8
+ constants used throughout the EEGDash package. It defines the interface between EEGDash
9
+ releases and OpenNeuro dataset identifiers, as well as validation rules for database queries.
10
+ """
11
+
12
+ __all__ = [
13
+ "config",
14
+ "ALLOWED_QUERY_FIELDS",
15
+ "RELEASE_TO_OPENNEURO_DATASET_MAP",
16
+ "SUBJECT_MINI_RELEASE_MAP",
17
+ ]
18
+
1
19
  ALLOWED_QUERY_FIELDS = {
2
20
  "data_name",
3
21
  "dataset",
@@ -1,3 +1,14 @@
1
+ # Authors: The EEGDash contributors.
2
+ # License: GNU General Public License
3
+ # Copyright the EEGDash contributors.
4
+
5
+ """Data utilities and dataset classes for EEG data handling.
6
+
7
+ This module provides core dataset classes for working with EEG data in the EEGDash ecosystem,
8
+ including classes for individual recordings and collections of datasets. It integrates with
9
+ braindecode for machine learning workflows and handles data loading from both local and remote sources.
10
+ """
11
+
1
12
  import io
2
13
  import json
3
14
  import os
@@ -0,0 +1,22 @@
1
+ """Public API for dataset helpers and dynamically generated datasets."""
2
+
3
+ from . import dataset as _dataset_mod # triggers dynamic class registration
4
+ from .dataset import EEGChallengeDataset
5
+ from .registry import register_openneuro_datasets
6
+
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
@@ -10,7 +10,6 @@
10
10
  8,ds005508,3342,324,10,129,500,269.281,229.81 GB,246753736933,0,,,,,
11
11
  9,ds005507,1812,184,10,129,500,168.649,139.37 GB,149646718160,0,,,,,
12
12
  10,ds005506,1405,150,10,129,500,127.896,111.88 GB,120126449650,0,,,,,
13
- 11,test,2,1,1,64,500,20.556,0 B,0,0,,,,,
14
13
  12,ds004854,1,1,1,64,128,0.535,79.21 MB,83057080,0,,,,,
15
14
  13,ds004853,1,1,1,64,128,0.535,79.21 MB,83057080,0,,,,,
16
15
  14,ds004844,68,17,1,64,1024,21.252,22.33 GB,23976121966,0,ds004844,,,Multisensory,Decision-making
@@ -57,14 +57,8 @@ def register_openneuro_datasets(
57
57
 
58
58
  init = make_init(dataset_id)
59
59
 
60
- doc = f"""OpenNeuro dataset ``{dataset_id}``.
61
-
62
- {_markdown_table(row_series)}
63
-
64
- This class is a thin convenience wrapper for the dataset ``{dataset_id}``.
65
- Constructor arguments are forwarded to :class:`{base_class.__name__}`; see the
66
- base class documentation for parameter details and examples.
67
- """
60
+ # Generate rich docstring with dataset metadata
61
+ doc = _generate_rich_docstring(dataset_id, row_series, base_class)
68
62
 
69
63
  # init.__doc__ = doc
70
64
 
@@ -90,6 +84,94 @@ def register_openneuro_datasets(
90
84
  return registered
91
85
 
92
86
 
87
+ def _generate_rich_docstring(dataset_id: str, row_series: pd.Series, base_class) -> str:
88
+ """Generate a comprehensive docstring for a dataset class."""
89
+ # Extract metadata with safe defaults
90
+ n_subjects = row_series.get("n_subjects", "Unknown")
91
+ n_records = row_series.get("n_records", "Unknown")
92
+ n_tasks = row_series.get("n_tasks", "Unknown")
93
+ modality = row_series.get("modality of exp", "")
94
+ exp_type = row_series.get("type of exp", "")
95
+ subject_type = row_series.get("Type Subject", "")
96
+ duration = row_series.get("duration_hours_total", "Unknown")
97
+ size = row_series.get("size", "Unknown")
98
+
99
+ # Create description based on available metadata
100
+ description_parts = []
101
+ if modality and str(modality).strip():
102
+ description_parts.append(f"**Modality**: {modality}")
103
+ if exp_type and str(exp_type).strip():
104
+ description_parts.append(f"**Type**: {exp_type}")
105
+ if subject_type and str(subject_type).strip():
106
+ description_parts.append(f"**Subjects**: {subject_type}")
107
+
108
+ description = (
109
+ " | ".join(description_parts)
110
+ if description_parts
111
+ else "EEG dataset from OpenNeuro"
112
+ )
113
+
114
+ # Generate the docstring
115
+ docstring = f"""OpenNeuro dataset ``{dataset_id}``.
116
+
117
+ {description}
118
+
119
+ This dataset contains {n_subjects} subjects with {n_records} recordings across {n_tasks} tasks.
120
+ Total duration: {duration} hours. Dataset size: {size}.
121
+
122
+ {_markdown_table(row_series)}
123
+
124
+ This dataset class provides convenient access to the ``{dataset_id}`` dataset through the EEGDash interface.
125
+ It inherits all functionality from :class:`~{base_class.__module__}.{base_class.__name__}` with the dataset filter pre-configured.
126
+
127
+ Parameters
128
+ ----------
129
+ cache_dir : str
130
+ Directory to cache downloaded data.
131
+ query : dict, optional
132
+ Additional MongoDB-style filters to AND with the dataset selection.
133
+ Must not contain the key ``dataset``.
134
+ s3_bucket : str, optional
135
+ Base S3 bucket used to locate the data.
136
+ **kwargs
137
+ Additional arguments passed to the base dataset class.
138
+
139
+ Examples
140
+ --------
141
+ Basic usage:
142
+
143
+ >>> from eegdash.dataset import {dataset_id.upper()}
144
+ >>> dataset = {dataset_id.upper()}(cache_dir="./data")
145
+ >>> print(f"Number of recordings: {{len(dataset)}}")
146
+
147
+ Load a specific recording:
148
+
149
+ >>> if len(dataset) > 0:
150
+ ... recording = dataset[0]
151
+ ... raw = recording.load()
152
+ ... print(f"Sampling rate: {{raw.info['sfreq']}} Hz")
153
+ ... print(f"Number of channels: {{len(raw.ch_names)}}")
154
+
155
+ Filter by additional criteria:
156
+
157
+ >>> # Get subset with specific task or subject
158
+ >>> filtered_dataset = {dataset_id.upper()}(
159
+ ... cache_dir="./data",
160
+ ... query={{"task": "RestingState"}} # if applicable
161
+ ... )
162
+
163
+ Notes
164
+ -----
165
+ More details available in the `NEMAR documentation <https://nemar.org/dataexplorer/detail?dataset_id={dataset_id}>`__.
166
+
167
+ See Also
168
+ --------
169
+ {base_class.__name__} : Base dataset class with full API documentation
170
+ """
171
+
172
+ return docstring
173
+
174
+
93
175
  def _markdown_table(row_series: pd.Series) -> str:
94
176
  """Create a reStructuredText grid table from a pandas Series."""
95
177
  if row_series.empty:
@@ -128,7 +210,12 @@ def _markdown_table(row_series: pd.Series) -> str:
128
210
  table = tabulate(df, headers="keys", tablefmt="rst", showindex=False)
129
211
 
130
212
  # Add a caption for the table
131
- caption = f"Short overview of dataset {dataset_id} more details in the `Nemar documentation <https://nemar.org/dataexplorer/detail?dataset_id={dataset_id}>`_."
213
+ # Use an anonymous external link (double underscore) to avoid duplicate
214
+ # target warnings when this docstring is repeated across many classes.
215
+ caption = (
216
+ f"Short overview of dataset {dataset_id} more details in the "
217
+ f"`NeMAR documentation <https://nemar.org/dataexplorer/detail?dataset_id={dataset_id}>`__."
218
+ )
132
219
  # adding caption below the table
133
220
  # Indent the table to fit within the admonition block
134
221
  indented_table = "\n".join(" " + line for line in table.split("\n"))
@@ -1,3 +1,14 @@
1
+ # Authors: The EEGDash contributors.
2
+ # License: GNU General Public License
3
+ # Copyright the EEGDash contributors.
4
+
5
+ """File downloading utilities for EEG data from cloud storage.
6
+
7
+ This module provides functions for downloading EEG data files and BIDS dependencies from
8
+ AWS S3 storage, with support for caching and progress tracking. It handles the communication
9
+ between the EEGDash metadata database and the actual EEG data stored in the cloud.
10
+ """
11
+
1
12
  import re
2
13
  import tempfile
3
14
  from pathlib import Path
@@ -1,6 +1,8 @@
1
- """Convenience functions for storing and loading of features datasets.
1
+ """Convenience functions for storing and loading features datasets.
2
+
3
+ See Also:
4
+ https://github.com/braindecode/braindecode//blob/master/braindecode/datautil/serialization.py#L165-L229
2
5
 
3
- see also: https://github.com/braindecode/braindecode//blob/master/braindecode/datautil/serialization.py#L165-L229
4
6
  """
5
7
 
6
8
  from pathlib import Path
@@ -15,7 +17,7 @@ from .datasets import FeaturesConcatDataset, FeaturesDataset
15
17
 
16
18
 
17
19
  def load_features_concat_dataset(path, ids_to_load=None, n_jobs=1):
18
- """Load a stored FeaturesConcatDataset of FeaturesDatasets from files.
20
+ """Load a stored features dataset from files.
19
21
 
20
22
  Parameters
21
23
  ----------
@@ -28,7 +30,9 @@ def load_features_concat_dataset(path, ids_to_load=None, n_jobs=1):
28
30
 
29
31
  Returns
30
32
  -------
31
- concat_dataset: FeaturesConcatDataset of FeaturesDatasets
33
+ concat_dataset: eegdash.features.datasets.FeaturesConcatDataset
34
+ A concatenation of multiple eegdash.features.datasets.FeaturesDataset
35
+ instances loaded from the given directory.
32
36
 
33
37
  """
34
38
  # Make sure we always work with a pathlib.Path
@@ -0,0 +1,28 @@
1
+ # Authors: The EEGDash contributors.
2
+ # License: GNU General Public License
3
+ # Copyright the EEGDash contributors.
4
+
5
+ """Healthy Brain Network (HBN) specific utilities and preprocessing.
6
+
7
+ This module provides specialized functions for working with the Healthy Brain Network
8
+ dataset, including preprocessing pipelines, annotation handling, and windowing utilities
9
+ tailored for HBN EEG data analysis.
10
+ """
11
+
12
+ from .preprocessing import hbn_ec_ec_reannotation
13
+ from .windows import (
14
+ add_aux_anchors,
15
+ add_extras_columns,
16
+ annotate_trials_with_target,
17
+ build_trial_table,
18
+ keep_only_recordings_with,
19
+ )
20
+
21
+ __all__ = [
22
+ "hbn_ec_ec_reannotation",
23
+ "build_trial_table",
24
+ "annotate_trials_with_target",
25
+ "add_aux_anchors",
26
+ "add_extras_columns",
27
+ "keep_only_recordings_with",
28
+ ]
@@ -1,3 +1,14 @@
1
+ # Authors: The EEGDash contributors.
2
+ # License: GNU General Public License
3
+ # Copyright the EEGDash contributors.
4
+
5
+ """Preprocessing utilities specific to the Healthy Brain Network dataset.
6
+
7
+ This module contains preprocessing classes and functions designed specifically for
8
+ HBN EEG data, including specialized annotation handling for eyes-open/eyes-closed
9
+ paradigms and other HBN-specific preprocessing steps.
10
+ """
11
+
1
12
  import mne
2
13
  import numpy as np
3
14
 
@@ -1,3 +1,15 @@
1
+ # Authors: The EEGDash contributors.
2
+ # License: GNU General Public License
3
+ # Copyright the EEGDash contributors.
4
+
5
+ """Windowing and trial processing utilities for HBN datasets.
6
+
7
+ This module provides functions for building trial tables, adding auxiliary anchors,
8
+ annotating trials with targets, and filtering recordings based on various criteria.
9
+ These utilities are specifically designed for working with HBN EEG data structures
10
+ and experimental paradigms.
11
+ """
12
+
1
13
  import logging
2
14
 
3
15
  import mne
@@ -1,3 +1,13 @@
1
+ # Authors: The EEGDash contributors.
2
+ # License: GNU General Public License
3
+ # Copyright the EEGDash contributors.
4
+
5
+ """Logging configuration for EEGDash.
6
+
7
+ This module sets up centralized logging for the EEGDash package using Rich for enhanced
8
+ console output formatting. It provides a consistent logging interface across all modules.
9
+ """
10
+
1
11
  import logging
2
12
 
3
13
  from rich.logging import RichHandler
@@ -1,3 +1,14 @@
1
+ # Authors: The EEGDash contributors.
2
+ # License: GNU General Public License
3
+ # Copyright the EEGDash contributors.
4
+
5
+ """MongoDB connection and operations management.
6
+
7
+ This module provides thread-safe MongoDB connection management and high-level database
8
+ operations for the EEGDash metadata database. It includes methods for finding, adding,
9
+ and updating EEG data records with proper connection pooling and error handling.
10
+ """
11
+
1
12
  import threading
2
13
 
3
14
  from pymongo import MongoClient
@@ -1,3 +1,14 @@
1
+ # Authors: The EEGDash contributors.
2
+ # License: GNU General Public License
3
+ # Copyright the EEGDash contributors.
4
+
5
+ """Path utilities and cache directory management.
6
+
7
+ This module provides functions for resolving consistent cache directories and path
8
+ management throughout the EEGDash package, with integration to MNE-Python's
9
+ configuration system.
10
+ """
11
+
1
12
  from __future__ import annotations
2
13
 
3
14
  import os
@@ -1,3 +1,13 @@
1
+ # Authors: The EEGDash contributors.
2
+ # License: GNU General Public License
3
+ # Copyright the EEGDash contributors.
4
+
5
+ """General utility functions for EEGDash.
6
+
7
+ This module contains miscellaneous utility functions used across the EEGDash package,
8
+ including MongoDB client initialization and configuration helpers.
9
+ """
10
+
1
11
  from mne.utils import get_config, set_config, use_log_level
2
12
 
3
13
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eegdash
3
- Version: 0.4.0.dev132
3
+ Version: 0.4.0.dev144
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
6
  License-Expression: GPL-3.0-only
@@ -65,6 +65,7 @@ Requires-Dist: ipython; extra == "docs"
65
65
  Requires-Dist: lightgbm; extra == "docs"
66
66
  Requires-Dist: plotly; extra == "docs"
67
67
  Requires-Dist: nbformat; extra == "docs"
68
+ Requires-Dist: graphviz; extra == "docs"
68
69
  Provides-Extra: all
69
70
  Requires-Dist: eegdash[docs]; extra == "all"
70
71
  Requires-Dist: eegdash[dev]; extra == "all"
@@ -3,13 +3,13 @@ MANIFEST.in
3
3
  README.md
4
4
  pyproject.toml
5
5
  docs/Makefile
6
- docs/source/api.rst
7
- docs/source/api_core.rst
8
- docs/source/api_features.rst
9
6
  docs/source/conf.py
10
7
  docs/source/dataset_summary.rst
11
8
  docs/source/index.rst
12
9
  docs/source/overview.rst
10
+ docs/source/api/api.rst
11
+ docs/source/api/api_core.rst
12
+ docs/source/api/api_features.rst
13
13
  docs/source/install/install.rst
14
14
  docs/source/install/install_pip.rst
15
15
  docs/source/install/install_source.rst
@@ -40,6 +40,7 @@ ipython
40
40
  lightgbm
41
41
  plotly
42
42
  nbformat
43
+ graphviz
43
44
 
44
45
  [tests]
45
46
  pytest
@@ -87,6 +87,7 @@ docs = [
87
87
  "lightgbm",
88
88
  "plotly",
89
89
  "nbformat",
90
+ "graphviz",
90
91
  ]
91
92
 
92
93
  all = [
@@ -1,33 +0,0 @@
1
- # Minimal makefile for Sphinx documentation
2
- SPHINXOPTS ?=
3
- SPHINXBUILD ?= sphinx-build
4
- SOURCEDIR = source
5
- BUILDDIR = build
6
- PKG ?= eegdash
7
- APIDIR := $(SOURCEDIR)/api
8
-
9
- help:
10
- @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
11
-
12
- .PHONY: apidoc
13
- apidoc:
14
- # Generate API docs using the top-level package so modules are importable
15
- # as eegdash.* instead of an unimportable bare 'dataset.*'
16
- @python -m sphinx.ext.apidoc -o "$(APIDIR)/dataset" "../$(PKG)" -f -e -M
17
-
18
- # Standard build runs examples
19
- html: apidoc
20
-
21
- # Fast build: do NOT execute examples (sphinx-gallery)
22
- .PHONY: html-noplot
23
- html-noplot: apidoc
24
- @python prepare_summary_tables.py ../eegdash/ $(BUILDDIR)
25
- @$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" \
26
- $(SPHINXOPTS) -D sphinx_gallery_conf.plot_gallery=0 $(O)
27
-
28
- .PHONY: help apidoc
29
- Makefile: ;
30
-
31
- %: Makefile
32
- @python prepare_summary_tables.py ../eegdash/ $(BUILDDIR)
33
- @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@@ -1,10 +0,0 @@
1
- from .api import EEGDash, EEGDashDataset
2
- from .dataset import EEGChallengeDataset
3
- from .hbn import preprocessing
4
- from .utils import _init_mongo_client
5
-
6
- _init_mongo_client()
7
-
8
- __all__ = ["EEGDash", "EEGDashDataset", "EEGChallengeDataset", "preprocessing"]
9
-
10
- __version__ = "0.4.0.dev132"
@@ -1,4 +0,0 @@
1
- from .dataset import EEGChallengeDataset
2
- from .registry import register_openneuro_datasets
3
-
4
- __all__ = ["EEGChallengeDataset", "register_openneuro_datasets"]
@@ -1,17 +0,0 @@
1
- from .preprocessing import hbn_ec_ec_reannotation
2
- from .windows import (
3
- add_aux_anchors,
4
- add_extras_columns,
5
- annotate_trials_with_target,
6
- build_trial_table,
7
- keep_only_recordings_with,
8
- )
9
-
10
- __all__ = [
11
- "hbn_ec_ec_reannotation",
12
- "build_trial_table",
13
- "annotate_trials_with_target",
14
- "add_aux_anchors",
15
- "add_extras_columns",
16
- "keep_only_recordings_with",
17
- ]
File without changes
File without changes
File without changes