luminarycloud.vis¶
Classes¶
This class defines a box used for filter such as box clip. |
|
Clip the dataset using a box. Cells inside the box are kept while cells completely outside the |
|
Directional camera options |
|
The type of projection used in the camera. |
|
The color map allows user control over how field values are mapped to |
|
Predefined color map presets. |
|
Predefined color map presets. |
|
The data range represents a range of values. Ranges are only valid if the |
|
Class defining a directional camera for visualization. Directional |
|
Display attributes specify how objects such as meshes, geometries, and |
|
An enum for specifying the source of an image. When listing extracts, |
|
An enum for specifying the source of an image. When listing extracts, |
|
The field controls the field displayed on the object. If the field doesn't |
|
Specifies which component of a field is used for visualization. |
|
Specifies which component of a field is used for visualization. |
|
Vector Glyphs is a vector field visualization techique that places arrows (e.g., glyphs), |
|
The image extract represents the request to extract an image from some data. |
|
Represents the status of an image request. |
|
Class defining a look at camera for visualization. Unlike the directional |
|
This class defines a plane. |
|
Clip the dataset using a plane. Cells in the direction of the plane normal |
|
The representation defines how objects will appear in the scene. |
|
The representation defines how objects will appear in the scene. |
|
Vector Glyphs is a vector field visualization techique that places arrows |
|
The scene class is the base for any visualization. The scene is constructed |
|
The slice filter is used to extract a cross-section of a 3D dataset by |
|
Represents a 3-dimensional vector. |
|
The visualization quantity. This is a subset of all quantities. |
Functions¶
|
Lists all previously created image associated with a project and an entity. |
Package Contents¶
- class luminarycloud.vis.Box¶
This class defines a box used for filter such as box clip. .. warning:: This feature is experimental and may change or be removed in the future.
- angles: luminarycloud.types.Vector3¶
- center: luminarycloud.types.Vector3¶
- lengths: luminarycloud.types.Vector3¶
- class luminarycloud.vis.BoxClip(name: str)¶
Bases:
Filter
Clip the dataset using a box. Cells inside the box are kept while cells completely outside the box are removed.
Warning
This feature is experimental and may change or be removed in the future.
- display_attrs¶
- id = 'clip-'¶
- inverted: bool = True¶
- name¶
- class luminarycloud.vis.CameraDirection¶
Bases:
enum.IntEnum
Directional camera options
- Attributes:
- X_POSITIVE
Look down the positive x-axis
- Y_POSITIVE
Look down the positive y-axis
- Z_POSITIVE
Look down the positive z-axis
- X_NEGATIVE
Look down the negative x-axis
- Y_NEGATIVE
Look down the negative y-axis
- Z_NEGATIVE
Look down the negative z-axis
- X_NEGATIVE¶
- X_POSITIVE¶
- Y_NEGATIVE¶
- Y_POSITIVE¶
- Z_NEGATIVE¶
- Z_POSITIVE¶
- class luminarycloud.vis.CameraProjection¶
Bases:
enum.IntEnum
The type of projection used in the camera.
- Attributes:
- ORTHOGRAPHIC
A orthographic (i.e., parallel) projection.
- PERSPECTIVE
A perspective projection.
- ORTHOGRAPHIC¶
- PERSPECTIVE¶
- class luminarycloud.vis.ColorMap¶
The color map allows user control over how field values are mapped to colors. Color maps are assigned to fields (e.g., the quantity and component) and not individual display attributes. This means that there can only ever be one color map per field/component combination (e.g., velocity-magnitude or velocity-x). Any display attribute in the scene (i.e., filter display attributes or global display attributes) that maps to this color map will be color in the same manner.
Warning
This feature is experimental and may change or be removed in the future.
- Attributes:
- fieldField
The field and component this color map applies to.
- presetColorMapPreset
The color map preset to use. This defines the colors used in the color map. Default is ‘JET’.
- data_rangeDataRange
An optional data range to use for the color map. The user must explicity set the data ranges. If not set explicitly, the fields global data range is used. For comparing multiple results, either with different solutions in the same simulation or with different simulations, its highly recommended that a range is provided so the color scales are the same between the resulting images. Default: is an invalid data range.
- discretizebool
Use discrete color bins instead of a continuous range. When True, ‘n_colors’ indicates how many discrete bins to use. Default: False.
- n_colorsint
How many discrete bins to use when discretize is True. Valid n_colors values are [1, 256]. Default: 8.
- discretize: bool = False¶
- n_colors: int = 8¶
- preset: luminarycloud.enum.vis_enums.ColorMapPreset¶
- class luminarycloud.vis.ColorMapPreset¶
Bases:
enum.IntEnum
Predefined color map presets.
- COOL_TO_WARM¶
- JET¶
- TURBO¶
- VIRIDIS¶
- WAVE¶
- XRAY¶
- class luminarycloud.vis.ColorMapPreset¶
Bases:
enum.IntEnum
Predefined color map presets.
- COOL_TO_WARM¶
- JET¶
- TURBO¶
- VIRIDIS¶
- WAVE¶
- XRAY¶
- class luminarycloud.vis.DataRange¶
The data range represents a range of values. Ranges are only valid if the max value is greater than the or equal to the min_value. The default is invalid.
Warning
This feature is experimental and may change or be removed in the future.
- is_valid() bool ¶
- max_value: float¶
- min_value: float¶
- class luminarycloud.vis.DirectionalCamera¶
Class defining a directional camera for visualization. Directional camera are oriented around the visible objects in the scene and will always face towards the scene.
Warning
This feature is experimental and may change or be removed in the future.
- direction: luminarycloud.enum.vis_enums.CameraDirection¶
- name: str = 'default directional camera'¶
- projection: luminarycloud.enum.vis_enums.CameraProjection¶
- class luminarycloud.vis.DisplayAttributes¶
Display attributes specify how objects such as meshes, geometries, and filters appear in the scene.
Warning
This feature is experimental and may change or be removed in the future.
Attributes:¶
- visiblebool
If the object is visible or not. Default: True
- opacityfloat
How opaque the object is. This is a normalized number between 0 (i.e., fully transparent) and 1 (i.e., fully opaque). Default: 1
- fieldField
What field quantity/component to color by, if applicable.
- representationRepresentation
how the object is represented in the scene (e.g., surface, surface with edges, wireframe or points). Default: surface.
- opacity: float = 1.0¶
- representation: luminarycloud.enum.vis_enums.Representation¶
- visible: bool = True¶
- class luminarycloud.vis.EntityType¶
Bases:
enum.IntEnum
An enum for specifying the source of an image. When listing extracts, the user must specify what type of extract they are interested in. This enum is only used by the visualization code.
Warning
This feature is experimental and may change or be removed in the future.
- Attributes:
- SIMULATION
Specifies a similuation entity (i.e., a result).
- MESH
Specifies a mesh entity.
- GEOMETRY
Specifies a geometry entity.
- GEOMETRY = 2¶
- MESH = 1¶
- SIMULATION = 0¶
- class luminarycloud.vis.EntityType¶
Bases:
enum.IntEnum
An enum for specifying the source of an image. When listing extracts, the user must specify what type of extract they are interested in. This enum is only used by the visualization code.
Warning
This feature is experimental and may change or be removed in the future.
- Attributes:
- SIMULATION
Specifies a similuation entity (i.e., a result).
- MESH
Specifies a mesh entity.
- GEOMETRY
Specifies a geometry entity.
- GEOMETRY = 2¶
- MESH = 1¶
- SIMULATION = 0¶
- class luminarycloud.vis.Field¶
The field controls the field displayed on the object. If the field doesn’t exist, we show a solid color.
Warning
This feature is experimental and may change or be removed in the future.
- component: luminarycloud.enum.vis_enums.FieldComponent¶
- quantity: luminarycloud.enum.vis_enums.VisQuantity¶
- class luminarycloud.vis.FieldComponent¶
Bases:
enum.IntEnum
Specifies which component of a field is used for visualization. When using scalars, the X component is the only valid component.
Warning
This feature is experimental and may change or be removed in the future.
- MAGNITUDE¶
- X¶
- Y¶
- Z¶
- class luminarycloud.vis.FieldComponent¶
Bases:
enum.IntEnum
Specifies which component of a field is used for visualization. When using scalars, the X component is the only valid component.
Warning
This feature is experimental and may change or be removed in the future.
- MAGNITUDE¶
- X¶
- Y¶
- Z¶
- class luminarycloud.vis.FixedSizeVectorGlyphs(name: str)¶
Bases:
VectorGlyphs
Vector Glyphs is a vector field visualization techique that places arrows (e.g., glyphs), in the 3D scene that are oriented in the direction of the underlying vector field. Fixed size vector glyhs places vector annotations at sampled points in meshes that are a fixed size. This filter is only valid on vector fields. .. warning:: This feature is experimental and may change or be removed in the future.
- display_attrs¶
- field: luminarycloud.vis.display.Field¶
- id: str = 'vector-'¶
- name: str¶
- property sampling_rate: int¶
- size: float = 1.0¶
- class luminarycloud.vis.ImageExtract(extract_id: str, project_id: str, name: str, desciption: str, status: luminarycloud.enum.vis_enums.ImageStatusType)¶
The image extract represents the request to extract an image from some data. The operation exectutes asyncronously, so the caller must check the status of the image extract. If the status is completed, then the resuling image is available for download.
Warning
This feature is experimental and may change or be removed in the future.
- delete() None ¶
Delete the image.
- download_image() io.BytesIO ¶
Downloads the resulting jpeg image as a binary buffer. This is useful for displaying images in notebooks. If that status is not complete, an error will be raised.
Warning
This feature is experimental and may change or be removed in the future.
- refresh() ImageExtract ¶
Refesh the status of the ImageExtract.
- Returns:
- self
- save_image(file_name: str) None ¶
Download and save resulting image to the file system. If that status is not complete, an error will be raised.
Warning
This feature is experimental and may change or be removed in the future.
- Parameters:
- file_name: str, required
The file name to save the image to. ‘.jpg’ will be appended to the file name.
- wait(interval_seconds: float = 5, timeout_seconds: float = float('inf')) luminarycloud.enum.vis_enums.ImageStatusType ¶
Wait until the ImageExtract is completed or failed.
- Parameters:
- intervalfloat, optional
Number of seconds between polls.
- timeoutfloat, optional
Number of seconds before timeout.
- Returns:
- ImageStatusType: Current status of the image extract.
- description: str¶
- name: str¶
- status: luminarycloud.enum.vis_enums.ImageStatusType¶
- class luminarycloud.vis.ImageStatusType¶
Bases:
enum.IntEnum
Represents the status of an image request.
Warning
This feature is experimental and may change or be removed in the future.
- Attributes:
- ACTIVE
The request is currently active and being processed.
- COMPLETED
The request is complete.
- FAILED
The request has failed.
- INVALID
The request is invalid.
- ACTIVE¶
- COMPLETED¶
- FAILED¶
- INVALID¶
- class luminarycloud.vis.LookAtCamera¶
Class defining a look at camera for visualization. Unlike the directional camera which is placed relative to what is visisble, the the look at camera is an explict camera, meaning that we have to fully specify the parameters.
Warning
This feature is experimental and may change or be removed in the future.
- look_at: luminarycloud.types.Vector3¶
- name: str = 'default look at camera'¶
- position: luminarycloud.types.Vector3¶
- projection: luminarycloud.enum.vis_enums.CameraProjection¶
- class luminarycloud.vis.Plane¶
This class defines a plane.
Warning
This feature is experimental and may change or be removed in the future.
- normal: luminarycloud.types.Vector3¶
- origin: luminarycloud.types.Vector3¶
- class luminarycloud.vis.PlaneClip(name: str)¶
Bases:
Filter
Clip the dataset using a plane. Cells in the direction of the plane normal are kept, while the cells in the opposite direction are removed.
Warning
This feature is experimental and may change or be removed in the future.
- display_attrs¶
- id = 'clip-'¶
- inverted: bool = False¶
- name¶
- class luminarycloud.vis.Representation¶
Bases:
enum.IntEnum
The representation defines how objects will appear in the scene.
Warning
This feature is experimental and may change or be removed in the future.
- POINTS¶
- SURFACE¶
- SURFACE_WITH_EDGES¶
- WIREFRAME¶
- class luminarycloud.vis.Representation¶
Bases:
enum.IntEnum
The representation defines how objects will appear in the scene.
Warning
This feature is experimental and may change or be removed in the future.
- POINTS¶
- SURFACE¶
- SURFACE_WITH_EDGES¶
- WIREFRAME¶
- class luminarycloud.vis.ScaledVectorGlyphs(name: str)¶
Bases:
VectorGlyphs
Vector Glyphs is a vector field visualization techique that places arrows (e.g., glyphs), in the 3D scene that are oriented in the direction of the underlying vector field. Scaled vector glyphs changes the size of the arrows base on the magnitude of the vector. For example when visualizing the velocity field, a glyph where the magnitude is twice the magnitude of another glyph will appear twice as large. .. warning:: This feature is experimental and may change or be removed in the future.
- display_attrs¶
- field: luminarycloud.vis.display.Field¶
- id: str = 'vector-'¶
- name: str¶
- property sampling_rate: int¶
- scale: float = 1.0¶
- class luminarycloud.vis.Scene(project_id: str, entity: luminarycloud.geometry.Geometry | luminarycloud.solution.Solution | luminarycloud.mesh.Mesh)¶
The scene class is the base for any visualization. The scene is constructed with what “entity” you want to visualize: a solution, a mesh, or a geometry.
global display attributes: The global display attributes control the default appearance of all the surfaces (i.e. boundaries). Attributes include visibitiy, what fields are displayed on the surfaces (if applicable), and representation (e.g., surface, surface with edges, …).
Individaul surface visibities can be overidden to hide/show specific surfaces. Additionally, if the scene is contructed around a simulation, a helper method is provided to automatically hide surfaces associated with far fields.
Warning
This feature is experimental and may change or be removed in the future.
- add_color_map(color_map: luminarycloud.vis.display.ColorMap) None ¶
Add a color map to the scene. If a color map with the field already exists, it will be overwritten.
- add_filter(filter: luminarycloud.vis.filters.Filter) None ¶
Add a filter to the scene. Filters not currently supported with geometries and will raise an error if added.
- create_image(width: int, height: int, name: str, description: str) ImageExtract ¶
Create an image of the scene using the camera. Parameters ———- width : int
The width of the image.
- heightint
The height of the image.
- namestr
A short name for the image.
- descriptionstr
A longer description of the scene and image.
- hide_far_field() None ¶
Hide all far fields surfaces. Will work if the entity is a simulation.
- set_camera(camera: DirectionalCamera | LookAtCamera) None ¶
Set the scene’s camera.
- surface_ids() List[str] ¶
Get a list of all the surface ids associated with the mesh.
- surface_visibility(id: str, visible: bool) None ¶
Explicitly override the the visibility of a surface by id.
- global_display_attrs¶
- class luminarycloud.vis.Slice(name: str)¶
Bases:
Filter
The slice filter is used to extract a cross-section of a 3D dataset by slicing it with a plane.
Warning
This feature is experimental and may change or be removed in the future.
- display_attrs¶
- id = 'slice-'¶
- name¶
- property project_vectors: bool¶
- class luminarycloud.vis.Vector3¶
Represents a 3-dimensional vector.
- x: float = 0.0¶
- y: float = 0.0¶
- z: float = 0.0¶
- class luminarycloud.vis.VisQuantity¶
Bases:
enum.IntEnum
The visualization quantity. This is a subset of all quantities.
Warning
This feature is experimental and may change or be removed in the future.
- ABSOLUTE_PRESSURE¶
- DENSITY¶
- FRICTION_COEFFICIENT¶
- HEAT_FLUX¶
- MACH¶
- NONE¶
- PRESSURE¶
- PRESSURE_COEFFICIENT¶
- Q_CRITERION¶
- TEMPERATURE¶
- TOTAL_PRESSURE¶
- TOTAL_PRESSURE_COEFFICIENT¶
- TOTAL_TEMPREATURE¶
- VELOCITY¶
- WALL_SHEAR_STRESS¶
- luminarycloud.vis.list_images(project_id: str, entity: luminarycloud.geometry.Geometry | luminarycloud.mesh.Mesh | luminarycloud.solution.Solution) List[ImageExtract] ¶
Lists all previously created image associated with a project and an entity.
Warning
This feature is experimental and may change or be removed in the future.
- Parameters:
- project_idstr
The project id to query.
- entityGeometry | Mesh | Solution
Specifies what types of image extracts to list(e.g., geometry, mesh or solution).