Skip to content

Commit 4e2b09a

Browse files
final details
1 parent b0e0975 commit 4e2b09a

File tree

4 files changed

+46
-20
lines changed

4 files changed

+46
-20
lines changed

docs/source/conf.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,22 @@ def linkcode_resolve(domain, info):
322322
"""
323323

324324

325+
BASE_DATASET_TEMPLATE = """{notice}.. _api_eegdash_challenge_dataset:
326+
327+
.. currentmodule:: eegdash.dataset
328+
329+
EEGChallengeDataset
330+
===================
331+
332+
.. autoclass:: eegdash.dataset.EEGChallengeDataset
333+
:members:
334+
:undoc-members:
335+
:show-inheritance:
336+
:member-order: bysource
337+
338+
"""
339+
340+
325341
def _write_if_changed(path: Path, content: str) -> bool:
326342
"""Write ``content`` to ``path`` if it differs from the current file."""
327343
existing = path.read_text(encoding="utf-8") if path.exists() else None
@@ -548,6 +564,11 @@ def _generate_dataset_docs(app) -> None:
548564
if _write_if_changed(index_path, index_content):
549565
LOGGER.info("[dataset-docs] Updated %s", index_path.relative_to(app.srcdir))
550566

567+
base_content = BASE_DATASET_TEMPLATE.format(notice=AUTOGEN_NOTICE)
568+
base_path = dataset_dir / "eegdash.dataset.EEGChallengeDataset.rst"
569+
if _write_if_changed(base_path, base_content):
570+
LOGGER.info("[dataset-docs] Updated %s", base_path.relative_to(app.srcdir))
571+
551572
generated_paths: set[Path] = set()
552573
for name in dataset_names:
553574
title = f"eegdash.dataset.{name}"

docs/source/user_guide.rst

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22

33
:html_theme.sidebar_secondary.remove: true
44

5+
.. currentmodule:: eegdash.api
6+
7+
58
User Guide
69
==========
710

8-
This guide provides a comprehensive overview of the :mod:`eegdash` library, focusing on its core data access object, :class:`eegdash.api.EEGDashDataset`. You will learn how to use this object to find, access, and manage EEG data for your research and analysis tasks.
11+
This guide provides a comprehensive overview of the :mod:`eegdash` library, focusing on its core data access object, :class:`~eegdash.api.EEGDashDataset`. You will learn how to use this object to find, access, and manage EEG data for your research and analysis tasks.
912

1013
The EEGDash Object
1114
------------------
1215

13-
While :class:`eegdash.api.EEGDashDataset` is the main tool for loading data for machine learning, the :class:`eegdash.api.EEGDash` object provides a lower-level interface for directly interacting with the metadata database. It is useful for exploring the available data, performing complex queries, or managing metadata records.
16+
While :class:`~eegdash.api.EEGDashDataset` is the main tool for loading data for machine learning, the :class:`~eegdash.api.EEGDash` object provides a lower-level interface for directly interacting with the metadata database. It is useful for exploring the available data, performing complex queries, or managing metadata records.
1417

1518
Initializing EEGDash
1619
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -45,20 +48,20 @@ EEGDash vs. EEGDashDataset
4548

4649
It's important to understand the distinction between these two objects:
4750

48-
- :class:`eegdash.api.EEGDash`: Use this for querying and managing metadata. It returns a list of dictionaries, where each dictionary is a record from the database.
49-
- :class:`eegdash.api.EEGDashDataset`: Use this when you need to load EEG data for analysis or machine learning. It returns a PyTorch-compatible dataset object where each item can load the actual EEG signal.
51+
- :class:`~eegdash.api.EEGDash`: Use this for querying and managing metadata. It returns a list of dictionaries, where each dictionary is a record from the database.
52+
- :class:`~eegdash.api.EEGDashDataset`: Use this when you need to load EEG data for analysis or machine learning. It returns a PyTorch-compatible dataset object where each item can load the actual EEG signal.
5053

51-
In general, you will use :class:`eegdash.api.EEGDashDataset` for most of your data loading needs.
54+
In general, you will use :class:`~eegdash.api.EEGDashDataset` for most of your data loading needs.
5255

5356
The EEGDashDataset Object
5457
-------------------------
5558

56-
The :class:`eegdash.api.EEGDashDataset` is the primary entry point for working with EEG recordings in :mod:`eegdash`. It acts as a high-level interface that allows you to query a metadata database and load corresponding EEG data, either from a remote source or from a local cache.
59+
The :class:`~eegdash.api.EEGDashDataset` is the primary entry point for working with EEG recordings in :mod:`eegdash`. It acts as a high-level interface that allows you to query a metadata database and load corresponding EEG data, either from a remote source or from a local cache.
5760

5861
Initializing EEGDashDataset
5962
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6063

61-
To get started, you need to create an instance of :class:`eegdash.api.EEGDashDataset`. The two most important parameters are ``cache_dir`` and ``dataset``.
64+
To get started, you need to create an instance of :class:`~eegdash.api.EEGDashDataset`. The two most important parameters are ``cache_dir`` and ``dataset``.
6265

6366
- ``cache_dir``: This is the local directory where ``eegdash`` will store downloaded data.
6467
- ``dataset``: The identifier of the dataset you want to work with (e.g., ``"ds002718"``).
@@ -82,7 +85,7 @@ This will create a dataset object containing all recordings from ``ds002718``. T
8285
Querying for Specific Data
8386
--------------------------
8487

85-
:class:`eegdash.api.EEGDashDataset` offers powerful filtering capabilities, allowing you to select a subset of recordings based on various criteria. You can filter by task, subject, session, or run.
88+
:class:`~eegdash.api.EEGDashDataset` offers powerful filtering capabilities, allowing you to select a subset of recordings based on various criteria. You can filter by task, subject, session, or run.
8689

8790
Filtering by Task
8891
~~~~~~~~~~~~~~~~~
@@ -164,11 +167,11 @@ For more complex queries, you can pass a MongoDB-style query dictionary directly
164167
Working with Local Data (Offline Mode)
165168
--------------------------------------
166169

167-
:mod:`eegdash` also supports working with local data that you have already downloaded or manage separately. By setting ``download=False``, you can instruct :class:`eegdash.api.EEGDashDataset` to use local BIDS-compliant data instead of accessing the database or remote storage.
170+
:mod:`eegdash` also supports working with local data that you have already downloaded or manage separately. By setting ``download=False``, you can instruct :class:`~eegdash.api.EEGDashDataset` to use local BIDS-compliant data instead of accessing the database or remote storage.
168171

169172
To use this feature, your data must be organized in a BIDS-like structure within your ``cache_dir``. For example, if your ``cache_dir`` is ``./eeg_data`` and your dataset is ``ds002718``, the files should be located at ``./eeg_data/ds002718/``.
170173

171-
Here is how to use :class:`eegdash.api.EEGDashDataset` in offline mode:
174+
Here is how to use :class:`~eegdash.api.EEGDashDataset` in offline mode:
172175

173176
.. code-block:: python
174177
@@ -186,7 +189,7 @@ When ``download=False``, :mod:`eegdash` will scan the specified directory for EE
186189
Accessing Data from the Dataset
187190
-------------------------------
188191

189-
Once you have your :class:`eegdash.api.EEGDashDataset` object, you can access individual recordings as if it were a list. Each item in the dataset is an ``EEGDashBaseDataset`` object, which contains the metadata and methods to load the actual EEG data.
192+
Once you have your :class:`~eegdash.api.EEGDashDataset` object, you can access individual recordings as if it were a list. Each item in the dataset is an :class:`~eegdash.data_utils.EEGDashBaseDataset` object, which contains the metadata and methods to load the actual EEG data.
190193

191194
.. code-block:: python
192195

examples/eeg2025/tutorial_challenge_2.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
# Contents of this start kit
5252
# --------------------------
5353
# .. note:: If you need additional explanations on the
54-
# :class:`eegdash.dataset.EEGChallengeDataset` class, dataloading,
54+
# :doc:`EEGChallengeDataset
55+
# </api/dataset/eegdash.dataset.EEGChallengeDataset>` class, dataloading,
5556
# `braindecode <https://braindecode.org/stable/models/models_table.html>`__'s
5657
# deep learning models, or brain decoding in general, please refer to the
5758
# start-kit of challenge 1 which delves deeper into these topics.
@@ -142,7 +143,7 @@
142143
# Define local path and (down)load the data
143144
# -----------------------------------------
144145
# In this challenge 2 example, we load the EEG 2025 release using
145-
# :class:`eegdash.dataset.EEGChallengeDataset`.
146+
# :doc:`EEGChallengeDataset </api/dataset/eegdash.dataset.EEGChallengeDataset>`.
146147
# **Note:** in this example notebook, we load the contrast change detection task from one mini release only as an example. Naturally, you are encouraged to train your models on all complete releases, using data from all the tasks you deem relevant.
147148

148149
######################################################################

examples/eeg2025/tutorial_eegdash_offline.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Many HPC clusters restrict or block network access. It's common to have
66
dedicated queues for internet-enabled jobs that differ from GPU queues.
77
This tutorial shows how to use :doc:`EEGChallengeDataset
8-
<api/dataset/eegdash.dataset.EEGChallengeDataset>` offline once a dataset is
8+
</api/dataset/eegdash.dataset.EEGChallengeDataset>` offline once a dataset is
99
present on disk.
1010
"""
1111

