vivyd.data.DataSet#

class DataSet(*, name, info, site, authors=<factory>)[source]#

Bases: Container

A class representing a dataset, which is a hierarchical collection of studies. It is the top-level container in the data organization structure. A DataSet is 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#

DataSet.site: Site#

Information about the site/location where the data was collected.

DataSet.authors: list[Author]#

The authors of the dataset.

Methods#

DataSet.add(*study)[source]#

Add one or more studies to the dataset.

Parameters:

*study (Study) – One or more study objects to add to the dataset.

Returns:

The dataset with the added studies.

Return type:

DataSet

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 .vxp extension.

  • create_dirs (bool, optional) – If True, create any missing directories in the specified path. Default is False.

Raises:

ValueError – If the provided path does not have a .vxp extension.

static DataSet.load(path)[source]#
Parameters:

path (Path | str) – The file path from which to load the dataset, which must respect the .vxp extension format used for chunked storage.

Returns:

The loaded dataset.

Return type:

DataSet

Raises:

ValueError – If the provided path does not have a .vxp extension.

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 .vxp format 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 is None.

  • create_dirs (bool, optional) – If True, create any missing directories in the specified output path. Default is False.

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 is 12345678.