GeomAITrainingData#

A GeomAITrainingData instance is a collection of GeomAITrainingDataPart instances representing a geometry that can be used as input for the training of models. In most cases it will contain a single part: the geometry to train on.

Directory#

class GeomAITrainingDataDirectory#

Provides a collection of methods related to training data.

This class is accessed through client.training_data.

Example

List all of the GeomAI training data:

import ansys.simai.core

simai = ansys.simai.core.from_config()
simai.geomai.training_data.list()
create(name: str, project: GeomAIProject | str | None = None) GeomAITrainingData#

Create an empty GeomAITrainingData object.

Parameters:
Returns:

Created GeomAITrainingData object.

Return type:

GeomAITrainingData

See also

create_from_file() handles all the creation of training data and parts for you

create_from_file(file: Path | str | PathLike | Tuple[BinaryIO | RawIOBase | BufferedIOBase | Path | str | PathLike, str], project: GeomAIProject | str | None = None, monitor_callback: Callable[[int], None] | None = None) GeomAITrainingData#

Convenience function to create a GeomAITrainingData object from a file.

Parameters:
delete(training_data: GeomAITrainingData | str) None#

Delete a GeomAITrainingData object and its associated parts from the server.

Parameters:

training_data (GeomAITrainingData | str) – ID or model object of the GeomAITrainingData object.

get(id) GeomAITrainingData#

Get a specific GeomAITrainingData object from the server.

Parameters:

id – ID of the training data

Returns:

GeomAITrainingData

Raises:

NotFoundError – No training data with the given ID exists.

Return type:

GeomAITrainingData

iter(filters: dict[str, Any] | list[tuple[str, Literal['EQ', 'LIKE', 'IN', 'GT', 'GTE', 'LT', 'LTE'], Any]] | list[RawSingleFilter] | None = None) SizedIterator[GeomAITrainingData]#

Iterate over all GeomAITrainingData objects on the server.

Parameters:

filters (dict[str, Any] | list[tuple[str, Literal['EQ', 'LIKE', 'IN', 'GT', 'GTE', 'LT', 'LTE'], ~typing.Any]] | list[~ansys.simai.core.data.types.RawSingleFilter] | None) – Optional Filters to apply.

Returns:

Iterator over all GeomAITrainingData objects on the server.

Return type:

SizedIterator[GeomAITrainingData]

list(filters: dict[str, Any] | list[tuple[str, Literal['EQ', 'LIKE', 'IN', 'GT', 'GTE', 'LT', 'LTE'], Any]] | list[RawSingleFilter] | None = None) List[GeomAITrainingData]#

List all GeomAITrainingData objects on the server.

Warning

This can take a very long time, consider using iter() instead.

Parameters:

filters (dict[str, Any] | list[tuple[str, Literal['EQ', 'LIKE', 'IN', 'GT', 'GTE', 'LT', 'LTE'], ~typing.Any]] | list[~ansys.simai.core.data.types.RawSingleFilter] | None) – Optional Filters to apply.

Returns:

List of all GeomAITrainingData objects on the server.

Return type:

List[GeomAITrainingData]

upload_folder(training_data: GeomAITrainingData | str, folder_path: Path | str | PathLike) List[GeomAITrainingDataPart]#

Upload all files in a folder to a GeomAITrainingData object.

This method automatically requests computation of the training data once the upload is complete unless specified otherwise.

Parameters:

See also

create_from_file() handles all the creation of training data and parts for you

upload_part(training_data: GeomAITrainingData | str, file: Path | str | PathLike | Tuple[BinaryIO | RawIOBase | BufferedIOBase | Path | str | PathLike, str], monitor_callback: Callable[[int], None] | None = None) GeomAITrainingDataPart#

Add a part to a GeomAITrainingData object.

Parameters:
Returns:

Added GeomAITrainingDataPart object.

Return type:

GeomAITrainingDataPart

Model#

class GeomAITrainingData#

Provides the local representation of a training data object.

add_to_project(project: GeomAIProject | str)#

Add the training data to a GeomAIProject object.

Parameters:

project (GeomAIProject | str) – ID or model object of the project to add the data to.

delete() None#

Delete the training data on the server.

extract_data() None#

Extract or reextract the data from a training data.

Data should be extracted from a training data once all its parts have been fully uploaded. This is done automatically when using GeomAITrainingDataDirectory.upload_folder() to create training data.

Data can only be reextracted from a training data if the extraction previously failed or if new files have been added.

reload() None#

Refresh the object with its representation from the server.

remove_from_project(project: GeomAIProject | str)#

Remove the training data from a GeomAIProject object.

Parameters:

project (GeomAIProject | str) – ID or model of the project to remove data from.

Raises:
upload_folder(folder_path: Path | str | PathLike) List[GeomAITrainingDataPart]#

Upload all the parts contained in a folder to a GeomAITrainingData instance.

Upon upload completion, GeomAI will extract data from each part.

Parameters:

folder_path (Path | str | PathLike) – Path to the folder with the files to upload.

Returns:

List of uploaded training data parts.

Return type:

List[GeomAITrainingDataPart]

upload_part(file: Path | str | PathLike | Tuple[BinaryIO | RawIOBase | BufferedIOBase | Path | str | PathLike, str], monitor_callback: Callable[[int], None] | None = None) GeomAITrainingDataPart#

Add a part to the training data.

Parameters:
Returns:

Created GeomAITrainingDataPart.

Return type:

GeomAITrainingDataPart

wait(timeout: float | None = None) bool#

Wait for all jobs concerning the object to either finish or fail.

Parameters:

timeout (float | None) – Maximum amount of time in seconds to wait. The default is None, it means that there is no maximum on the time to wait.

Returns:

True if the computation has finished, False if the operation timed out.

Return type:

bool

property extracted_metadata: Dict | None#

Metadata extracted from the training data.

property failure_reason#

Optional message giving the causes for why the creation of the object failed.

See also

property fields: dict#

Dictionary containing the raw object representation.

property has_failed#

Boolean indicating if the creation of the object failed.

property id: str#

ID of the object on the server.

property is_pending#

Boolean indicating if the object is still in creation. The value becomes False once object creation is either successful or has failed.

property is_ready#

Boolean indicating if the object has finished creating without error.

property name: str#

Name of the training data.

property parts: List[GeomAITrainingDataPart]#

List of all parts objects in the training data.