@@ -17,8 +17,8 @@
1717

1818

1919
# We'll use Release R2 as an example (HBN subset).
20-
# :class:`eegdash.dataset.EEGChallengeDataset` uses a suffixed cache folder for
21-
# the competition data (e.g., "-bdf-mini").
20+
# :doc:`EEGChallengeDataset </api/dataset/eegdash.dataset.EEGChallengeDataset>`
21+
# uses a suffixed cache folder for the competition data (e.g., "-bdf-mini").
2222
release = "R2"
2323
dataset_id = RELEASE_TO_OPENNEURO_DATASET_MAP[release]
2424
task = "RestingState"
@@ -54,7 +54,8 @@
5454
# ---------------------------
5555
# Once the data is cached locally, you can interact with it without needing an
5656
# internet connection. The key is to instantiate your dataset object with the
57-
# ``download=False`` flag. This tells :class:`eegdash.dataset.EEGChallengeDataset`
57+
# ``download=False`` flag. This tells :doc:`EEGChallengeDataset
58+
# </api/dataset/eegdash.dataset.EEGChallengeDataset>`
5859
# to look for data in the ``cache_dir`` instead of trying to connect to the
5960
# database or S3.
6061

@@ -80,9 +81,9 @@
8081
# ----------------------------------
8182
# Even without a database connection, you can still filter your dataset by
8283
# BIDS entities like subject, session, or task. When ``download=False``,
83-
# :class:`eegdash.dataset.EEGChallengeDataset` uses the BIDS directory structure
84-
# and filenames to apply these filters. This example shows how to load data for
85-
# a specific subject from the local cache.
84+
# :doc:`EEGChallengeDataset </api/dataset/eegdash.dataset.EEGChallengeDataset>`
85+
# uses the BIDS directory structure and filenames to apply these filters. This
86+
# example shows how to load data for a specific subject from the local cache.
8687

8788
ds_offline_sub = EEGChallengeDataset(
8889
cache_dir=cache_dir,

0 commit comments

Comments
 (0)