Datasets¶
Sample dataset fetchers for tutorials and examples.
VneuroTK sample datasets.
Usage
from vneurotk.datasets import sample root = sample.data_path("nod-meg") # download only NOD-MEG root = sample.data_path("monkey-vision") # download only MonkeyVision root = sample.data_path() # download all datasets
Directory layout after download
data_path() returns the extracted root that contains both sub-trees::
<root>/
├── nod-meg/
│ ├── meg/
│ │ └── sub-01_ses-ImageNet01_task-ImageNet_run-01_meg_clean.fif
│ ├── events/
│ │ └── sub-01_events.csv
│ └── stimuli/
│ └── <image_id>.JPEG (200 images from run 01)
└── monkey-vision/
└── sessions/
└── 251024_FanFan_nsd1w_MSB/
├── TrialRaster_251024_FanFan_nsd1w_MSB.h5
├── TrialRecord_251024_FanFan_nsd1w_MSB.csv
├── MeanFr_251024_FanFan_nsd1w_MSB.h5
├── ChMeanFr_251024_FanFan_nsd1w_MSB.h5
├── ChStimFr_251024_FanFan_nsd1w_MSB.h5
├── UnitProp_251024_FanFan_nsd1w_MSB.csv
└── ChProp_251024_FanFan_nsd1w_MSB.csv
data_path(dataset=None, path=None, progressbar=True)
¶
Return the root directory of VneuroTK sample datasets.
Downloads and caches on first call; subsequent calls return immediately.
The default cache location is ~/.cache/vneurotk/ (platform-specific).
Zip files are fetched from Zenodo (DOI 10.5281/zenodo.20094167) and
extracted into a shared vneurotk-samples/ sub-directory so you can
navigate all datasets with a single root path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
str or list of str or None
|
Which dataset(s) to download. Accepted values:
|
None
|
path
|
str or Path or None
|
Override the default cache directory. |
None
|
progressbar
|
bool
|
Show a tqdm progress bar while downloading. Requires |
True
|
Returns:
| Type | Description |
|---|---|
Path
|
Root directory containing |
Examples:
>>> from vneurotk.datasets import sample
>>> from vneurotk.io import MNEPath, EphysPath
>>>
>>> # download only the MEG dataset
>>> root = sample.data_path("nod-meg")
>>> mne_path = MNEPath(
... root=root / "nod-meg" / "meg",
... subject=sample.NOD_SUBJECT,
... session=sample.NOD_SESSION,
... task=sample.NOD_TASK,
... run=sample.NOD_RUN,
... suffix="meg_clean",
... extension=".fif",
... )
>>>
>>> # download only the Ephys dataset
>>> root = sample.data_path("monkey-vision")
>>> raster_path = EphysPath(
... root=root / "monkey-vision",
... session_id=sample.EPHYS_SESSION_ID,
... dtype="TrialRaster",
... )
Source code in src/vneurotk/datasets/sample.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | |