GeomAIPredictions#

The Prediction module is in charge of running the GeomAI-powered predictions in your workspaces.

Directory#

class GeomAIPredictionDirectory#

Provides a collection of methods related to GeomAI model predictions.

This method is accessed through client.geomai.predictions.

Example

import ansys.simai.core as asc

simai_client = asc.from_config()
simai_client.geomai.predictions.list()
delete(prediction: GeomAIPrediction | str) None#

Delete a specific GeomAI prediction from the server.

Parameters:

prediction (GeomAIPrediction | str) – ID or model of the prediction.

Raises:

NotFoundError – No prediction with the given ID exists.

download(prediction: GeomAIPrediction | str, file: BinaryIO | RawIOBase | BufferedIOBase | Path | str | PathLike | None = None) None | BinaryIO#

Download the file generated by the prediction.

The downloaded file will be in the VTP format.

Parameters:
Returns:

None if a file is specified or a binary file-object otherwise.

Return type:

None | BinaryIO

Note

Consider using GeomAIPrediction.download() instead which will wait for the

prediction to be ready instead of throwing an error if it’s not.

get(id: str) GeomAIPrediction#

Get a specific GeomAI prediction object from the server by ID.

Parameters:

id (str) – ID of the prediction.

Returns:

GeomAIPrediction instance with the given ID if it exists.

Raises:

NotFoundError – No prediction with the given ID exists.

Return type:

GeomAIPrediction

list(workspace: GeomAIWorkspace | str | None = None) List[GeomAIPrediction]#

List all GeomAI predictions on the server that belong to the specified workspace or the configured one.

Parameters:

workspace (GeomAIWorkspace | str | None) – ID or model of the workspace to list the predictions for. This parameter is necessary if no workspace is set for the client.

run(configuration: GeomAIPredictionConfiguration | dict[str, Any], workspace: GeomAIWorkspace | str | None = None) GeomAIPrediction#

Run a prediction in the given workspace with the given configuration.

Parameters:
Returns:

Created prediction object.

Raises:

ProcessingError – If the server failed to process the request.

Return type:

GeomAIPrediction

Examples

import ansys.simai.core as asc

simai_client = asc.from_config()
workspace = simai_client.geomai.workspaces.list()[0]
prediction = simai_client.geomai.predictions.run(
    dict(latent_params=[0.1, 1.2, 0.76], resolution=(100, 100, 100)),
    workspace,
)

Model#

class GeomAIPrediction#

Provides the local representation of a GeomAI prediction object.

delete() None#

Remove a prediction from the server.

download(file: BinaryIO | RawIOBase | BufferedIOBase | Path | str | PathLike | None = None) None | BinaryIO#

Download the file generated by the prediction.

The downloaded file will be in the VTP format.

Parameters:

file (BinaryIO | RawIOBase | BufferedIOBase | Path | str | PathLike | None) – Binary file-object or the path of the file to put the content into.

Returns:

None if a file is specified or a binary file-object otherwise.

Return type:

None | BinaryIO

reload() None#

Refresh the object with its representation from the server.

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 configuration: GeomAIPredictionConfiguration#

The configuration used to run the prediction.

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.

Configuration#

pydantic model GeomAIPredictionConfiguration#

The configuration used to run a GeomAI prediction.

Raises InvalidArguments if the input data cannot be validated to from a valid model.

field latent_params: List[float] [Required]#

A list of floats that represent the position of the geometry in the latent space.

These parameters describe the shape in a compressed form. The number of floats should match the nb_latent_param your model was requested with.

Required.

field resolution: Tuple[Annotated[int, Gt(gt=0)], Annotated[int, Gt(gt=0)], Annotated[int, Gt(gt=0)]] | None = None#

A list of three integers defining the number of voxels along the X, Y, and Z axes.

Use higher resolution for complex or precise geometries, and lower resolution for simple shapes or quick previews.

The total number of voxels must not exceed 900^3, that is x, y, z multiplied together must be less than or equal to 900^3. If you exceed that value, an error will occur.

Defaults to [100,100,100], if None is provided.

For the maximum resolution of 900^3, the prediction takes approximately 10 minutes (approximately 1 microsecond per voxel).