visualization.system.rays#

Rays Visualization Module

This module contains classes for visualizing rays in an optical system.

Kramer Harrison, 2024

Classes

Rays2D(optic)

A class to represent and visualize 2D rays in an optical system.

Rays3D(optic)

A class to represent 3D rays for visualization using VTK.

class Rays2D(optic)[source]#

A class to represent and visualize 2D rays in an optical system.

Parameters:

optic (Optic) – The optical system to be visualized.

Variables:
  • optic (Optic) – The optical system containing surfaces and fields.

  • x (be.ndarray) – X-coordinates of the rays.

  • y (be.ndarray) – Y-coordinates of the rays.

  • z (be.ndarray) – Z-coordinates of the rays.

  • i (be.ndarray) – Intensities of the rays.

  • x_extent (be.ndarray) – Extents of the x-coordinates for each surface.

  • y_extent (be.ndarray) – Extents of the y-coordinates for each surface.

  • r_extent (be.ndarray) – Extents of the radii for each surface.

Methods:

plot(ax, fields=’all’, wavelengths=’primary’, num_rays=3, – distribution=’line_y’):

plot(ax, fields='all', wavelengths='primary', num_rays=3, distribution='line_y', reference=None, theme=None, projection='YZ', hide_vignetted=False)[source]#

Plots the rays for the given fields and wavelengths.

Parameters:
  • ax – The matplotlib axis to plot on.

  • fields – The fields at which to trace the rays. Default is ‘all’.

  • wavelengths – The wavelengths at which to trace the rays. Default is ‘primary’.

  • num_rays – The number of rays to trace for each field and wavelength. Default is 3.

  • distribution – The distribution of the rays. Default is ‘line_y’.

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

  • theme (Theme, optional) – The theme to apply. Defaults to None.

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

class Rays3D(optic)[source]#

A class to represent 3D rays for visualization using VTK. Inherits from Rays2D and extends functionality to 3D.

Methods:

plot(ax, fields=’all’, wavelengths=’primary’, num_rays=3, – distribution=’line_y’):

Parameters:

optic – The optical system to be visualized.

plot(ax, fields='all', wavelengths='primary', num_rays=3, distribution='line_y', reference=None, theme=None, hide_vignetted=False)[source]#

Plots the rays for the given fields and wavelengths.

Parameters:
  • ax – The matplotlib axis to plot on.

  • fields – The fields at which to trace the rays. Default is ‘all’.

  • wavelengths – The wavelengths at which to trace the rays. Default is ‘primary’.

  • num_rays – The number of rays to trace for each field and wavelength. Default is 3.

  • distribution – The distribution of the rays. Default is ‘line_y’.

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

  • theme (Theme, optional) – The theme to apply. Defaults to None.

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