qewton.data.datasets package

Module contents

Subpackages

Submodules

qewton.data.datasets.base module

Base class definitions for all datasets.

class qewton.data.datasets.base.DataSet(*args, **kwargs)[source]

Bases: ABC, Serializable

Abstract base class for all datasets.

A DataSet provides a standard interface for accessing data samples, batches, and configuration metadata. It supports both eager and lazy loading.

abstract property data_configs: list[DataConfiguration]

Returns the data configurations for the data stored in this dataset.

abstractmethod get_batch(idcs) → list[Any][source]

Retrieve a batch of data given a list of indices.

Parameters:

idcs (list[int]) – Indices of the samples to retrieve.

Returns:

A list where each element corresponds to a data object

(e.g., input tensors, targets).

Return type:

list[Any]

abstractmethod get_continuous_batch(start_idx, end_idx) → list[Any][source]

Retrieve a continuous slice of data.

Parameters:
  • start_idx (int) – Starting index.

  • end_idx (int) – Ending index.

Returns:

Sliced data objects.

Return type:

list[Any]

abstractmethod load_complete_data(variable=None, data_item=None)[source]

Fully load the data into memory. Many subclasses provide lazy slicing, where data is only read from the disk when needed.

This returns the whole dataset at once.

setup()[source]

Optional setup method for subclasses to override.

property metadata: dict

Optional metadata associated with the dataset (e.g., HDF5 attributes).

property data_set_loaded: bool

Check if the dataset is fully loaded into memory.

Returns:

True if all data objects are loaded, False otherwise.

Return type:

bool