-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathtesting.py
52 lines (41 loc) · 1.44 KB
/
testing.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from __future__ import annotations # c.f. PEP 563 and PEP 649
from importlib.resources import files
from pathlib import Path
from typing import TYPE_CHECKING
import pooch
from mne.utils import get_config
from ..utils._checks import ensure_path
from ._fetch import fetch_dataset
if TYPE_CHECKING:
from typing import Optional, Union
_REGISTRY: Path = files("mne_lsl.datasets") / "testing-registry.txt"
def _make_registry(
folder: Union[str, Path], output: Optional[Union[str, Path]] = None
) -> None:
"""Create the registry file for the testing dataset.
Parameters
----------
folder : path-like
Path to the sample dataset.
output : path-like
Path to the output registry file.
"""
folder = ensure_path(folder, must_exist=True)
output = _REGISTRY if output is None else output
pooch.make_registry(folder, output=output, recursive=True)
def data_path() -> Path:
"""Return the path to the testing dataset, downloaded if needed.
Returns
-------
path : Path
Path to the testing dataset, by default in ``"~/mne_data/mne_lsl"``.
"""
path = (
Path(get_config("MNE_DATA", Path.home())).expanduser()
/ "mne_data"
/ "MNE-LSL-data"
/ "testing"
)
base_url = "https://github.com/mscheltienne/mne-lsl-datasets/raw/main/testing"
registry = files("mne_lsl.datasets") / "testing-registry.txt"
return fetch_dataset(path, base_url, registry)