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
modelof 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:
prediction (GeomAIPrediction | str) – ID or
modelof the prediction.file (BinaryIO | RawIOBase | BufferedIOBase | Path | str | PathLike | None) – Binary file-object or the path of the file to put the content into.
- Returns:
Noneif 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:
GeomAIPredictioninstance with the given ID if it exists.- Raises:
NotFoundError – No prediction with the given ID exists.
- Return type:
- 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
modelof 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:
configuration (GeomAIPredictionConfiguration | dict[str, Any]) – The configuration to run the prediction with.
workspace (GeomAIWorkspace | str | None) – Optional ID or
modelof the target workspace. Defaults to the current workspace if set.
- Returns:
Created prediction object.
- Raises:
ProcessingError – If the server failed to process the request.
- Return type:
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.
- 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.
- wait(timeout: float | None = None) bool#
Wait for all jobs concerning the object to either finish or fail.
- 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 has_failed#
Boolean indicating if the creation of the object failed.
See also
- property is_pending#
Boolean indicating if the object is still in creation. The value becomes
Falseonce object creation is either successful or has failed.See also
- property is_ready#
Boolean indicating if the object has finished creating without error.
See also
Configuration#
- pydantic model GeomAIPredictionConfiguration#
The configuration used to run a GeomAI prediction.
Raises
InvalidArgumentsif 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_paramyour 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], ifNoneis provided.For the maximum resolution of 900^3, the prediction takes approximately 10 minutes (approximately 1 microsecond per voxel).