server
Viser server setup utilities.
compute_grid_size(pos: np.ndarray | None, padding: float = 1.2, default_size: float = 10.0) -> float
¶
Compute grid size based on trajectory extent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pos
|
ndarray | None
|
Position array of shape (N, 3), or None if position is not available |
required |
padding
|
float
|
Padding factor (1.2 = 20% padding) |
1.2
|
default_size
|
float
|
Grid size when pos is None |
10.0
|
Returns:
| Type | Description |
|---|---|
float
|
Grid size (width and height) |
Source code in openscvx/plotting/viser/server.py
compute_velocity_colors(vel: np.ndarray | None, cmap_name: str = 'viridis', fallback_length: int | None = None) -> np.ndarray
¶
Compute RGB colors based on velocity magnitude.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vel
|
ndarray | None
|
Velocity array of shape (N, 3), or None if velocity is not available |
required |
cmap_name
|
str
|
Matplotlib colormap name |
'viridis'
|
fallback_length
|
int | None
|
When vel is None, number of points for default color array. Required when vel is None. |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Array of RGB colors with shape (N, 3), values in [0, 255] |
Source code in openscvx/plotting/viser/server.py
create_server(pos: np.ndarray | None, dark_mode: bool = True, show_grid: bool = True) -> viser.ViserServer
¶
Create a viser server with basic scene setup.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pos
|
ndarray | None
|
Position array for computing grid size, or None to use default grid size |
required |
dark_mode
|
bool
|
Whether to use dark theme |
True
|
show_grid
|
bool
|
Whether to show the grid (default True) |
True
|
Returns:
| Type | Description |
|---|---|
ViserServer
|
ViserServer instance with grid and origin frame |