iactrace.viz¶
Visualization functions for displaying results and telescope geometry.
2D Plotting¶
Functions for displaying sensor images:
- iactrace.viz.hexshow(result, sensor, sensor_idx=None, ax=None, **kwargs)[source]¶
Display hexagonal pixel data from a sensor group.
- Args:
result: Accumulated result with shape (n_sensors, n_pixels) sensor: HexagonalSensorGroup sensor_idx: Index of sensor to display. If None:
For single-sensor groups (n_sensors=1): displays that sensor
For multi-sensor groups: defaults to grid visualization (calls show_sensor_grid)
- ax: Matplotlib axis (creates new if None). If provided for multi-sensor groups,
sensor_idx must be specified.
**kwargs: Additional arguments for hexagon plotting (vmin, vmax, cmap, etc.)
- Returns:
Matplotlib axis (if single sensor or sensor_idx specified) OR tuple of (Figure, array of axes) (if multi-sensor with no sensor_idx)
- iactrace.viz.squareshow(result, sensor, sensor_idx=None, ax=None, **kwargs)[source]¶
Display square pixel data from a sensor group.
- Args:
result: Accumulated result with shape (n_sensors, height, width) sensor: SquareSensorGroup sensor_idx: Index of sensor to display. If None:
For single-sensor groups (n_sensors=1): displays that sensor
For multi-sensor groups: defaults to grid visualization (calls show_sensor_grid)
- ax: Matplotlib axis (creates new if None). If provided for multi-sensor groups,
sensor_idx must be specified.
**kwargs: Additional arguments for square plotting (vmin, vmax, cmap, etc.)
- Returns:
Matplotlib axis (if single sensor or sensor_idx specified) OR tuple of (Figure, array of axes) (if multi-sensor with no sensor_idx)
3D Visualization¶
Functions for visualizing telescope geometry:
- iactrace.viz.show_telescope(telescope, **kwargs)[source]¶
Visualize telescope in 3D.
In Jupyter notebooks, displays interactive 3D view via three.js (client-side). No server-side OpenGL required.
- Args:
telescope: Telescope object **kwargs: Additional options:
mirror_color: RGBA color for mirrors (default: light blue)
obstruction_color: RGBA color for obstructions (default: gray)
sensor_color: RGBA color for sensors (default: red)
lens_color: RGBA color for lenses (default: light green, semi-transparent)
- Returns:
trimesh.Scene
- iactrace.viz.export_mesh(telescope, filename)[source]¶
Export telescope geometry to 3D file.
- Args:
telescope: Telescope object filename: Output path (.glb, .gltf, .stl, .ply, .obj)
- iactrace.viz.add_rays(scene, origins, directions, length=10.0, color=None)[source]¶
Add rays to scene for debugging.
- Args:
scene: trimesh.Scene origins: Ray origins (N, 3) directions: Ray directions (N, 3) length: Ray length color: RGBA color (unused, trimesh paths don’t support colors well)
- Returns:
scene