Predictions#

The Prediction module is in charge of running the SimAI-powered predictions on the geometries that you have uploaded.

A prediction represents a numerical prediction with geometry and boundary conditions. The arguments to the predictions.run() method depend on your model.

# Run a prediction on a given geometry with the specified velocity.
velocity = 10.0
prediction = geometry.run_prediction(Vx=velocity)

Directory#

class PredictionDirectory#

Provides a collection of methods related to model predictions.

This method is accessed through client.prediction.

Example

import ansys.simai.core

simai = ansys.simai.core.from_config()
simai.predictions.list()
delete(prediction: Prediction | str) None#

Delete a specific prediction from the server.

Parameters:

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

Raises:

ansys.simai.core.errors.NotFoundError – No prediction with the given ID exists.

get(id: str) Prediction#

Get a specific prediction object from the server by ID.

Parameters:

id (str) – ID of the prediction.

Returns:

Prediction instance with the given ID if it exists.

Raises:

NotFoundError – No prediction with the given ID exists.

Return type:

Prediction

list(workspace: Workspace | str | None = None) List[Prediction]#

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

Parameters:

workspace (Workspace | 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(geometry: Geometry | str, boundary_conditions: Dict[str, Number] | None = None, **kwargs) Prediction#

Run a prediction on a given geometry with a given boundary conditions.

Boundary conditions can be passed as a dictionary or as kwargs.

To learn more about the expected boundary conditions in your workspace, you can use the simai.current_workspace.model.boundary_conditions or simai.predictions.boundary_conditions method, where ex is your ~ansys.simai.core.client.SimAIClient object.

Parameters:
  • geometry (Geometry | str) – ID or model of the target geometry.

  • boundary_conditions (Dict[str, Number] | None) – Boundary conditions to apply in dictionary form.

Returns:

Created prediction object.

Raises:

ProcessingError – If the server failed to process the request.

Return type:

Prediction

Examples

simai = ansys.simai.core.from_config()
geometry = simai.geometries.list()[0]
prediction = simai.predictions.run(geometry, dict(Vx=10.5, Vy=2))

Using kwargs:

prediction = simai.predictions.run(geometry_id, Vx=10.5, Vy=2)
property boundary_conditions: Dict[str, Any]#

Information on the boundary conditions expected by the model of the current workspace. For example, the prediction’s input.

property info#

Information on the prediction’s inputs and outputs.

Example

from pprint import pprint
import ansys.simai.core

simai = ansys.simai.core.from_config()
prediction_info = simai.predictions.info
pprint(prediction_info)
property physical_quantities: Dict[str, Any]#

Information on the physical quantities generated by the model. For example, the prediction’s output.

Model#

class Prediction#

Provides the local representation of a prediction object.

delete() None#

Remove a prediction from the server.

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, in 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 boundary_conditions: Dict[str, Number]#

Boundary conditions of the prediction.

property confidence_score: str#

Confidence score, which is either high or low.

This method blocks until the confidence score is computed.

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 geometry: Geometry#

Parent geometry.

The parent geometry is queried if is not already known by the current SimAI client session.

See also

  • geometry_id: Get the parent geometry’s ID without query.

property geometry_id: str#

ID of the parent geometry.

See also

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 post: PredictionPostProcessings#

Namespace containing methods for postprocessing the result of a prediction.

For more information, see the PredictionPostProcessings class.