Skip to content

Commit b0e0975

Browse files
stage 1
1 parent c3cdac8 commit b0e0975

File tree

5 files changed

+41
-23
lines changed

5 files changed

+41
-23
lines changed

docs/source/conf.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,14 @@ def linkcode_resolve(domain, info):
293293
registered dynamically from mongo database. The table below summarises
294294
the distribution by experimental type as tracked in the summary file.
295295
296+
Base Dataset API
297+
----------------
298+
299+
.. toctree::
300+
:maxdepth: 1
301+
302+
eegdash.dataset.EEGChallengeDataset
303+
296304
.. list-table:: Dataset counts by experimental type
297305
:widths: 60 20
298306
:header-rows: 1

examples/core/tutorial_eoec.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
66
EEGDash example for eyes open vs. closed classification.
77
8-
The code below provides an example of using the *EEGDash* library in combination with PyTorch to develop a deep learning model for analyzing EEG data, specifically for eyes open vs. closed classification in a single subject.
8+
This example uses the :mod:`eegdash` library in combination with PyTorch to develop a deep learning model for analyzing EEG data, specifically for eyes open vs. closed classification in a single subject.
99
10-
1. **Data Retrieval Using EEGDash**: An instance of *EEGDashDataset* is created to search and retrieve an EEG dataset. At this step, only the metadata is transferred.
10+
1. **Data Retrieval Using EEGDash**: An instance of :class:`eegdash.api.EEGDashDataset` is created to search and retrieve an EEG dataset. At this step, only the metadata is transferred.
1111
1212
2. **Data Preprocessing Using BrainDecode**: This process preprocesses EEG data using Braindecode by reannotating events, selecting specific channels, resampling, filtering, and extracting 2-second epochs, ensuring balanced eyes-open and eyes-closed data for analysis.
1313
@@ -22,6 +22,9 @@
2222
# Data Retrieval Using EEGDash
2323
# ----------------------------
2424
#
25+
# This section instantiates :class:`eegdash.api.EEGDashDataset` to fetch
26+
# the metadata for the experiment before requesting any recordings.
27+
#
2528
# First we find one resting state dataset. This dataset contains both eyes open
2629
# and eyes closed data.
2730
from pathlib import Path
@@ -39,7 +42,7 @@
3942
# Data Preprocessing Using Braindecode
4043
# ------------------------------------
4144
#
42-
# [BrainDecode](https://braindecode.org/stable/install/install.html) is a
45+
# `braindecode <https://braindecode.org/stable/install/install.html>`__ is a
4346
# specialized library for preprocessing EEG and MEG data. In this dataset, there
4447
# are two key events in the continuous data: **instructed_toCloseEyes**, marking
4548
# the start of a 40-second eyes-closed period, and **instructed_toOpenEyes**,
@@ -49,10 +52,10 @@
4952
# after the event onset. Similarly, for the eyes-open event, we extract data
5053
# from 5 to 19 seconds after the event onset. This ensures an equal amount of
5154
# data for both conditions. The event extraction is handled by the custom
52-
# function **hbn_ec_ec_reannotation**.
55+
# function :func:`eegdash.hbn.preprocessing.hbn_ec_ec_reannotation`.
5356
#
5457
# Next, we apply four preprocessing steps in Braindecode:
55-
# 1. **Reannotation** of event markers using `hbn_ec_ec_reannotation()`.
58+
# 1. **Reannotation** of event markers using :func:`eegdash.hbn.preprocessing.hbn_ec_ec_reannotation`.
5659
# 2. **Selection** of 24 specific EEG channels from the original 128.
5760
# 3. **Resampling** the EEG data to a frequency of 128 Hz.
5861
# 4. **Filtering** the EEG signals to retain frequencies between 1 Hz and 55 Hz.

examples/core/tutorial_feature_extractor_open_close_eye.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
66
EEGDash example for eyes open vs. closed classification.
77
8-
The code below provides an example of using the *EEGDash* library in combination with PyTorch to develop a deep learning model for analyzing EEG data, specifically for eyes open vs. closed classification in a single subject.
8+
This example uses the :mod:`eegdash` library in combination with PyTorch to develop a deep learning model for analyzing EEG data, specifically for eyes open vs. closed classification in a single subject.
99
10-
1. **Data Retrieval Using EEGDash**: An instance of *EEGDashDataset* is created to search and retrieve an EEG dataset. At this step, only the metadata is transferred.
10+
1. **Data Retrieval Using EEGDash**: An instance of :class:`eegdash.api.EEGDashDataset` is created to search and retrieve an EEG dataset. At this step, only the metadata is transferred.
1111
1212
2. **Data Preprocessing Using BrainDecode**: This process preprocesses EEG data using Braindecode by reannotating events, selecting specific channels, resampling, filtering, and extracting 2-second epochs, ensuring balanced eyes-open and eyes-closed data for analysis.
1313
@@ -23,6 +23,9 @@
2323
# Data Retrieval Using EEGDash
2424
# ----------------------------
2525
#
26+
# We instantiate :class:`eegdash.api.EEGDashDataset` to pull the experiment
27+
# metadata and build the dataset definition.
28+
#
2629
# First we find one resting state dataset. This dataset contains both eyes open
2730
# and eyes closed data.
2831

