treble_tsdk.core.dataset_obj
Dataset Library: Enterprise-Grade Acoustic Dataset Management
The Dataset Library provides a comprehensive solution for discovering, purchasing, and managing pre-curated acoustic datasets. These datasets contain professionally prepared Impulse Response (IR) collections, enabling rapid development and deployment of acoustic applications without the need for extensive simulation infrastructure. Dataset objects for managing available datasets and purchases.
Classes
Represents an available dataset. |
|
Library for managing available datasets. |
- class treble_tsdk.core.dataset_obj.Dataset
Represents an available dataset.
This is a read-only representation of a dataset. For operations like purchase() and delete(), use the DatasetLibrary methods instead (e.g., tsdk.datasets.purchase(name)).
- __init__(data: dict, client: TSDKClient)
- property can_purchase_directly: bool
Whether this dataset can be purchased directly with tokens. Only applies to catalog datasets.
- property cost_display: str
Human-readable pricing information (e.g., ‘Free’, ‘Contact sales’).
- property cost_in_tokens: Decimal | None
Cost in tokens. Returns None if pricing requires contacting sales.
- property description: str
A detailed description of the dataset’s contents and use cases.
- property has_been_purchased: bool
Whether the current organization has purchased this dataset. Only applies to catalog datasets.
- property id: str
Unique identifier for this dataset.
- property ir_count: int
The total number of impulse responses contained in this dataset.
- property is_custom: bool
Whether this is a user-created dataset (as opposed to a catalog dataset).
- property name: str
The display name of the dataset.
- class treble_tsdk.core.dataset_obj.DatasetLibrary
Library for managing available datasets.
Provides methods to list, purchase, save, and delete datasets.
- delete(name_or_id: str) bool
Delete a user-created dataset.
Only user-created datasets can be deleted. Catalog datasets cannot be deleted.
- Parameters:
name_or_id (str) – Name or ID of the dataset to delete.
- Returns:
True if deletion was successful, False otherwise.
- Raises:
Exception if dataset not found, is not a user-created dataset, or deletion fails.
- display_all()
Display all datasets in a table.
Shows both catalog datasets and user-created datasets.
- get_ir_collection(name_or_id: str) IRCollection | None
Retrieve the IRCollection for a purchased dataset.
Returns the IRCollection if the dataset has been purchased. If the dataset is purchased but not available locally, it will be downloaded automatically.
- Parameters:
name_or_id (str) – Name or ID of the purchased dataset.
- Returns:
IRCollection object if the dataset is purchased, None otherwise.
- Raises:
Exception if dataset is not found or download fails.
- list() List[Dataset]
Get all available datasets.
Returns both catalog datasets (available for purchase) and custom datasets (created by the user).
- Returns:
List of all available datasets, including both catalog and custom datasets.
- list_catalog() List[Dataset]
Get catalog datasets available for purchase.
Returns only datasets from the official catalog, excluding user-created custom datasets. This is useful for browsing what’s available to purchase.
- Returns:
List of catalog datasets available for purchase.
- list_saved() List[Dataset]
Get user-created datasets.
Returns only datasets that were created and saved by users, excluding catalog datasets. These datasets are immediately available to the organization that created them.
- Returns:
List of custom/saved datasets created by users, unique by name.
- plot_sample(name_or_id: str)
Plot the simulation definition from the dataset sample
- Parameters:
name_or_id (str) – Identifier or name of the IR in the collection to use for plotting.
- Raises:
Exception if collection is empty, simulation_id or project_id is missing, or simulation cannot be found.
- purchase(name_or_id: str, approve: bool = False) IRCollection | None
Purchase a dataset and return an IRCollection.
For paid datasets, set approve=True to confirm the purchase. Free datasets and custom datasets are immediately available.
- sample(name_or_id: str) IRCollection | None
Get a sample IRCollection from a catalog dataset (first 5 IRs).
This allows previewing a dataset before purchase. Only available for catalog datasets.
- Parameters:
name_or_id (str) – Name or ID of the dataset.
- Returns:
IRCollection with first 5 IRs, or None if sample not available.
- Raises:
Exception if dataset not found or is a custom dataset.
- save_dataset(ir_collection: IRCollection, name: str, description: str | None = None) Dataset
Save an IRCollection as a new dataset.
Creates a new user-created dataset from an IRCollection. The dataset will be immediately available and can be accessed like any other dataset from within your organization.
- Parameters:
ir_collection (IRCollection) – The IRCollection to save as a dataset.
name (str) – Name for the new dataset (must be unique).
description (str) – Optional description for the dataset.
- Returns:
Dataset object representing the saved dataset.
- Raises:
Exception if save fails or a dataset with the same name already exists.