1import numpy as np
2import lindi
3from typing import cast
6def _load_real_000876(
7 *, num_samples: int, num_channels: int, start_channel: int
8) -> np.ndarray:
9 """Load data from DANDI dataset 000876.
11 Args:
12 num_samples: Number of samples to load
13 num_channels: Number of channels to load
14 start_channel: Starting channel index
16 Returns:
17 Array of shape (num_samples, num_channels) containing the loaded data
18 """
19 nwb_url = "https://api.dandiarchive.org/api/assets/7e1de06d-d478-40e2-9b64-9dd04eafaa4c/download/"
20 h5f = lindi.LindiH5pyFile.from_hdf5_file(nwb_url)
21 ds = h5f["/acquisition/ElectricalSeriesAP/data"]
22 assert isinstance(ds, lindi.LindiH5pyDataset)
23 ret = ds[:num_samples, start_channel : start_channel + num_channels]
24 return cast(np.ndarray, ret)
27def _load_real_000409(
28 *, num_samples: int, num_channels: int, start_channel: int
29) -> np.ndarray:
30 """Load data from DANDI dataset 000409.
32 Args:
33 num_samples: Number of samples to load
34 num_channels: Number of channels to load
35 start_channel: Starting channel index
37 Returns:
38 Array of shape (num_samples, num_channels) containing the loaded data
39 """
40 nwb_url = "https://api.dandiarchive.org/api/assets/c04f6b30-82bf-40e1-9210-34f0bcd8be24/download/"
41 h5f = lindi.LindiH5pyFile.from_hdf5_file(nwb_url)
42 ds = h5f["/acquisition/ElectricalSeriesAp/data"]
43 assert isinstance(ds, lindi.LindiH5pyDataset)
44 ret = ds[:num_samples, start_channel : start_channel + num_channels]
45 return cast(np.ndarray, ret)
48def _load_real_001290(
49 *, num_samples: int, num_channels: int, start_channel: int
50) -> np.ndarray:
51 """Load data from DANDI dataset 001290.
53 Args:
54 num_samples: Number of samples to load
55 num_channels: Number of channels to load
56 start_channel: Starting channel index
58 Returns:
59 Array of shape (num_samples, num_channels) containing the loaded data
60 """
61 nwb_url = "https://api.dandiarchive.org/api/assets/78c99d23-da88-4ecd-9086-c488a126eac5/download/"
62 h5f = lindi.LindiH5pyFile.from_hdf5_file(nwb_url)
63 ds = h5f["/acquisition/ElectricalSeriesAPImec/data"]
64 assert isinstance(ds, lindi.LindiH5pyDataset)
65 ret = ds[:num_samples, start_channel : start_channel + num_channels]
66 return cast(np.ndarray, ret)
69datasets = [
70 {
71 "name": "real-000876-ch45",
72 "version": "1",
73 "description": "Real neurophysiology data from DANDI:000876, channel 45",
74 "create": lambda: _load_real_000876(
75 num_samples=500_000, num_channels=1, start_channel=45
76 ).flatten(),
77 "tags": ["continuous", "neurophysiology"],
78 },
79 {
80 "name": "real-000409-ch101",
81 "version": "1",
82 "description": "Real neurophysiology data from DANDI:000409, channel 101",
83 "create": lambda: _load_real_000409(
84 num_samples=500_000, num_channels=1, start_channel=101
85 ).flatten(),
86 "tags": ["continuous", "neurophysiology"],
87 },
88 {
89 "name": "real-001290-ch0",
90 "version": "1",
91 "description": "Real neurophysiology data from DANDI:001290, channel 0",
92 "create": lambda: _load_real_001290(
93 num_samples=500_000, num_channels=1, start_channel=0
94 ).flatten(),
95 "tags": ["continuous", "neurophysiology"],
96 },
97]