visualdynamics.viz.sensors¶
sensors
¶
Sensor bodies drawn at their nodes: one mesh for every sensor a
channel table places (core.sensors.place), so a model with hundreds of
sensors is one actor rather than hundreds.
Each body is built about its own origin from its catalog size, turned into its frame and moved to its node, which is therefore the body's center. A triax's X, Y and Z faces carry their letters in black, as the sensors do; a uniaxial accelerometer or a force transducer carries a black arrow on each side along its sensing axis, pointing the positive way. The body is gray, the connector and the cable darker.
Bodies are true size where the geometry's units are defined. Where they
are not, a millimeter cannot be placed, and the bodies are drawn at a
size proportional to the model's instead. size multiplies either,
about the node, so the node stays at the center.
The points are a VTK buffer of their own with a writable view, so an
animation moves the bodies with their nodes by one write per frame
(GeometryAnimator.follow).
Classes:
| Name | Description |
|---|---|
SensorMesh |
The sensors' mesh, and what an animation needs to move it. |
Functions:
| Name | Description |
|---|---|
body |
A sensor's body in its own frame, in millimeters, centered on the |
sensor_mesh |
One mesh of every sensor's body at its node, in display units. |
add_sensors |
Draw the sensors a channel table places on a geometry. |
Classes¶
SensorMesh
dataclass
¶
SensorMesh(mesh: Any, node_rows: ndarray, base: ndarray, points: Any, view: ndarray, sensors: list = list(), notes: list = list())
The sensors' mesh, and what an animation needs to move it.
node_rows is the geometry's node row of every point, base the
points as drawn with every node at rest, and points and view the
VTK buffer the mesh is drawn from and a writable view of it.
Functions:¶
body
¶
body(entry: SensorModel, marks: bool = True)
A sensor's body in its own frame, in millimeters, centered on the
origin: (points, triangles, parts), where a triangle's part is
'body', 'connector' (the plug and a force transducer's studs),
'cable', or a mark on the body: 'mark:X', 'mark:Y' and 'mark:Z' for
a triax's letters, 'mark:shaft' and 'mark:head' for the arrow of a
uniaxial accelerometer or a force transducer, left out when
marks is False.
Source code in src/visualdynamics/viz/sensors.py
sensor_mesh
¶
sensor_mesh(sensors: list[Sensor], geometry: Geometry, unit_system: UnitSystem | None = None, size: float = 1.0) -> SensorMesh | None
One mesh of every sensor's body at its node, in display units.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sensors
|
list of Sensor
|
From |
required |
geometry
|
Geometry
|
The geometry they are placed on. |
required |
unit_system
|
UnitSystem
|
The display units; the default system when omitted. |
None
|
size
|
float
|
A multiple of true size (or of the proportional size, when the geometry's units are not defined), about each node. |
1.0
|
Returns:
| Type | Description |
|---|---|
SensorMesh or None
|
None when there are no sensors. |
Source code in src/visualdynamics/viz/sensors.py
add_sensors
¶
add_sensors(plotter: Any, geometry: Geometry, table: ChannelTable, unit_system: UnitSystem | None = None, size: float = 1.0, name: str = 'sensors') -> tuple[SensorMesh | None, list[str]]
Draw the sensors a channel table places on a geometry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plotter
|
Plotter
|
Where they are drawn, as one actor named |
required |
geometry
|
Geometry
|
The geometry the table's nodes are in. |
required |
table
|
ChannelTable
|
The channels. |
required |
unit_system
|
UnitSystem
|
The display units. |
None
|
size
|
float
|
A multiple of true size, about each node. |
1.0
|
name
|
str
|
The actor's name, so a redraw replaces it. |
'sensors'
|
Returns:
| Name | Type | Description |
|---|---|---|
mesh |
SensorMesh or None
|
What was drawn, for an animation to move; None when the table places no sensor on the geometry. |
notes |
list of str
|
What the placement and the drawing say about it. |