GeomAIProjections#

The Projections module is in charge of projecting geometries onto the model of your workspaces, which yields the latent vectors that represent their coordinates in the latent space of the model.

Directory#

class GeomAIProjectionDirectory#

Provides a collection of methods related to GeomAI projections.

This class is accessed through client.geomai.projections.

Example

import ansys.simai.core as asc

simai_client = asc.from_config()
simai_client.geomai.projections.list()
delete(projection: GeomAIProjection | str) → None#

Delete a specific GeomAI projection from the server.

Parameters:

projection (GeomAIProjection | str) – ID or model of the projection.

Raises:

NotFoundError – No projection with the given ID exists.

get(id: str) → GeomAIProjection#

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

Parameters:

id (str) – ID of the projection.

Returns:

GeomAIProjection instance with the given ID if it exists.

Raises:

NotFoundError – No projection with the given ID exists.

Return type:

GeomAIProjection

list(workspace: GeomAIWorkspace | str | None = None, geometry: GeomAIGeometry | str | None = None) → List[GeomAIProjection]#

List the projections associated with the model of the specified workspace, or of the configured workspace if none is specified.

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

  • geometry (GeomAIGeometry | str | None) – Optional ID or model of a geometry to restrict the listing to.

Returns:

List of the matching GeomAIProjection objects.

Return type:

List[GeomAIProjection]

run(geometry: GeomAIGeometry | str, workspace: GeomAIWorkspace | str | None = None) → GeomAIProjection#

Project a geometry onto the model of the given workspace.

Parameters:
Returns:

The created or existing GeomAIProjection object.

Return type:

GeomAIProjection

Example

import ansys.simai.core as asc

simai_client = asc.from_config()
workspace = simai_client.geomai.workspaces.get(name="my-workspace")
geometry = simai_client.geomai.geometries.upload("my_geometry.vtp")
geometry.wait()

projection = simai_client.geomai.projections.run(geometry, workspace)
projection.wait()
print(projection.get_latent_parameters())

Model#

class GeomAIProjection#

Provides the local representation of a GeomAI projection object.

delete() → None#

Delete the projection from the server.

get_latent_parameters(n: int | None = None) → List[float] | None#

Get the coordinates of the geometry in the latent space of the model.

By default, latent parameters are ordered by importance: the first ones capture the largest sources of variation in the geometry , while later ones capture increasingly finer details.

Parameters:

n (int | None) – Optional number of latent parameters to retrieve, that is the length of the returned vector. If None, all latent parameters are returned. Must not exceed the number of latent parameters used for model training.

Returns:

The latent parameters of the geometry, truncated to its first n values if n is provided. None until the projection has finished successfully, or if the projection failed.

Raises:

InvalidArguments – If n exceeds the number of latent parameters used for model training. Note that this check can only be performed once the projection has finished successfully; while the latent parameters is None, n is not validated.

Return type:

List[float] | None

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 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_id: str#

ID of the projected geometry.

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 workspace_id: str#

ID of the workspace whose model the geometry was projected onto.