visualization.coloring.rays#
Ray Coloring Module
This module contains the strategies that choose the color of each drawn ray, and the data handed to them.
Kramer Harrison, 2026
Classes
|
Identifies one traced ray bundle. |
Strategy that picks the color of each ray in a bundle. |
|
|
NumPy copies of the bundle just traced. |
|
Gives every ray the same color. |
- class RayBundleRef(field_index: int, field: tuple[float, float], wavelength_index: int, wavelength: float, num_fields: int, num_wavelengths: int, is_reference: bool)[source]#
Identifies one traced ray bundle.
- Variables:
field_index (int) – Index among the drawn fields.
wavelength_index (int) – Index among the drawn wavelengths.
wavelength (float) – Wavelength in micrometers.
num_fields (int) – Number of drawn fields.
num_wavelengths (int) – Number of drawn wavelengths.
is_reference (bool) – True for chief/marginal reference rays.
- class RayColorizer[source]#
Strategy that picks the color of each ray in a bundle.
- prepare(optic: Optic) None[source]#
Hook called once per draw, before any
ray_colors()call.- Parameters:
optic (Optic) – The system being drawn.
- abstractmethod ray_colors(bundle: RayBundleRef, rays: TracedRays) np.ndarray | None[source]#
Return per-ray colors for a bundle.
- Parameters:
bundle (RayBundleRef) – The bundle that was traced.
rays (TracedRays) – Its traced rays.
- Returns:
RGBA array of shape
(num_rays, 4), or None to keep the default bundle color. A row of NaN keeps the default color for that ray only.- Return type:
np.ndarray | None
- property scale: ColorScale | None#
Resolved scale to show as a colorbar, if any.
- Type:
ColorScale | None
- class TracedRays(x: np.ndarray, y: np.ndarray, z: np.ndarray, intensity: np.ndarray, opd: np.ndarray | None = None)[source]#
NumPy copies of the bundle just traced.
- Variables:
z (x, y,) – Global coordinates, shape
(num_surfaces, num_rays).intensity (np.ndarray) – Intensity at each surface, same shape.
opd (np.ndarray | None) – Optical path difference recorded at each surface, same shape, or None if the trace did not record it.
- intensity: np.ndarray#
- x: np.ndarray#
- y: np.ndarray#
- z: np.ndarray#
- class UniformRayColorizer(color: ColorType)[source]#
Gives every ray the same color.
- Parameters:
color (ColorType) – Anything
matplotlib.colors.to_rgbaaccepts.
- prepare(optic: Optic) None#
Hook called once per draw, before any
ray_colors()call.- Parameters:
optic (Optic) – The system being drawn.
- ray_colors(bundle: RayBundleRef, rays: TracedRays) np.ndarray | None[source]#
Return per-ray colors for a bundle.
- Parameters:
bundle (RayBundleRef) – The bundle that was traced.
rays (TracedRays) – Its traced rays.
- Returns:
RGBA array of shape
(num_rays, 4), or None to keep the default bundle color. A row of NaN keeps the default color for that ray only.- Return type:
np.ndarray | None
- property scale: ColorScale | None#
Resolved scale to show as a colorbar, if any.
- Type:
ColorScale | None