analysis.ray_fan

Ray Aberration Fan Analysis

This module provides a ray fan analysis for optical systems.

Kramer Harrison, 2024

Classes

BestFitRayFan(optic[, fields, wavelengths, ...])

Represents a ray fan analysis referenced to the best-fit sphere center.

RayFan(optic[, fields, wavelengths, num_points])

Represents a ray fan aberration analysis for an optic.

class BestFitRayFan(optic, fields: str | list = 'all', wavelengths: str | list = 'all', num_points: int = 256, num_rays_for_fit: int = 15)[source]

Represents a ray fan analysis referenced to the best-fit sphere center.

This class extends the standard RayFan analysis by changing the reference point for aberration calculations. Instead of using the chief ray’s intersection with the image plane, it uses the lateral coordinates (x, y) of the center of the wavefront’s best-fit sphere. This provides a measure of aberration relative to the point of optimal focus for the entire pupil.

The analysis plane for determining the ray intersection points is the nominal image plane (the final surface in the optical model).

Unlike the standard RayFan, this analysis does not recenter the plot on the chief ray. The origin (0,0) is the location of the best-fit sphere center. Therefore, the plot shows all aberrations, including distortion, relative to this optimal focal point.

Parameters:
  • optic (Optic) – The optic object to analyze.

  • fields (str or list, optional) – The fields to analyze. Defaults to ‘all’.

  • wavelengths (str or list, optional) – The wavelengths to analyze. Defaults to ‘all’.

  • num_points (int, optional) – The number of points in each ray fan. Defaults to 256.

  • num_rays_for_fit (int, optional) – The number of rays (rings) in the hexapolar grid used to sample the pupil for the best-fit sphere calculation. A higher number provides a more accurate sphere center at the cost of computation time. Defaults to 15.

num_rays_for_fit

The number of rays used for the sphere fit.

Type:

int

view(fig_to_plot_on: Figure = None, figsize: tuple[float, float] = (10, 3.33), *, show: bool = True)

Displays the ray fan plot, either in a new window or on a provided GUI figure.

Parameters:
  • fig_to_plot_on (plt.Figure, optional) – The figure to plot on. If None, a new figure will be created. Defaults to None.

  • figsize (tuple[float, float], optional) – The size of the figure. Defaults to (10, 3.33).

  • show (bool) – If True (default), calls plt.show(). Set False for headless use.

Returns:

The current figure and its axes.

Return type:

tuple

class RayFan(optic, fields='all', wavelengths='all', num_points=256)[source]

Represents a ray fan aberration analysis for an optic.

Parameters:
  • optic (Optic) – The optic object to analyze.

  • fields (str or list, optional) – The fields to analyze. Defaults to ‘all’.

  • wavelengths (str or list, optional) – The wavelengths to analyze. Defaults to ‘all’.

  • num_points (int, optional) – The number of points in the ray fan. Defaults to 256.

optic

The optic object being analyzed.

Type:

Optic

fields

The fields being analyzed.

Type:

list

wavelengths

The wavelengths being analyzed.

Type:

list

num_points

The number of points in the ray fan.

Type:

int

data

The generated ray fan data.

Type:

dict

view(figsize=(10, 3.33))[source]

Displays the ray fan plot.

view(fig_to_plot_on: Figure = None, figsize: tuple[float, float] = (10, 3.33), *, show: bool = True)[source]

Displays the ray fan plot, either in a new window or on a provided GUI figure.

Parameters:
  • fig_to_plot_on (plt.Figure, optional) – The figure to plot on. If None, a new figure will be created. Defaults to None.

  • figsize (tuple[float, float], optional) – The size of the figure. Defaults to (10, 3.33).

  • show (bool) – If True (default), calls plt.show(). Set False for headless use.

Returns:

The current figure and its axes.

Return type:

tuple