eegdash 0.3.9.dev170082126__py3-none-any.whl → 0.4.0.dev132__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.
- eegdash/__init__.py +1 -1
- eegdash/api.py +68 -145
- eegdash/bids_eeg_metadata.py +149 -27
- eegdash/data_utils.py +63 -254
- eegdash/dataset/dataset.py +27 -21
- eegdash/downloader.py +176 -0
- eegdash/features/datasets.py +4 -3
- eegdash/hbn/preprocessing.py +1 -3
- eegdash/hbn/windows.py +0 -2
- eegdash/logging.py +23 -0
- {eegdash-0.3.9.dev170082126.dist-info → eegdash-0.4.0.dev132.dist-info}/METADATA +5 -56
- {eegdash-0.3.9.dev170082126.dist-info → eegdash-0.4.0.dev132.dist-info}/RECORD +15 -13
- {eegdash-0.3.9.dev170082126.dist-info → eegdash-0.4.0.dev132.dist-info}/WHEEL +0 -0
- {eegdash-0.3.9.dev170082126.dist-info → eegdash-0.4.0.dev132.dist-info}/licenses/LICENSE +0 -0
- {eegdash-0.3.9.dev170082126.dist-info → eegdash-0.4.0.dev132.dist-info}/top_level.txt +0 -0
eegdash/features/datasets.py
CHANGED
|
@@ -3,7 +3,6 @@ from __future__ import annotations
|
|
|
3
3
|
import json
|
|
4
4
|
import os
|
|
5
5
|
import shutil
|
|
6
|
-
import warnings
|
|
7
6
|
from collections.abc import Callable
|
|
8
7
|
from typing import Dict, List
|
|
9
8
|
|
|
@@ -17,6 +16,8 @@ from braindecode.datasets.base import (
|
|
|
17
16
|
_create_description,
|
|
18
17
|
)
|
|
19
18
|
|
|
19
|
+
from ..logging import logger
|
|
20
|
+
|
|
20
21
|
|
|
21
22
|
class FeaturesDataset(EEGWindowsDataset):
|
|
22
23
|
"""Returns samples from a pandas DataFrame object along with a target.
|
|
@@ -283,7 +284,7 @@ class FeaturesConcatDataset(BaseConcatDataset):
|
|
|
283
284
|
# the following will be True for all datasets preprocessed and
|
|
284
285
|
# stored in parallel with braindecode.preprocessing.preprocess
|
|
285
286
|
if i_ds + 1 + offset < n_sub_dirs:
|
|
286
|
-
|
|
287
|
+
logger.warning(
|
|
287
288
|
f"The number of saved datasets ({i_ds + 1 + offset}) "
|
|
288
289
|
f"does not match the number of existing "
|
|
289
290
|
f"subdirectories ({n_sub_dirs}). You may now "
|
|
@@ -294,7 +295,7 @@ class FeaturesConcatDataset(BaseConcatDataset):
|
|
|
294
295
|
# if path contains files or directories that were not touched, raise
|
|
295
296
|
# warning
|
|
296
297
|
if path_contents:
|
|
297
|
-
|
|
298
|
+
logger.warning(
|
|
298
299
|
f"Chosen directory {path} contains other "
|
|
299
300
|
f"subdirectories or files {path_contents}."
|
|
300
301
|
)
|
eegdash/hbn/preprocessing.py
CHANGED
eegdash/hbn/windows.py
CHANGED
|
@@ -7,8 +7,6 @@ from mne_bids import get_bids_path_from_fname
|
|
|
7
7
|
|
|
8
8
|
from braindecode.datasets.base import BaseConcatDataset
|
|
9
9
|
|
|
10
|
-
logger = logging.getLogger("eegdash")
|
|
11
|
-
|
|
12
10
|
|
|
13
11
|
def build_trial_table(events_df: pd.DataFrame) -> pd.DataFrame:
|
|
14
12
|
"""One row per contrast trial with stimulus/response metrics."""
|
eegdash/logging.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
from rich.logging import RichHandler
|
|
4
|
+
|
|
5
|
+
# Get the root logger
|
|
6
|
+
root_logger = logging.getLogger()
|
|
7
|
+
|
|
8
|
+
# --- This is the key part ---
|
|
9
|
+
# 1. Remove any handlers that may have been added by default
|
|
10
|
+
root_logger.handlers = []
|
|
11
|
+
|
|
12
|
+
# 2. Add your RichHandler
|
|
13
|
+
root_logger.addHandler(RichHandler(rich_tracebacks=True, markup=True))
|
|
14
|
+
# ---------------------------
|
|
15
|
+
|
|
16
|
+
# 3. Set the level for the root logger
|
|
17
|
+
root_logger.setLevel(logging.INFO)
|
|
18
|
+
|
|
19
|
+
# Now, get your package-specific logger. It will inherit the
|
|
20
|
+
# configuration from the root logger we just set up.
|
|
21
|
+
logger = logging.getLogger("eegdash")
|
|
22
|
+
|
|
23
|
+
logger.setLevel(logging.INFO)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: eegdash
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0.dev132
|
|
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
|
|
@@ -25,7 +25,7 @@ Requires-Python: >=3.10
|
|
|
25
25
|
Description-Content-Type: text/markdown
|
|
26
26
|
License-File: LICENSE
|
|
27
27
|
Requires-Dist: braindecode>=1.0
|
|
28
|
-
Requires-Dist: mne_bids>=0.
|
|
28
|
+
Requires-Dist: mne_bids>=0.17.0
|
|
29
29
|
Requires-Dist: numba
|
|
30
30
|
Requires-Dist: numpy
|
|
31
31
|
Requires-Dist: pandas
|
|
@@ -41,6 +41,7 @@ Requires-Dist: pymatreader
|
|
|
41
41
|
Requires-Dist: eeglabio
|
|
42
42
|
Requires-Dist: tabulate
|
|
43
43
|
Requires-Dist: docstring_inheritance
|
|
44
|
+
Requires-Dist: rich
|
|
44
45
|
Provides-Extra: tests
|
|
45
46
|
Requires-Dist: pytest; extra == "tests"
|
|
46
47
|
Requires-Dist: pytest-cov; extra == "tests"
|
|
@@ -86,22 +87,6 @@ To leverage recent and ongoing advancements in large-scale computational methods
|
|
|
86
87
|
|
|
87
88
|
The data in EEG-DaSh originates from a collaboration involving 25 laboratories, encompassing 27,053 participants. This extensive collection includes MEEG data, which is a combination of EEG and MEG signals. The data is sourced from various studies conducted by these labs, involving both healthy subjects and clinical populations with conditions such as ADHD, depression, schizophrenia, dementia, autism, and psychosis. Additionally, data spans different mental states like sleep, meditation, and cognitive tasks. In addition, EEG-DaSh will incorporate a subset of the data converted from NEMAR, which includes 330 MEEG BIDS-formatted datasets, further expanding the archive with well-curated, standardized neuroelectromagnetic data.
|
|
88
89
|
|
|
89
|
-
## Featured data
|
|
90
|
-
|
|
91
|
-
The following HBN datasets are currently featured on EEGDash. Documentation about these datasets is available [here](https://neuromechanist.github.io/data/hbn/).
|
|
92
|
-
|
|
93
|
-
| DatasetID | Participants | Files | Sessions | Population | Channels | Is 10-20? | Modality | Size |
|
|
94
|
-
|---|---|---|---|---|---|---|---|---|
|
|
95
|
-
| [ds005505](https://nemar.org/dataexplorer/detail?dataset_id=ds005505) | 136 | 5393 | 1 | Healthy | 129 | other | Visual | 103 GB |
|
|
96
|
-
| [ds005506](https://nemar.org/dataexplorer/detail?dataset_id=ds005506) | 150 | 5645 | 1 | Healthy | 129 | other | Visual | 112 GB |
|
|
97
|
-
| [ds005507](https://nemar.org/dataexplorer/detail?dataset_id=ds005507) | 184 | 7273 | 1 | Healthy | 129 | other | Visual | 140 GB |
|
|
98
|
-
| [ds005508](https://nemar.org/dataexplorer/detail?dataset_id=ds005508) | 324 | 13393 | 1 | Healthy | 129 | other | Visual | 230 GB |
|
|
99
|
-
| [ds005510](https://nemar.org/dataexplorer/detail?dataset_id=ds005510) | 135 | 4933 | 1 | Healthy | 129 | other | Visual | 91 GB |
|
|
100
|
-
| [ds005512](https://nemar.org/dataexplorer/detail?dataset_id=ds005512) | 257 | 9305 | 1 | Healthy | 129 | other | Visual | 157 GB |
|
|
101
|
-
| [ds005514](https://nemar.org/dataexplorer/detail?dataset_id=ds005514) | 295 | 11565 | 1 | Healthy | 129 | other | Visual | 185 GB |
|
|
102
|
-
|
|
103
|
-
A total of [246 other datasets](datasets.md) are also available through EEGDash.
|
|
104
|
-
|
|
105
90
|
## Data format
|
|
106
91
|
|
|
107
92
|
EEGDash queries return a **Pytorch Dataset** formatted to facilitate machine learning (ML) and deep learning (DL) applications. PyTorch Datasets are the best format for EEGDash queries because they provide an efficient, scalable, and flexible structure for machine learning (ML) and deep learning (DL) applications. They allow seamless integration with PyTorch’s DataLoader, enabling efficient batching, shuffling, and parallel data loading, which is essential for training deep learning models on large EEG datasets.
|
|
@@ -113,47 +98,11 @@ EEGDash datasets are processed using the popular [braindecode](https://braindeco
|
|
|
113
98
|
## EEG-Dash usage
|
|
114
99
|
|
|
115
100
|
### Install
|
|
116
|
-
Use your preferred Python environment manager with Python > 3.
|
|
101
|
+
Use your preferred Python environment manager with Python > 3.10 to install the package.
|
|
117
102
|
* To install the eegdash package, use the following command: `pip install eegdash`
|
|
118
103
|
* To verify the installation, start a Python session and type: `from eegdash import EEGDash`
|
|
119
104
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
To use the data from a single subject, enter:
|
|
123
|
-
|
|
124
|
-
```python
|
|
125
|
-
from eegdash import EEGDashDataset
|
|
126
|
-
|
|
127
|
-
ds_NDARDB033FW5 = EEGDashDataset(
|
|
128
|
-
{"dataset": "ds005514", "task":
|
|
129
|
-
"RestingState", "subject": "NDARDB033FW5"},
|
|
130
|
-
cache_dir="."
|
|
131
|
-
)
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
This will search and download the metadata for the task **RestingState** for subject **NDARDB033FW5** in BIDS dataset **ds005514**. The actual data will not be downloaded at this stage. Following standard practice, data is only downloaded once it is processed. The **ds_NDARDB033FW5** object is a fully functional braindecode dataset, which is itself a PyTorch dataset. This [tutorial](https://github.com/sccn/EEGDash/blob/develop/notebooks/tutorial_eoec.ipynb) shows how to preprocess the EEG data, extracting portions of the data containing eyes-open and eyes-closed segments, then perform eyes-open vs. eyes-closed classification using a (shallow) deep-learning model.
|
|
135
|
-
|
|
136
|
-
To use the data from multiple subjects, enter:
|
|
137
|
-
|
|
138
|
-
```python
|
|
139
|
-
from eegdash import EEGDashDataset
|
|
140
|
-
|
|
141
|
-
ds_ds005505rest = EEGDashDataset(
|
|
142
|
-
{"dataset": "ds005505", "task": "RestingState"}, target_name="sex", cache_dir=".
|
|
143
|
-
)
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
This will search and download the metadata for the task 'RestingState' for all subjects in BIDS dataset 'ds005505' (a total of 136). As above, the actual data will not be downloaded at this stage so this command is quick to execute. Also, the target class for each subject is assigned using the target_name parameter. This means that this object is ready to be directly fed to a deep learning model, although the [tutorial script](https://github.com/sccn/EEGDash/blob/develop/notebooks/tutorial_sex_classification.ipynb) performs minimal processing on it, prior to training a deep-learning model. Because 14 gigabytes of data are downloaded, this tutorial takes about 10 minutes to execute.
|
|
147
|
-
|
|
148
|
-
### Automatic caching
|
|
149
|
-
|
|
150
|
-
By default, EEGDash caches downloaded data under a single, consistent folder:
|
|
151
|
-
|
|
152
|
-
- If ``EEGDASH_CACHE_DIR`` is set in your environment, that path is used.
|
|
153
|
-
- Else, if MNE’s ``MNE_DATA`` config is set, that path is used to align with other EEG tooling.
|
|
154
|
-
- Otherwise, ``.eegdash_cache`` in the current working directory is used.
|
|
155
|
-
|
|
156
|
-
This means that if you run the tutorial [scripts](https://github.com/sccn/EEGDash/tree/develop/notebooks), the data will only be downloaded the first time the script is executed and reused thereafter.
|
|
105
|
+
Please check our tutorial webpages to explore what you can do with [eegdash](https://eegdash.org/)!
|
|
157
106
|
|
|
158
107
|
## Education -- Coming soon...
|
|
159
108
|
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
eegdash/__init__.py,sha256=
|
|
2
|
-
eegdash/api.py,sha256=
|
|
3
|
-
eegdash/bids_eeg_metadata.py,sha256=
|
|
1
|
+
eegdash/__init__.py,sha256=X0mp26TKeJDAerze3q3hnCgN6V9Sokwwvj_eDdjswaE,284
|
|
2
|
+
eegdash/api.py,sha256=0YNbL1u-Wh51r-dRU2ijUmfOTIharr3OFGgLOxEznX0,37813
|
|
3
|
+
eegdash/bids_eeg_metadata.py,sha256=XUkQp2M8zQ_wH5JC8lQiVR0TWssOjSdrdEWkgwGjiZ8,13699
|
|
4
4
|
eegdash/const.py,sha256=qdFBEL9kIrsj9CdxbXhBkR61R3CrTGSaj5Iq0YOACIs,7313
|
|
5
|
-
eegdash/data_utils.py,sha256=
|
|
5
|
+
eegdash/data_utils.py,sha256=dePEXcJefo3gmD534bb576p8v9jErDNLDHQoDGHqH-g,26006
|
|
6
|
+
eegdash/downloader.py,sha256=B-8u0c39F4inV-v_WgYZrUKAGPQOdfqC2RX1qNrRQYM,5808
|
|
7
|
+
eegdash/logging.py,sha256=SZdB7WLT5b2okecWpvLx4UWUxg3DiA11Z5d9lhYdDyc,616
|
|
6
8
|
eegdash/mongodb.py,sha256=GD3WgA253oFgpzOHrYaj4P1mRjNtDMT5Oj4kVvHswjI,2006
|
|
7
9
|
eegdash/paths.py,sha256=246xkectTxDAYcREs1Qma_F1Y-oSmLlb0hn0F2Za5Ss,866
|
|
8
10
|
eegdash/utils.py,sha256=7TfQ9D0LrAJ7FgnSXEvWgeHWK2QqaqS-_WcWXD86ObQ,408
|
|
9
11
|
eegdash/dataset/__init__.py,sha256=Qmzki5G8GaFlzTb10e4SmC3WkKuJyo1Ckii15tCEHAo,157
|
|
10
|
-
eegdash/dataset/dataset.py,sha256=
|
|
12
|
+
eegdash/dataset/dataset.py,sha256=e_rliu4E-uPtz_miUSzGukUahCHHhyXB2Gu3pm3cyHo,7062
|
|
11
13
|
eegdash/dataset/dataset_summary.csv,sha256=XF0vdHz77DFyVLTaET8lL5gQQ4r-q1xAfSDWH5GTPLA,23655
|
|
12
14
|
eegdash/dataset/registry.py,sha256=genOqAuf9cQBnHhPqRwfLP7S1XsnkLot6sLyJozPtf4,4150
|
|
13
15
|
eegdash/features/__init__.py,sha256=BXNhjvL4_SSFAY1lcP9nyGpkbJNtoOMH4AHlF6OyABo,4078
|
|
14
|
-
eegdash/features/datasets.py,sha256=
|
|
16
|
+
eegdash/features/datasets.py,sha256=eV4d86EU4fu1yoIMdPQnot6YZDRGG4qE9h77lk7iVhU,18317
|
|
15
17
|
eegdash/features/decorators.py,sha256=v0qaJz_dcX703p1fvFYbAIXmwK3d8naYGlq7fRVKn_w,1313
|
|
16
18
|
eegdash/features/extractors.py,sha256=H7h6tP3dKoRcjDJpWWAo0ppmokCq5QlhqMcehYwYV9s,6845
|
|
17
19
|
eegdash/features/inspect.py,sha256=PmbWhx5H_WqpnorUpWONUSkUtaIHkZblRa_Xyk7Szyc,1569
|
|
@@ -26,10 +28,10 @@ eegdash/features/feature_bank/signal.py,sha256=3Tb8z9gX7iZipxQJ9DSyy30JfdmW58kgv
|
|
|
26
28
|
eegdash/features/feature_bank/spectral.py,sha256=bNB7skusePs1gX7NOU6yRlw_Gr4UOCkO_ylkCgybzug,3319
|
|
27
29
|
eegdash/features/feature_bank/utils.py,sha256=DGh-Q7-XFIittP7iBBxvsJaZrlVvuY5mw-G7q6C-PCI,1237
|
|
28
30
|
eegdash/hbn/__init__.py,sha256=U8mK64napnKU746C5DOwkX7W7sg3iW5kb_cVv2pfFq0,394
|
|
29
|
-
eegdash/hbn/preprocessing.py,sha256=
|
|
30
|
-
eegdash/hbn/windows.py,sha256=
|
|
31
|
-
eegdash-0.
|
|
32
|
-
eegdash-0.
|
|
33
|
-
eegdash-0.
|
|
34
|
-
eegdash-0.
|
|
35
|
-
eegdash-0.
|
|
31
|
+
eegdash/hbn/preprocessing.py,sha256=zMkDFXQxWLn-Iy0cHRk-JL5c479HpclgIAGm-xuKPFg,2196
|
|
32
|
+
eegdash/hbn/windows.py,sha256=Obv4L2hP8ACancUawkMYbiusfvhAw-mG_vqyDDMwOJ8,9890
|
|
33
|
+
eegdash-0.4.0.dev132.dist-info/licenses/LICENSE,sha256=asisR-xupy_NrQBFXnx6yqXeZcYWLvbAaiETl25iXT0,931
|
|
34
|
+
eegdash-0.4.0.dev132.dist-info/METADATA,sha256=2_hkPms-a1bnPet5DKAXRy4vO33LLtnQYgea7EMwFUk,6735
|
|
35
|
+
eegdash-0.4.0.dev132.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
36
|
+
eegdash-0.4.0.dev132.dist-info/top_level.txt,sha256=zavO69HQ6MyZM0aQMR2zUS6TAFc7bnN5GEpDpOpFZzU,8
|
|
37
|
+
eegdash-0.4.0.dev132.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|