Skip to content

Commit 718cf49

Browse files
Merge branch 'main' into lite-wheel-build
2 parents 9aca5cc + c249d79 commit 718cf49

16 files changed

Lines changed: 194 additions & 17 deletions

File tree

doc/api/datasets.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Datasets
3030
hf_sef.data_path
3131
kiloword.data_path
3232
limo.load_data
33+
lite_data.data_path
3334
misc.data_path
3435
mtrf.data_path
3536
multimodal.data_path
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add the :func:`mne.datasets.lite_data.data_path` fetcher for the curated data subset used by the JupyterLite browser documentation, by `Natneal B`_.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Speed up the permutation cluster tests (e.g., :func:`mne.stats.spatio_temporal_cluster_1samp_test`), especially with TFCE, by grouping cluster indices with a single sort instead of one pass over the data per cluster, by :newcontrib:`Luca Kaemmer`.

doc/changes/names.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@
253253
.. _Lorenzo Alfine: https://github.com/lorrandal
254254
.. _Lorenzo Desantis: https://github.com/lorenzo-desantis/
255255
.. _Louis Thibault: https://github.com/lthibault
256+
.. _Luca Kaemmer: https://github.com/Lucakaemmer
256257
.. _Lukas Breuer: https://www.researchgate.net/profile/Lukas-Breuer-2
257258
.. _Lukas Gemein: https://github.com/gemeinl
258259
.. _Lukas Hecker: https://github.com/LukeTheHecker

doc/documentation/datasets.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,24 @@ the people in the scene were unrecognizable.
541541

542542
* :ref:`tut-eyetrack-heatmap`
543543

544+
.. _lite-data:
545+
546+
JupyterLite data
547+
================
548+
:func:`mne.datasets.lite_data.data_path`
549+
550+
A small curated archive holding the data files needed to run the tutorials and
551+
examples in the browser, taken from the ``sample``, ``kiloword``, ``erp_core``,
552+
``mtrf`` and ``eegbci`` datasets. The files are unchanged and keep the same
553+
checksums as the full datasets. It extracts to ``MNE-lite-data/``, keeping each
554+
file under its original dataset folder (``MNE-sample-data/``,
555+
``MNE-kiloword-data/``, ...).
556+
The ``somato`` dataset is not included, so the somatosensory tutorials and
557+
examples are not available in the browser.
558+
559+
This exists for the documentation build; for analysis, use the individual
560+
dataset fetchers above.
561+
544562
References
545563
==========
546564

mne/datasets/__init__.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ __all__ = [
1919
"hf_sef",
2020
"kiloword",
2121
"limo",
22+
"lite_data",
2223
"misc",
2324
"mtrf",
2425
"multimodal",
@@ -48,6 +49,7 @@ from . import (
4849
hf_sef,
4950
kiloword,
5051
limo,
52+
lite_data,
5153
misc,
5254
mtrf,
5355
multimodal,

mne/datasets/config.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,16 @@
209209
config_key="MNE_DATASETS_SAMPLE_PATH",
210210
)
211211

212+
# Curated subset of sample (plus a few files from kiloword/erp_core/mtrf/eegbci)
213+
# used by the JupyterLite browser docs; see mne/datasets/lite_data/.
214+
MNE_DATASETS["lite_data"] = dict(
215+
archive_name="MNE-lite-data.tar.gz",
216+
hash="md5:5f9c4fffed32e79bc2bc2061bf22ce99",
217+
url="https://osf.io/download/a8qbx",
218+
folder_name="MNE-lite-data",
219+
config_key="MNE_DATASETS_LITE_DATA_PATH",
220+
)
221+
212222
MNE_DATASETS["somato"] = dict(
213223
archive_name="MNE-somato-data.tar.gz",
214224
hash="md5:9a191907b326b9402341ee7a0d1240d8",

mne/datasets/lite_data/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Authors: The MNE-Python contributors.
2+
# License: BSD-3-Clause
3+
# Copyright the MNE-Python contributors.
4+
5+
"""Curated data subset for the JupyterLite browser documentation."""
6+
7+
from .lite_data import data_path, get_version
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Authors: The MNE-Python contributors.
2+
# License: BSD-3-Clause
3+
# Copyright the MNE-Python contributors.
4+
5+
"""Curated data subset used by the JupyterLite browser documentation.
6+
7+
``lite_data`` holds the data files needed to run the tutorials and examples in
8+
the browser, taken from ``sample``, ``kiloword``, ``erp_core``, ``mtrf`` and
9+
``eegbci``. The files are unchanged and keep the same checksums as the full
10+
datasets. It extracts to ``MNE-lite-data/`` with each file under its original
11+
dataset folder (``MNE-sample-data/``, ``MNE-kiloword-data/``, ...), so paths
12+
match.
13+
The ``somato`` dataset is not included, so the somatosensory tutorials and
14+
examples do not run in the browser.
15+
"""
16+
17+
from ...utils import verbose
18+
from ..utils import _data_path_doc, _download_mne_dataset, _get_version, _version_doc
19+
20+
21+
@verbose
22+
def data_path(
23+
path=None, force_update=False, update_path=True, download=True, *, verbose=None
24+
): # noqa: D103
25+
return _download_mne_dataset(
26+
name="lite_data",
27+
processor="untar",
28+
path=path,
29+
force_update=force_update,
30+
update_path=update_path,
31+
download=download,
32+
)
33+
34+
35+
data_path.__doc__ = _data_path_doc.format(
36+
name="lite_data", conf="MNE_DATASETS_LITE_DATA_PATH"
37+
)
38+
39+
40+
def get_version(): # noqa: D103
41+
return _get_version("lite_data")
42+
43+
44+
get_version.__doc__ = _version_doc.format(name="lite_data")

mne/datasets/tests/test_datasets.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,3 +322,18 @@ def test_fetch_uncompressed_file(tmp_path):
322322
)
323323
fetch_dataset(dataset_dict, path=None, force_update=True)
324324
assert (tmp_path / "foo" / "LICENSE.foo").is_file()
325+
326+
327+
def test_lite_data():
328+
"""Test the lite_data curated dataset is registered correctly."""
329+
from mne.datasets import lite_data
330+
from mne.datasets.config import MNE_DATASETS
331+
332+
assert "lite_data" in MNE_DATASETS
333+
cfg = MNE_DATASETS["lite_data"]
334+
assert cfg["archive_name"] == "MNE-lite-data.tar.gz"
335+
assert cfg["hash"].startswith("md5:")
336+
assert cfg["url"].startswith("https://osf.io/")
337+
assert cfg["config_key"] == "MNE_DATASETS_LITE_DATA_PATH"
338+
assert callable(lite_data.data_path)
339+
assert callable(lite_data.get_version)

0 commit comments

Comments
 (0)