luminarycloud 0.19.1__py3-none-any.whl → 0.21.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- luminarycloud/__init__.py +2 -0
- luminarycloud/_client/client.py +2 -0
- luminarycloud/_helpers/_wait_for_mesh.py +6 -5
- luminarycloud/_helpers/_wait_for_simulation.py +3 -3
- luminarycloud/_helpers/pagination.py +62 -0
- luminarycloud/_helpers/upload.py +3 -6
- luminarycloud/_proto/api/v0/luminarycloud/geometry/geometry_pb2.py +168 -124
- luminarycloud/_proto/api/v0/luminarycloud/geometry/geometry_pb2.pyi +125 -3
- luminarycloud/_proto/api/v0/luminarycloud/geometry/geometry_pb2_grpc.py +66 -0
- luminarycloud/_proto/api/v0/luminarycloud/geometry/geometry_pb2_grpc.pyi +20 -0
- luminarycloud/_proto/api/v0/luminarycloud/inference/inference_pb2.py +8 -8
- luminarycloud/_proto/api/v0/luminarycloud/inference/inference_pb2.pyi +5 -5
- luminarycloud/_proto/api/v0/luminarycloud/vis/vis_pb2.py +124 -27
- luminarycloud/_proto/api/v0/luminarycloud/vis/vis_pb2.pyi +177 -0
- luminarycloud/_proto/api/v0/luminarycloud/vis/vis_pb2_grpc.py +99 -0
- luminarycloud/_proto/api/v0/luminarycloud/vis/vis_pb2_grpc.pyi +30 -0
- luminarycloud/_proto/assistant/assistant_pb2.py +61 -41
- luminarycloud/_proto/assistant/assistant_pb2.pyi +43 -1
- luminarycloud/_proto/assistant/assistant_pb2_grpc.py +33 -0
- luminarycloud/_proto/assistant/assistant_pb2_grpc.pyi +10 -0
- luminarycloud/_proto/base/base_pb2.py +9 -6
- luminarycloud/_proto/base/base_pb2.pyi +12 -0
- luminarycloud/_proto/client/simulation_pb2.py +490 -348
- luminarycloud/_proto/client/simulation_pb2.pyi +570 -8
- luminarycloud/_proto/inferenceservice/inferenceservice_pb2.py +10 -10
- luminarycloud/_proto/inferenceservice/inferenceservice_pb2.pyi +5 -5
- luminarycloud/_proto/quantity/quantity_pb2.py +24 -15
- luminarycloud/_proto/quantity/quantity_pb2.pyi +10 -4
- luminarycloud/enum/__init__.py +1 -0
- luminarycloud/enum/quantity_type.py +9 -0
- luminarycloud/enum/vis_enums.py +23 -3
- luminarycloud/exceptions.py +7 -1
- luminarycloud/geometry.py +44 -2
- luminarycloud/geometry_version.py +57 -3
- luminarycloud/mesh.py +1 -2
- luminarycloud/params/enum/_enum_wrappers.py +537 -30
- luminarycloud/params/simulation/adaptive_mesh_refinement_.py +4 -0
- luminarycloud/params/simulation/physics/__init__.py +0 -1
- luminarycloud/params/simulation/physics/periodic_pair_.py +12 -31
- luminarycloud/physics_ai/architectures.py +5 -5
- luminarycloud/physics_ai/inference.py +13 -13
- luminarycloud/pipelines/__init__.py +8 -0
- luminarycloud/pipelines/api.py +160 -10
- luminarycloud/pipelines/arguments.py +15 -0
- luminarycloud/pipelines/operators.py +74 -17
- luminarycloud/project.py +5 -44
- luminarycloud/simulation.py +10 -5
- luminarycloud/simulation_param.py +0 -9
- luminarycloud/vis/__init__.py +17 -0
- luminarycloud/vis/data_extraction.py +20 -4
- luminarycloud/vis/interactive_report.py +110 -0
- luminarycloud/vis/interactive_scene.py +29 -2
- luminarycloud/vis/report.py +252 -0
- luminarycloud/vis/visualization.py +127 -5
- luminarycloud/volume_selection.py +58 -9
- {luminarycloud-0.19.1.dist-info → luminarycloud-0.21.0.dist-info}/METADATA +1 -1
- {luminarycloud-0.19.1.dist-info → luminarycloud-0.21.0.dist-info}/RECORD +58 -60
- luminarycloud/params/simulation/physics/periodic_pair/__init__.py +0 -2
- luminarycloud/params/simulation/physics/periodic_pair/periodicity_type/__init__.py +0 -2
- luminarycloud/params/simulation/physics/periodic_pair/periodicity_type/rotational_periodicity_.py +0 -31
- luminarycloud/params/simulation/physics/periodic_pair/periodicity_type/translational_periodicity_.py +0 -29
- luminarycloud/params/simulation/physics/periodic_pair/periodicity_type_.py +0 -25
- {luminarycloud-0.19.1.dist-info → luminarycloud-0.21.0.dist-info}/WHEEL +0 -0
luminarycloud/exceptions.py
CHANGED
|
@@ -22,6 +22,12 @@ class SDKException(Exception):
|
|
|
22
22
|
return [self.message]
|
|
23
23
|
|
|
24
24
|
|
|
25
|
+
class Timeout(SDKException):
|
|
26
|
+
"""Raised when some long-running operation doesn't finish before its deadline."""
|
|
27
|
+
|
|
28
|
+
pass
|
|
29
|
+
|
|
30
|
+
|
|
25
31
|
class RpcError(SDKException):
|
|
26
32
|
"""Raised when an RPC error occurs."""
|
|
27
33
|
|
|
@@ -70,6 +76,6 @@ class FailedPreconditionError(RpcError):
|
|
|
70
76
|
|
|
71
77
|
|
|
72
78
|
class DeadlineExceededError(RpcError):
|
|
73
|
-
"""Raised when the deadline expired before the operation could complete. I.e. it timed out."""
|
|
79
|
+
"""Raised when the gRPC deadline expired before the operation could complete. I.e. it timed out."""
|
|
74
80
|
|
|
75
81
|
pass
|
luminarycloud/geometry.py
CHANGED
|
@@ -29,7 +29,7 @@ from .named_variable_set import NamedVariableSet, get_named_variable_set
|
|
|
29
29
|
|
|
30
30
|
if TYPE_CHECKING:
|
|
31
31
|
from .project import Project
|
|
32
|
-
from .geometry_version import GeometryVersion
|
|
32
|
+
from .geometry_version import GeometryVersion, GeometryVersionIterator
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
@ProtoWrapper(geometrypb.Geometry)
|
|
@@ -42,6 +42,8 @@ class Geometry(ProtoWrapperBase):
|
|
|
42
42
|
"Geometry name."
|
|
43
43
|
status: GeometryStatus
|
|
44
44
|
"The status of the geometry."
|
|
45
|
+
project_id: ProjectID
|
|
46
|
+
"The ID of the project this geometry belongs to."
|
|
45
47
|
|
|
46
48
|
_proto: geometrypb.Geometry
|
|
47
49
|
|
|
@@ -63,7 +65,7 @@ class Geometry(ProtoWrapperBase):
|
|
|
63
65
|
"""
|
|
64
66
|
Get the project this geometry belongs to.
|
|
65
67
|
"""
|
|
66
|
-
return lc.get_project(
|
|
68
|
+
return lc.get_project(self.project_id)
|
|
67
69
|
|
|
68
70
|
def update(self, *, name: str | None = None) -> None:
|
|
69
71
|
"""
|
|
@@ -290,6 +292,46 @@ class Geometry(ProtoWrapperBase):
|
|
|
290
292
|
)
|
|
291
293
|
)
|
|
292
294
|
|
|
295
|
+
def versions(self, unfiltered: bool = False, page_size: int = 50) -> "GeometryVersionIterator":
|
|
296
|
+
"""
|
|
297
|
+
List the geometry versions for this geometry in chronological order, oldest first.
|
|
298
|
+
|
|
299
|
+
By default, this only returns versions that are named OR have an associated Mesh OR are the
|
|
300
|
+
latest version of the geometry. If `unfiltered` is true, this returns all versions.
|
|
301
|
+
|
|
302
|
+
The geometry versions are fetched lazily in batches using pagination to optimize memory
|
|
303
|
+
usage and API calls.
|
|
304
|
+
|
|
305
|
+
Parameters
|
|
306
|
+
----------
|
|
307
|
+
unfiltered : bool, optional
|
|
308
|
+
If True, returns all versions. If False, returns only versions that are named OR have an
|
|
309
|
+
associated Mesh OR are the latest version of the geometry. Defaults to False.
|
|
310
|
+
page_size : int, optional
|
|
311
|
+
Number of geometry versions to fetch per page. Defaults to 50, max is 500.
|
|
312
|
+
|
|
313
|
+
Returns
|
|
314
|
+
-------
|
|
315
|
+
GeometryVersionIterator
|
|
316
|
+
An iterator that yields GeometryVersion objects one at a time.
|
|
317
|
+
|
|
318
|
+
Examples
|
|
319
|
+
--------
|
|
320
|
+
Fetch the versions of this geometry with default filtering applied.
|
|
321
|
+
>>> for version in geometry.versions():
|
|
322
|
+
... print(version.id, version.name)
|
|
323
|
+
|
|
324
|
+
Fetch all versions of the geometry.
|
|
325
|
+
>>> for version in geometry.versions(unfiltered=True):
|
|
326
|
+
... print(version.id, version.name)
|
|
327
|
+
|
|
328
|
+
Build a list of versions of this geometry that have the name "So Important".
|
|
329
|
+
>>> important_versions = [ver for ver in geometry.versions() if ver.name == "So Important"]
|
|
330
|
+
"""
|
|
331
|
+
from .geometry_version import GeometryVersionIterator
|
|
332
|
+
|
|
333
|
+
return GeometryVersionIterator(self.id, unfiltered, page_size)
|
|
334
|
+
|
|
293
335
|
def latest_version(self) -> GeometryVersion:
|
|
294
336
|
"""
|
|
295
337
|
Get the latest version of the geometry.
|
|
@@ -3,6 +3,7 @@ from datetime import datetime
|
|
|
3
3
|
|
|
4
4
|
from ._client import get_default_client
|
|
5
5
|
from ._helpers._timestamp_to_datetime import timestamp_to_datetime
|
|
6
|
+
from ._helpers.pagination import PaginationIterator
|
|
6
7
|
from ._proto.api.v0.luminarycloud.geometry import geometry_pb2 as geometrypb
|
|
7
8
|
from ._proto.geometry import geometry_pb2 as gpb
|
|
8
9
|
from ._wrapper import ProtoWrapper, ProtoWrapperBase
|
|
@@ -87,7 +88,7 @@ class GeometryVersion(ProtoWrapperBase):
|
|
|
87
88
|
]
|
|
88
89
|
return surfaces, volumes
|
|
89
90
|
|
|
90
|
-
def copy_to_new_geometry(self, name: str = "") -> Geometry:
|
|
91
|
+
def copy_to_new_geometry(self, name: str = "", request_id: str = "") -> Geometry:
|
|
91
92
|
"""
|
|
92
93
|
Copy this GeometryVersion and create a new Geometry containing only that newly copied version.
|
|
93
94
|
|
|
@@ -95,6 +96,11 @@ class GeometryVersion(ProtoWrapperBase):
|
|
|
95
96
|
----------
|
|
96
97
|
name : str, optional
|
|
97
98
|
The name of the new Geometry. If not provided, a default name will be used.
|
|
99
|
+
request_id : str, optional
|
|
100
|
+
A deduplication key, useful for idempotency. The first time copy_to_new_geometry() is
|
|
101
|
+
called with a given request_id, a new geometry will be created. Subsequent calls with
|
|
102
|
+
the same request_id will return the same geometry. If not provided, no deduplication is
|
|
103
|
+
done. Max length: 256 characters.
|
|
98
104
|
|
|
99
105
|
Returns
|
|
100
106
|
-------
|
|
@@ -104,6 +110,7 @@ class GeometryVersion(ProtoWrapperBase):
|
|
|
104
110
|
req = geometrypb.CopyGeometryFromVersionRequest(
|
|
105
111
|
geometry_version_id=self.id,
|
|
106
112
|
name=name,
|
|
113
|
+
request_id=request_id,
|
|
107
114
|
)
|
|
108
115
|
res: geometrypb.CopyGeometryFromVersionResponse = (
|
|
109
116
|
get_default_client().CopyGeometryFromVersion(req)
|
|
@@ -173,14 +180,39 @@ class GeometryVersion(ProtoWrapperBase):
|
|
|
173
180
|
return res.sdk_code
|
|
174
181
|
|
|
175
182
|
|
|
183
|
+
class GeometryVersionIterator(PaginationIterator[GeometryVersion]):
|
|
184
|
+
"""Iterator class for geometry versions that provides length hint."""
|
|
185
|
+
|
|
186
|
+
def __init__(self, geometry_id: str, unfiltered: bool, page_size: int):
|
|
187
|
+
super().__init__(page_size)
|
|
188
|
+
self._geometry_id: str = geometry_id
|
|
189
|
+
self._unfiltered: bool = unfiltered
|
|
190
|
+
|
|
191
|
+
def _fetch_page(
|
|
192
|
+
self, page_size: int, page_token: str
|
|
193
|
+
) -> tuple[list[GeometryVersion], str, int]:
|
|
194
|
+
req = geometrypb.ListGeometryVersionsRequest(
|
|
195
|
+
page_size=page_size,
|
|
196
|
+
page_token=page_token,
|
|
197
|
+
geometry_id=self._geometry_id,
|
|
198
|
+
unfiltered=self._unfiltered,
|
|
199
|
+
)
|
|
200
|
+
res = self._client.ListGeometryVersions(req)
|
|
201
|
+
return (
|
|
202
|
+
[GeometryVersion(gv) for gv in res.geometry_versions],
|
|
203
|
+
res.next_page_token,
|
|
204
|
+
res.total_count,
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
|
|
176
208
|
def get_geometry_version(id: str) -> GeometryVersion:
|
|
177
209
|
"""
|
|
178
|
-
Get a
|
|
210
|
+
Get a geometry version by its ID.
|
|
179
211
|
|
|
180
212
|
Parameters
|
|
181
213
|
----------
|
|
182
214
|
id : str
|
|
183
|
-
|
|
215
|
+
ID of the geometry version to get.
|
|
184
216
|
|
|
185
217
|
Returns
|
|
186
218
|
-------
|
|
@@ -191,3 +223,25 @@ def get_geometry_version(id: str) -> GeometryVersion:
|
|
|
191
223
|
req = geometrypb.GetGeometryVersionRequest(geometry_version_id=id)
|
|
192
224
|
res: geometrypb.GetGeometryVersionResponse = get_default_client().GetGeometryVersion(req)
|
|
193
225
|
return GeometryVersion(res.geometry_version)
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
def update_geometry_version(id: str, name: str) -> GeometryVersion:
|
|
229
|
+
"""
|
|
230
|
+
Update a geometry version.
|
|
231
|
+
|
|
232
|
+
Parameters
|
|
233
|
+
----------
|
|
234
|
+
id : str
|
|
235
|
+
ID of the geometry version to update.
|
|
236
|
+
name : str
|
|
237
|
+
The new name for the geometry version. Pass an empty string to clear the name.
|
|
238
|
+
|
|
239
|
+
Returns
|
|
240
|
+
-------
|
|
241
|
+
GeometryVersion
|
|
242
|
+
The updated GeometryVersion.
|
|
243
|
+
"""
|
|
244
|
+
|
|
245
|
+
req = geometrypb.UpdateGeometryVersionRequest(geometry_version_id=id, name=name)
|
|
246
|
+
res: geometrypb.UpdateGeometryVersionResponse = get_default_client().UpdateGeometryVersion(req)
|
|
247
|
+
return GeometryVersion(res.geometry_version)
|
luminarycloud/mesh.py
CHANGED
|
@@ -106,8 +106,7 @@ class Mesh(ProtoWrapperBase):
|
|
|
106
106
|
interval_seconds=interval_seconds,
|
|
107
107
|
timeout_seconds=timeout_seconds,
|
|
108
108
|
)
|
|
109
|
-
self.
|
|
110
|
-
return self.status
|
|
109
|
+
return self.refresh().status
|
|
111
110
|
|
|
112
111
|
def refresh(self) -> "Mesh":
|
|
113
112
|
"""
|