NestedDataset¶
- class NestedDataset(datasets, transform=None)[source]¶
Bases:
DatasetDataset that composes multiple
Datasetinstances under a single interface.Each child dataset is namespaced by a string prefix (its dataset name). Exposed
recording_idstherefore take the form"<dataset_name>/<recording_id>". The nested dataset behaves like a regular Dataset, dispatching all operations to the appropriate child dataset based on this prefix.Instances of
NestedDatasetcan themselves be nested inside otherNestedDatasetobjects, allowing for arbitrary-depth hierarchies of datasets while preserving the same prefix-based naming convention.See Namespacing: for how Data attributes are namespaced.
- Parameters:
datasets (
Union[Iterable[Dataset],Mapping[str,Dataset]]) – Either a mapping from dataset name toDatasetinstance, or a list/tuple ofDatasetinstances. When a list/tuple is given, dataset names are inferred from the class names of the datasets. In this case, duplicate class names are not allowed.transform (
Optional[Callable]) – Optional transform that is applied to samples in__getitem__().
- get_recording(recording_id, _namespace='')[source]¶
Return a full Data recording from the appropriate child dataset.
- Parameters:
- Returns:
The selected Data object.
- Return type:
Data
- Raises:
ValueError – If the recording_id does not contain a dataset prefix.
- get_sampling_intervals(*args, **kwargs)[source]¶
Return sampling intervals for all recordings across child datasets.
Any positional and keyword arguments are forwarded to the underlying datasets’
get_sampling_intervals()methods. Keys in the returned dictionary are prefixed with the corresponding dataset name so that they match the nested"<dataset_name>/<recording_id>"convention.
- class NestedSpikingDataset(datasets, transform=None)[source]¶
Bases:
SpikingDatasetMixin,NestedDatasetSpiking variant of
NestedDataset.This class combines the nesting behavior of NestedDataset with the spike-specific utilities provided by
SpikingDatasetMixin.This class inherits its constructor from
NestedDataset.