@@ -55,10 +58,10 @@
5558
# after the event onset. Similarly, for the eyes-open event, we extract data
5659
# from 5 to 19 seconds after the event onset. This ensures an equal amount of
5760
# data for both conditions. The event extraction is handled by the custom
58-
# function **hbn_ec_ec_reannotation**.
61+
# function :func:`eegdash.hbn.preprocessing.hbn_ec_ec_reannotation`.
5962
#
6063
# Next, we apply four preprocessing steps in Braindecode:
61-
# 1. **Reannotation** of event markers using `hbn_ec_ec_reannotation()`.
64+
# 1. **Reannotation** of event markers using :func:`eegdash.hbn.preprocessing.hbn_ec_ec_reannotation`.
6265
# 2. **Selection** of 24 specific EEG channels from the original 128.
6366
# 3. **Resampling** the EEG data to a frequency of 128 Hz.
6467
# 4. **Filtering** the EEG signals to retain frequencies between 1 Hz and 55 Hz.

examples/eeg2025/tutorial_challenge_2.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,13 @@
5151
# Contents of this start kit
5252
# --------------------------
5353
# .. note:: If you need additional explanations on the
54-
# `EEGChallengeDataset <https://eeglab.org/EEGDash/api/eegdash.html#eegdash.EEGChallengeDataset>`__
55-
# class, dataloading, `braindecode <https://braindecode.org/stable/models/models_table.html>`__'s
54+
# :class:`eegdash.dataset.EEGChallengeDataset` class, dataloading,
55+
# `braindecode <https://braindecode.org/stable/models/models_table.html>`__'s
5656
# deep learning models, or brain decoding in general, please refer to the
5757
# start-kit of challenge 1 which delves deeper into these topics.
5858
#
5959
# More contents will be released during the competition inside the
60-
# `eegdash <https://eeglab.org/EEGDash/overview.html>`__
61-
# `examples webpage <https://eeglab.org/EEGDash/generated/auto_examples/index.html>`__.
60+
# :mod:`eegdash` `examples webpage <https://eeglab.org/EEGDash/generated/auto_examples/index.html>`__.
6261
#
6362
# .. admonition:: Prerequisites
6463
# :class: important
@@ -142,7 +141,8 @@
142141
######################################################################
143142
# Define local path and (down)load the data
144143
# -----------------------------------------
145-
# In this challenge 2 example, we load the EEG 2025 release using EEG Dash.
144+
# In this challenge 2 example, we load the EEG 2025 release using
145+
# :class:`eegdash.dataset.EEGChallengeDataset`.
146146
# **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.
147147

148148
######################################################################

examples/eeg2025/tutorial_eegdash_offline.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
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.
7-
This tutorial shows how to use EEGDash offline once a dataset is present
8-
on disk.
7+
This tutorial shows how to use :doc:`EEGChallengeDataset
8+
<api/dataset/eegdash.dataset.EEGChallengeDataset>` offline once a dataset is
9+
present on disk.
910
"""
1011

1112
from pathlib import Path
@@ -15,8 +16,9 @@
1516
from eegdash.dataset.dataset import EEGChallengeDataset
1617

1718

18-
# We'll use Release R2 as an example (HBN subset). EEGChallengeDataset uses a
19-
# suffixed cache folder for the competition data (e.g., "-bdf-mini").
19+
# 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").
2022
release = "R2"
2123
dataset_id = RELEASE_TO_OPENNEURO_DATASET_MAP[release]
2224
task = "RestingState"
@@ -52,8 +54,9 @@
5254
# ---------------------------
5355
# Once the data is cached locally, you can interact with it without needing an
5456
# internet connection. The key is to instantiate your dataset object with the
55-
# ``download=False`` flag. This tells EEGDash to look for data in the
56-
# ``cache_dir`` instead of trying to connect to the database or S3.
57+
# ``download=False`` flag. This tells :class:`eegdash.dataset.EEGChallengeDataset`
58+
# to look for data in the ``cache_dir`` instead of trying to connect to the
59+
# database or S3.
5760

5861

5962
# Here we check that the local cache folder exists
@@ -76,9 +79,10 @@
7679
# Step 3: Filtering Entities Offline
7780
# ----------------------------------
7881
# Even without a database connection, you can still filter your dataset by
79-
# BIDS entities like subject, session, or task. When ``download=False``, EEGDash
80-
# uses the BIDS directory structure and filenames to apply these filters. This
81-
# example shows how to load data for a specific subject from the local cache.
82+
# 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.
8286

8387
ds_offline_sub = EEGChallengeDataset(
8488
cache_dir=cache_dir,

0 commit comments

Comments
 (0)