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.

optic

The optical system containing surfaces and fields.

Type:

Optic

x

X-coordinates of the rays.

Type:

be.ndarray

y

Y-coordinates of the rays.

Type:

be.ndarray

z

Z-coordinates of the rays.

Type:

be.ndarray

i

Intensities of the rays.

Type:

be.ndarray

x_extent

Extents of the x-coordinates for each surface.

Type:

be.ndarray

y_extent

Extents of the y-coordinates for each surface.

Type:

be.ndarray

r_extent

Extents of the radii for each surface.

Type:

be.ndarray

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.

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.