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

simai = ansys.simai.core.from_config()
simai.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.

Parameters:
Returns:

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

Return type:

None | BinaryIO

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

simai = ansys.simai.core.from_config()
workspace = simai.geomai.workspaces.list()[0]
prediction = simai.geomai.predictions.run(
    dict(latent_params=[0.1, 1.2, 0.76], resolution=(100, 100, 100), margin=0.0),
    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.

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 margin: float | None = None#

A float that sets the size of the isosurface for the reconstruction of the geometry.

Note

A margin of 0.0 is highly recommended for non-expert users.

If you are an expert user, and if the generated geometry is noisy, you can try to adjust both resolution and margin values to find the right balance between them to generate a smoother geometry.

A higher margin gives a coarser surface with less detail.
A lower margin produces a sharper surface.

Defaults to 0 if none is provided.

Constraints:
  • ge = 0

  • le = 1

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 divisions along the X, Y, and Z axes.

Higher values allow for more detailed geometry reconstruction, while lower values reduce detail but speed up computation.

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