API Reference
Datastore¶
oqd_dataschema.datastore
¶
Datastore
¶
Bases: BaseModel
Saves the model and its associated data to an HDF5 file. This method serializes the model's data and attributes into an HDF5 file at the specified filepath.
Attributes:
Name | Type | Description |
---|---|---|
filepath |
Path
|
The path to the HDF5 file where the model data will be saved. |
Source code in oqd-dataschema/src/oqd_dataschema/datastore.py
model_dump_hdf5(filepath: pathlib.Path)
¶
Saves the model and its associated data to an HDF5 file. This method serializes the model's data and attributes into an HDF5 file at the specified filepath.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filepath
|
Path
|
The path to the HDF5 file where the model data will be saved. |
required |
Source code in oqd-dataschema/src/oqd_dataschema/datastore.py
model_validate_hdf5(filepath: pathlib.Path)
classmethod
¶
Loads the model from an HDF5 file at the specified filepath.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filepath
|
Path
|
The path to the HDF5 file where the model data will be read and validated from. |
required |
Source code in oqd-dataschema/src/oqd_dataschema/datastore.py
Base HDF5 Objects¶
oqd_dataschema.base
¶
Group
¶
Bases: BaseModel
Schema representation for a group object within an HDF5 file.
Each grouping of data should be defined as a subclass of Group
, and specify the datasets that it will contain.
This base object only has attributes, attrs
, which are associated to the HDF5 group.
Attributes:
Name | Type | Description |
---|---|---|
attrs |
Optional[dict[str, Union[int, float, str, complex]]]
|
A dictionary of attributes to append to the dataset. |
Source code in oqd-dataschema/src/oqd_dataschema/base.py
Dataset
¶
Bases: BaseModel
Schema representation for a dataset object to be saved within an HDF5 file.
Attributes:
Name | Type | Description |
---|---|---|
dtype |
Optional[Literal[tuple(keys())]]
|
The datatype of the dataset, such as |
shape |
Optional[tuple[int, ...]]
|
The shape of the dataset. |
data |
Optional[Any]
|
The numpy ndarray of the data, from which |
attrs |
Optional[dict[str, Union[int, float, str, complex]]]
|
A dictionary of attributes to append to the dataset. |
Example
Source code in oqd-dataschema/src/oqd_dataschema/base.py
validate_data_matches_shape_dtype()
¶
Ensure that data
matches dtype
and shape
.
Source code in oqd-dataschema/src/oqd_dataschema/base.py
Specified Groups¶
oqd_dataschema.groups
¶
SinaraRawDataGroup
¶
Bases: Group
Example Group
for raw data from the Sinara real-time control system.
This is a placeholder for demonstration and development.
Source code in oqd-dataschema/src/oqd_dataschema/groups.py
MeasurementOutcomesDataGroup
¶
Bases: Group
Example Group
for processed data classifying the readout of the state.
This is a placeholder for demonstration and development.