1"""Data loading utilities."""
3import numpy as np
4import lindi
5from typing import cast
6import warnings
9def load_real_000876(
10 *, num_samples: int, num_channels: int, start_channel: int
11) -> np.ndarray:
12 """Load data from DANDI dataset 000876.
14 Args:
15 num_samples: Number of samples to load
16 num_channels: Number of channels to load
17 start_channel: Starting channel index
19 Returns:
20 Array of shape (num_samples, num_channels) containing the loaded data
21 """
22 warnings.warn(
23 "This function is deprecated. Use datasets['real-000876-ch45']['create']() instead.",
24 DeprecationWarning,
25 stacklevel=2,
26 )
27 nwb_url = "https://api.dandiarchive.org/api/assets/7e1de06d-d478-40e2-9b64-9dd04eafaa4c/download/"
28 h5f = lindi.LindiH5pyFile.from_hdf5_file(nwb_url)
29 ds = h5f["/acquisition/ElectricalSeriesAP/data"]
30 assert isinstance(ds, lindi.LindiH5pyDataset)
31 ret = ds[:num_samples, start_channel : start_channel + num_channels]
32 return cast(np.ndarray, ret)
35def load_real_000409(
36 *, num_samples: int, num_channels: int, start_channel: int
37) -> np.ndarray:
38 """Load data from DANDI dataset 000409.
40 Args:
41 num_samples: Number of samples to load
42 num_channels: Number of channels to load
43 start_channel: Starting channel index
45 Returns:
46 Array of shape (num_samples, num_channels) containing the loaded data
47 """
48 warnings.warn(
49 "This function is deprecated. Use datasets['real-000409-ch101']['create']() instead.",
50 DeprecationWarning,
51 stacklevel=2,
52 )
53 nwb_url = "https://api.dandiarchive.org/api/assets/c04f6b30-82bf-40e1-9210-34f0bcd8be24/download/"
54 h5f = lindi.LindiH5pyFile.from_hdf5_file(nwb_url)
55 ds = h5f["/acquisition/ElectricalSeriesAp/data"]
56 assert isinstance(ds, lindi.LindiH5pyDataset)
57 ret = ds[:num_samples, start_channel : start_channel + num_channels]
58 return cast(np.ndarray, ret)
61def load_real_001290(
62 *, num_samples: int, num_channels: int, start_channel: int
63) -> np.ndarray:
64 """Load data from DANDI dataset 001290.
66 Args:
67 num_samples: Number of samples to load
68 num_channels: Number of channels to load
69 start_channel: Starting channel index
71 Returns:
72 Array of shape (num_samples, num_channels) containing the loaded data
73 """
74 warnings.warn(
75 "This function is deprecated. Use datasets['real-001290-ch0']['create']() instead.",
76 DeprecationWarning,
77 stacklevel=2,
78 )
79 nwb_url = "https://api.dandiarchive.org/api/assets/78c99d23-da88-4ecd-9086-c488a126eac5/download/"
80 h5f = lindi.LindiH5pyFile.from_hdf5_file(nwb_url)
81 ds = h5f["/acquisition/ElectricalSeriesAPImec/data"]
82 assert isinstance(ds, lindi.LindiH5pyDataset)
83 ret = ds[:num_samples, start_channel : start_channel + num_channels]
84 return cast(np.ndarray, ret)