vivyd.data.DataSet#
- class DataSet(*, name, info, site, authors=<factory>)[source]#
Bases:
ContainerA class representing a dataset, which is a hierarchical collection of studies. It is the top-level container in the data organization structure. A
DataSetis meant to hold an entire experimental campaign.- Parameters:
name (str) – The name of the dataset.
site (Site) – Information about the site/location where the data was collected.
authors (list[Author]) – The authors of the dataset.
info (dict[str, Any]) – Additional metadata about the dataset, such as experimental conditions, measurement techniques, etc. This is a flexible field that can hold any relevant information that does not fit into the predefined fields.
Attributes#
Methods#
- DataSet.save(path, create_dirs=False)[source]#
Save the dataset to a file. The dataset is saved in a chunked compressed format using Zarr, which allows for efficient storage and retrieval of large datasets. The metadata (structure and references to data) is stored as a JSON string in the root attributes of the Zarr store.
- Parameters:
path (Path | str) – The file path where the dataset should be saved. Must have a
.vxpextension.create_dirs (bool, optional) – If
True, create any missing directories in the specified path. Default isFalse.
- Raises:
ValueError – If the provided path does not have a
.vxpextension.
- static DataSet.load(path)[source]#
- Parameters:
path (Path | str) – The file path from which to load the dataset, which must respect the
.vxpextension format used for chunked storage.- Returns:
The loaded dataset.
- Return type:
- Raises:
ValueError – If the provided path does not have a
.vxpextension.
- static DataSet.download_from_zenodo(record_id, output_dir, token=None, create_dirs=False)[source]#
Download a dataset from Zenodo using the record ID. The dataset is expected to be in a valid
.vxpformat and will be saved to the specified output directory.- Parameters:
record_id (str) – The Zenodo record ID of the dataset to download.
output_dir (Path | str) – The directory where the downloaded dataset should be saved.
token (str | None, optional) – An optional Zenodo access token for downloading private records. If the record is public, this can be left as
None. Default isNone.create_dirs (bool, optional) – If
True, create any missing directories in the specified output path. Default isFalse.
Tip
You can find the record ID in the URL of the Zenodo page for the dataset. For example, if the URL is
https://zenodo.org/record/12345678, the record ID is12345678.