visualization.system.optic_viewer

Optical System Visualization Module

This module provides tools for visualizing optical systems. It utilizes Matplotlib to render optical components and ray tracing paths. The OpticViewer class is the primary interface for generating these visualizations, offering customization for ray properties, field of view, and display parameters.

Kramer Harrison, 2024

re-worked by Manuel Fragata Mendes, june 2025

Classes

OpticViewer(optic)

A class used to visualize optical systems.

class OpticViewer(optic)[source]

A class used to visualize optical systems.

Parameters:

optic – The optical system to be visualized.

optic

The optical system to be visualized.

rays

An instance of Rays2D for ray tracing.

system

An instance of OpticalSystem for system representation.

view(fields='all', wavelengths='primary', num_rays=3,

distribution=’line_y’, figsize=(10, 4), xlim=None, ylim=None):

Visualizes the optical system with specified parameters.

view(fields='all', wavelengths='primary', num_rays=3, distribution=None, show_apertures=True, hide_vignetted=False, figsize=None, xlim=None, ylim=None, title=None, reference=None, tooltip_format=None, show_legend=True, projection='YZ', ax: BaseViewer | None = None)[source]

Visualizes the optical system.

Parameters:
  • fields (str, optional) – The fields to be visualized. Defaults to ‘all’.

  • wavelengths (str, optional) – The wavelengths to be visualized. Defaults to ‘primary’.

  • num_rays (int, optional) – The number of rays to be visualized. Defaults to 3.

  • distribution (str | None, optional) – The distribution of rays. Defaults to None, which selects a default based on projection.

  • show_apertures (bool, optional) – If True, overlays aperture graphics on the system view. Defaults to True.

  • hide_vignetted (bool, optional) – If True, rays that vignette at any surface are not shown. Defaults to False.

  • figsize (tuple, optional) – The size of the figure. Defaults to None, which uses the theme’s default.

  • xlim (tuple, optional) – The x-axis limits. Defaults to None.

  • ylim (tuple, optional) – The y-axis limits. Defaults to None.

  • reference (str, optional) – The reference rays to plot. Options include “chief” and “marginal”. Defaults to None.

  • projection (str, optional) – The projection plane. Must be ‘XY’, ‘XZ’, or ‘YZ’. Defaults to ‘YZ’.

  • ax (matplotlib.axes.Axes, optional) – The axes to plot on. If None, a new figure and axes are created. Defaults to None.