Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/api/datasets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Datasets
hf_sef.data_path
kiloword.data_path
limo.load_data
lite_data.data_path
misc.data_path
mtrf.data_path
multimodal.data_path
Expand Down
1 change: 1 addition & 0 deletions doc/changes/dev/14128.newfeature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add the :func:`mne.datasets.lite_data.data_path` fetcher for the curated data subset used by the browser documentation, by `Natneal B`_.
23 changes: 23 additions & 0 deletions doc/documentation/datasets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,29 @@ the people in the scene were unrecognizable.

* :ref:`tut-eyetrack-heatmap`

.. _lite-data:

JupyterLite data
================
:func:`mne.datasets.lite_data.data_path`

A small curated archive holding the data files needed to run the tutorials and
examples in the browser, taken from the ``sample``, ``kiloword``, ``erp_core``,
``mtrf`` and ``eegbci`` datasets. The files are unchanged and keep the same
checksums as the full datasets. It extracts to ``MNE-lite-data/``, keeping each
file under its original dataset folder (``MNE-sample-data/``,
``MNE-kiloword-data/``, ...).

Those datasets ship as separate multi-GB archives, so without this the
documentation build would download several gigabytes to serve a handful of
files.

The ``somato`` dataset is not included, so the somatosensory tutorials and
examples are not available in the browser.

This exists for the documentation build; for analysis, use the individual
dataset fetchers above.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add a note that it currently does not support the somatosensory examples

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Both the dataset docs and the docstring now say somato is not included, so those examples are not available in the browser.

References
==========

Expand Down
2 changes: 2 additions & 0 deletions mne/datasets/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ __all__ = [
"hf_sef",
"kiloword",
"limo",
"lite_data",
"misc",
"mtrf",
"multimodal",
Expand Down Expand Up @@ -48,6 +49,7 @@ from . import (
hf_sef,
kiloword,
limo,
lite_data,
misc,
mtrf,
multimodal,
Expand Down
10 changes: 10 additions & 0 deletions mne/datasets/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,16 @@
config_key="MNE_DATASETS_SAMPLE_PATH",
)

# Curated subset of sample (plus a few files from kiloword/erp_core/mtrf/eegbci)
# used by the JupyterLite browser docs; see mne/datasets/lite_data/.
MNE_DATASETS["lite_data"] = dict(
archive_name="MNE-lite-data.tar.gz",
hash="md5:5f9c4fffed32e79bc2bc2061bf22ce99",
url="https://osf.io/download/a8qbx",
folder_name="MNE-lite-data",
config_key="MNE_DATASETS_LITE_DATA_PATH",
)

MNE_DATASETS["somato"] = dict(
archive_name="MNE-somato-data.tar.gz",
hash="md5:9a191907b326b9402341ee7a0d1240d8",
Expand Down
7 changes: 7 additions & 0 deletions mne/datasets/lite_data/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Authors: The MNE-Python contributors.
# License: BSD-3-Clause
# Copyright the MNE-Python contributors.

"""Curated data subset for the JupyterLite browser documentation."""

from .lite_data import data_path, get_version
49 changes: 49 additions & 0 deletions mne/datasets/lite_data/lite_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Authors: The MNE-Python contributors.
# License: BSD-3-Clause
# Copyright the MNE-Python contributors.

"""Curated data subset used by the JupyterLite browser documentation.

``lite_data`` holds the data files needed to run the tutorials and examples in
the browser, taken from ``sample``, ``kiloword``, ``erp_core``, ``mtrf`` and
``eegbci``. The files are unchanged and keep the same checksums as the full
datasets. It extracts to ``MNE-lite-data/`` with each file under its original
dataset folder (``MNE-sample-data/``, ``MNE-kiloword-data/``, ...), so paths
match.

Those datasets ship as separate multi-GB archives, so without this the
documentation build would download several gigabytes to serve a handful of
files.

The ``somato`` dataset is not included, so the somatosensory tutorials and
examples do not run in the browser.
"""

from ...utils import verbose
from ..utils import _data_path_doc, _download_mne_dataset, _get_version, _version_doc


@verbose
def data_path(
path=None, force_update=False, update_path=True, download=True, *, verbose=None
): # noqa: D103
return _download_mne_dataset(
name="lite_data",
processor="untar",
path=path,
force_update=force_update,
update_path=update_path,
download=download,
)


data_path.__doc__ = _data_path_doc.format(
name="lite_data", conf="MNE_DATASETS_LITE_DATA_PATH"
)


def get_version(): # noqa: D103
return _get_version("lite_data")


get_version.__doc__ = _version_doc.format(name="lite_data")
15 changes: 15 additions & 0 deletions mne/datasets/tests/test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,18 @@ def test_fetch_uncompressed_file(tmp_path):
)
fetch_dataset(dataset_dict, path=None, force_update=True)
assert (tmp_path / "foo" / "LICENSE.foo").is_file()


def test_lite_data():
"""Test the lite_data curated dataset is registered correctly."""
from mne.datasets import lite_data
from mne.datasets.config import MNE_DATASETS

assert "lite_data" in MNE_DATASETS
cfg = MNE_DATASETS["lite_data"]
assert cfg["archive_name"] == "MNE-lite-data.tar.gz"
assert cfg["hash"].startswith("md5:")
assert cfg["url"].startswith("https://osf.io/")
assert cfg["config_key"] == "MNE_DATASETS_LITE_DATA_PATH"
assert callable(lite_data.data_path)
assert callable(lite_data.get_version)
1 change: 1 addition & 0 deletions mne/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ def set_memmap_min_size(memmap_min_size):
"MNE_DATASETS_TESTING_PATH": "str, path for testing data",
"MNE_DATASETS_VISUAL_92_CATEGORIES_PATH": "str, path for visual_92_categories data",
"MNE_DATASETS_KILOWORD_PATH": "str, path for kiloword data",
"MNE_DATASETS_LITE_DATA_PATH": "str, path for lite_data data",
"MNE_DATASETS_FIELDTRIP_CMC_PATH": "str, path for fieldtrip_cmc data",
"MNE_DATASETS_PHANTOM_KIT_PATH": "str, path for phantom_kit data",
"MNE_DATASETS_PHANTOM_4DBTI_PATH": "str, path for phantom_4dbti data",
Expand Down
Loading