Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

exp_dataspace

minto.v1.exp_dataspace

Classes

Space

Space()

Enumeration defining the types of spaces in the experiment data structure.


ExperimentDataSpace

ExperimentDataSpace(experiment_name: str, experiment_datastore: minto.v1.datastore.DataStore = DataStore(), run_datastores: list = list())

A container class for managing experimental data with multiple runs.

This class provides a structured way to organize and manage data from optimization experiments, including both experiment-wide data and data from individual runs.

Directory structure when saved:

.. code-block:: text

base_dir/
├── experiment/          # Experiment-wide data
│   ├── problems_*.problem
│   ├── instances_*.instance
│   └── ...
└── runs/               # Individual run data
    ├── 0/             # First run
    │   ├── problems_*.problem
    │   ├── solutions_*.solution
    │   └── ...
    ├── 1/             # Second run
    └── ...

Methods

add_run_datastore
add_run_datastore(run_datastore: minto.v1.datastore.DataStore, with_save = False, save_dir: str | pathlib.Path = '.') -> int

Add a new run datastore to the experiment.

Parameters:

NameTypeDescription
run_datastoreminto.v1.datastore.DataStoreThe datastore for the new run

Returns:

TypeDescription
intID assigned to the new run
add_exp_data
add_exp_data(name: str, obj, storage_name: str, with_save = False, save_dir: str | pathlib.Path = '.')

Add data to the experiment-wide storage.

Parameters:

NameTypeDescription
namestrIdentifier for the data
objAnyThe data to store
storage_namestrType of storage to use
with_saveboolWhether to save immediately. Defaults to False.
save_dir`strPath`
add_run_data
add_run_data(run_id: int, name: str, obj, storage_name: str, with_save = False, save_dir: str | pathlib.Path = '.')

Add data to a specific run’s storage.

Parameters:

NameTypeDescription
run_idintID of the run to add data to
namestrIdentifier for the data
objAnyThe data to store
storage_namestrType of storage to use
with_saveboolWhether to save immediately. Defaults to False.
save_dir`strPath`

Raises:

ExceptionDescription
ValueErrorIf run_id is not found in run_datastores
save_dir
save_dir(base_dir: str | pathlib.Path)

Save all experiment data to a directory structure.

Creates a directory structure containing all experiment and run data, organized according to the standard layout.

Parameters:

NameTypeDescription
base_dir`strPath`
load_from_dir

classmethod

load_from_dir(base_dir: str | pathlib.Path) -> minto.v1.exp_dataspace.ExperimentDataSpace

Load an experiment data space from a directory structure.

Parameters:

NameTypeDescription
base_dir`strPath`

Returns:

TypeDescription
minto.v1.exp_dataspace.ExperimentDataSpaceNew instance containing the loaded data

Raises:

ExceptionDescription
minto.v1.exceptions.FileNotFoundErrorIf the directory does not exist
minto.v1.exceptions.FileCorruptionErrorIf a file is corrupted or has invalid format
minto.v1.exceptions.MissingMetadataErrorIf required metadata is missing
minto.v1.exceptions.InvalidMetadataErrorIf metadata has invalid format or values
add_to_artifact_builder
add_to_artifact_builder(builder: ommx.artifact.ArtifactBuilder)

Add all experiment data to an OMMX artifact builder.

Adds both experiment-wide data and run data to the artifact builder, with appropriate annotations to maintain the hierarchical structure.

Parameters:

NameTypeDescription
builderommx.artifact.ArtifactBuilderThe artifact builder to add data to
load_from_ommx_archive

classmethod

load_from_ommx_archive(path: str | pathlib.Path) -> minto.v1.exp_dataspace.ExperimentDataSpace

Create an experiment data space from an OMMX artifact.

Loads and organizes data from an OMMX artifact, reconstructing the experiment and run structure based on layer annotations.

Parameters:

NameTypeDescription
path`strPath`

Returns:

TypeDescription
minto.v1.exp_dataspace.ExperimentDataSpaceNew instance containing the loaded data

Raises:

ExceptionDescription
minto.v1.exceptions.FileNotFoundErrorIf the archive file does not exist
minto.v1.exceptions.FileCorruptionErrorIf the archive file is corrupted or has invalid format
minto.v1.exceptions.MissingMetadataErrorIf required metadata is missing
minto.v1.exceptions.InvalidMetadataErrorIf metadata has invalid format or values
load_from_ommx_artifact

classmethod

load_from_ommx_artifact(artifact: ommx.artifact.Artifact) -> minto.v1.exp_dataspace.ExperimentDataSpace

Create an experiment data space from an OMMX artifact.

Loads and organizes data from an OMMX artifact, reconstructing the experiment and run structure based on layer annotations.

Parameters:

NameTypeDescription
artifactommx.artifact.ArtifactThe OMMX artifact containing the data

Returns:

TypeDescription
minto.v1.exp_dataspace.ExperimentDataSpaceNew instance containing the loaded data

Raises:

ExceptionDescription
minto.v1.exceptions.FileNotFoundErrorIf the artifact is None
minto.v1.exceptions.MissingMetadataErrorIf required metadata is missing
minto.v1.exceptions.InvalidMetadataErrorIf metadata has invalid format or values
minto.v1.exceptions.FileCorruptionErrorIf a layer is corrupted or has invalid format