/ proof-of-concept / benchcompress
Sign in
proof-of-concept / benchcompress
85 lines · 3.2 KBBlameHistoryRaw
1import numpy as np
2import lindi
3from typing import cast
6def _load_real_000876(*, num_samples: int, num_channels: int, start_channel: int) -> np.ndarray:
7 """Load data from DANDI dataset 000876.
9 Args:
10 num_samples: Number of samples to load
11 num_channels: Number of channels to load
12 start_channel: Starting channel index
14 Returns:
15 Array of shape (num_samples, num_channels) containing the loaded data
16 """
17 nwb_url = "https://api.dandiarchive.org/api/assets/7e1de06d-d478-40e2-9b64-9dd04eafaa4c/download/"
18 h5f = lindi.LindiH5pyFile.from_hdf5_file(nwb_url)
19 ds = h5f["/acquisition/ElectricalSeriesAP/data"]
20 assert isinstance(ds, lindi.LindiH5pyDataset)
21 ret = ds[:num_samples, start_channel:start_channel + num_channels]
22 return cast(np.ndarray, ret)
25def _load_real_000409(*, num_samples: int, num_channels: int, start_channel: int) -> np.ndarray:
26 """Load data from DANDI dataset 000409.
28 Args:
29 num_samples: Number of samples to load
30 num_channels: Number of channels to load
31 start_channel: Starting channel index
33 Returns:
34 Array of shape (num_samples, num_channels) containing the loaded data
35 """
36 nwb_url = "https://api.dandiarchive.org/api/assets/c04f6b30-82bf-40e1-9210-34f0bcd8be24/download/"
37 h5f = lindi.LindiH5pyFile.from_hdf5_file(nwb_url)
38 ds = h5f['/acquisition/ElectricalSeriesAp/data']
39 assert isinstance(ds, lindi.LindiH5pyDataset)
40 ret = ds[:num_samples, start_channel:start_channel + num_channels]
41 return cast(np.ndarray, ret)
44def _load_real_001290(*, num_samples: int, num_channels: int, start_channel: int) -> np.ndarray:
45 """Load data from DANDI dataset 001290.
47 Args:
48 num_samples: Number of samples to load
49 num_channels: Number of channels to load
50 start_channel: Starting channel index
52 Returns:
53 Array of shape (num_samples, num_channels) containing the loaded data
54 """
55 nwb_url = "https://api.dandiarchive.org/api/assets/78c99d23-da88-4ecd-9086-c488a126eac5/download/"
56 h5f = lindi.LindiH5pyFile.from_hdf5_file(nwb_url)
57 ds = h5f['/acquisition/ElectricalSeriesAPImec/data']
58 assert isinstance(ds, lindi.LindiH5pyDataset)
59 ret = ds[:num_samples, start_channel:start_channel + num_channels]
60 return cast(np.ndarray, ret)
63datasets = [
64 {
65 'name': 'real-000876-ch45',
66 'version': '1',
67 'description': 'Real neurophysiology data from DANDI:000876, channel 45',
68 'create': lambda: _load_real_000876(num_samples=500_000, num_channels=1, start_channel=45).flatten(),
69 'tags': ['continuous', 'neurophysiology']
70 },
71 {
72 'name': 'real-000409-ch101',
73 'version': '1',
74 'description': 'Real neurophysiology data from DANDI:000409, channel 101',
75 'create': lambda: _load_real_000409(num_samples=500_000, num_channels=1, start_channel=101).flatten(),
76 'tags': ['continuous', 'neurophysiology']
77 },
78 {
79 'name': 'real-001290-ch0',
80 'version': '1',
81 'description': 'Real neurophysiology data from DANDI:001290, channel 0',
82 'create': lambda: _load_real_001290(num_samples=500_000, num_channels=1, start_channel=0).flatten(),
83 'tags': ['continuous', 'neurophysiology']
84 }
↑↓ move↵openescclose