Visualization¶
Matplotlib plotting helpers that operate on numpy arrays. Pair them with rddac.open_h5 to read the input arrays from a single experiment. See the Visualization tutorial for end to end examples.
import rddac
with rddac.open_h5(0) as f:
z = f["pointcloud/op10/z"][:]
lumi = f["pointcloud/op10/luminescence"][:]
force = f["force/data"][:]
ax, cbar = rddac.plot_scan(z) # heightmap image
pts = rddac.scan_to_pointcloud(z, lumi) # flat buffer -> (N, 3)
ax, cbar = rddac.plot_point_cloud(pts)
ax = rddac.plot_force(force) # force time series
Functions¶
plot_scan(z, ax=None, figsize=None, x_shape=SCAN_X_SHAPE, y_shape=SCAN_Y_SHAPE, cmap='viridis', vmin=None, vmax=None, mask_zero=True, colorbar=True, title=None)
¶
Show a raw laser scan buffer (height or luminescence) as a 2D image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
ndarray
|
Flat |
required |
ax
|
Optional existing matplotlib Axes. |
None
|
|
figsize
|
tuple[float, float] | None
|
Figure size when a new figure is created. |
None
|
x_shape / y_shape
|
Grid dimensions (defaults match the group attrs). |
required | |
cmap
|
str
|
Matplotlib colormap name. |
'viridis'
|
vmin / vmax
|
Color range; defaults to the data range of valid pixels. |
required | |
mask_zero
|
bool
|
Render 0-valued pixels (no measurement) as transparent. |
True
|
colorbar
|
bool
|
Attach a colorbar. |
True
|
title
|
str | None
|
Optional axes title. |
None
|
Returns:
| Type | Description |
|---|---|
|
|
Source code in rddac/visualization.py
scan_to_pointcloud(z, luminescence=None, x_shape=SCAN_X_SHAPE, y_shape=SCAN_Y_SHAPE, drop_invalid=True, stride=1)
¶
Convert a flat scan buffer into an (N, 3) point cloud [x, y, z].
Coordinates are pixel indices and raw z units (uncalibrated); the mm conversion, outlier removal and simulation alignment belong to the (optional) preprocessing step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
ndarray
|
Flat or 2D height buffer. |
required |
luminescence
|
ndarray | None
|
Optional matching buffer; when given, pixels with zero luminescence are treated as invalid too. |
None
|
x_shape / y_shape
|
Grid dimensions. |
required | |
drop_invalid
|
bool
|
Drop pixels with |
True
|
stride
|
int
|
Keep every |
1
|
Returns:
| Type | Description |
|---|---|
ndarray
|
|
Source code in rddac/visualization.py
plot_point_cloud(points, values=None, ax=None, figsize=None, cmap='viridis', vmin=None, vmax=None, point_size=1.0, max_points=200000, colorbar=True, title=None)
¶
Scatter an (N, 3) point cloud in 3D, optionally colored by values.
Signature mirrors ddacs.plot_point_cloud so DDACS code ports by
swapping the import. Use :func:scan_to_pointcloud to build points
from a raw scan buffer, or plot processed clouds directly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
ndarray
|
|
required |
values
|
ndarray | None
|
Optional per-point scalars for coloring (default: z). |
None
|
ax
|
Optional existing 3D Axes. |
None
|
|
figsize
|
tuple[float, float] | None
|
Figure size when a new figure is created. |
None
|
cmap / vmin / vmax
|
Color mapping. |
required | |
point_size
|
float
|
Scatter marker size. |
1.0
|
max_points
|
int | None
|
Random-subsample cap ( |
200000
|
colorbar
|
bool
|
Attach a colorbar. |
True
|
title
|
str | None
|
Optional axes title. |
None
|
Returns:
| Type | Description |
|---|---|
|
|
Source code in rddac/visualization.py
plot_force(force, columns=FORCE_COLUMNS, signals=('load_cell_1', 'load_cell_2', 'load_cell_3', 'load_cell_4', 'total_force'), ax=None, figsize=None, title=None)
¶
Plot press force / process signals over time from a force/data table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
force
|
ndarray
|
|
required |
columns
|
tuple[str, ...]
|
Column layout (defaults to the raw layout; pass the h5 group's
|
FORCE_COLUMNS
|
signals
|
tuple[str, ...]
|
Which columns to draw against |
('load_cell_1', 'load_cell_2', 'load_cell_3', 'load_cell_4', 'total_force')
|
ax
|
Optional existing Axes. |
None
|
|
figsize
|
tuple[float, float] | None
|
Figure size when a new figure is created. |
None
|
title
|
str | None
|
Optional axes title. |
None
|
Returns:
| Type | Description |
|---|---|
|
The matplotlib Axes. |
Source code in rddac/visualization.py
plot_traverse(data, ax=None, figsize=None, ylabel='value', label=None, title=None)
¶
Plot a sensor traverse table (sheet_thickness/data or oil_thickness/data).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
ndarray
|
|
required |
ax
|
Optional existing Axes. |
None
|
|
figsize
|
tuple[float, float] | None
|
Figure size when a new figure is created. |
None
|
ylabel
|
str
|
Y axis label (e.g. |
'value'
|
label
|
str | None
|
Optional line label (for overlaying multiple traverses). |
None
|
title
|
str | None
|
Optional axes title. |
None
|
Returns:
| Type | Description |
|---|---|
|
The matplotlib Axes. |