visualization.system.system#

System Visualization Module

This module contains the OpticalSystem class for visualizing optical systems.

Kramer Harrison, 2024

Classes

OpticalSystem(optic, rays[, projection])

A class to represent an optical system for visualization.

class OpticalSystem(optic, rays, projection='2d')[source]#

A class to represent an optical system for visualization. The optical system contains surfaces and lenses.

Parameters:
  • optic (Optic) – The optical system to be used for plotting.

  • rays (Rays) – The rays interacting with the optical system.

  • projection (str) – The type of projection for visualization. Must be ‘2d’ or ‘3d’.

Variables:
  • optic (Optic) – The optical system to be used for plotting.

  • rays (Rays) – The rays interacting with the optical system.

  • projection (str) – The type of projection for visualization. Must be ‘2d’ or ‘3d’.

  • components (list) – A list to store the components of the optical system.

  • component_registry (dict) – A registry mapping component names to their respective classes for 2D and 3D projections.

Methods:

plot (ax) –

Identifies and plots the components of the optical system on the

given axis (or renderer for 3D plotting).

plot(ax, theme=None, projection='YZ', show_apertures=True)[source]#

Plots the components of the optical system on the given axis (or renderer for 3D plotting).

classmethod register_component_renderer(component_type: str, renderer: ComponentRenderer, *, overwrite: bool = False) None[source]#

Register a renderer for a custom component type.

The registered renderer is used when _identify_components adds a component of this type. Custom types are checked before the built-in registry, so this can also override existing built-in types when overwrite=True.

Parameters:
  • component_type – String key identifying the component type.

  • renderer – A ComponentRenderer instance.

  • overwrite – Allow replacing an existing registration.

Raises:

ValueError – If component_type is already registered and overwrite is False.