/ concept-collection / benchcompress
Sign in
concept-collection / benchcompress
benchcompress / zia_benchmark / src / zia / _data_loaders.py
60 lines · 2.3 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)
moveopenescclose