analysis.encircled_energy

Encircled Energy Analysis

This module provides an encircled energy analysis for optical systems.

Kramer Harrison, 2024

Classes

EncircledEnergy(optic[, fields, wavelength, ...])

Class representing the Encircled Energy analysis of a given optic.

class EncircledEnergy(optic, fields='all', wavelength='primary', num_rays=100000, distribution='random', num_points=256)[source]

Class representing the Encircled Energy analysis of a given optic.

Parameters:
  • optic (Optic) – The optic for which the Encircled Energy analysis is performed.

  • fields (str or tuple, optional) – The fields for which the analysis is performed. Defaults to ‘all’.

  • wavelength (str or float, optional) – The wavelength at which the analysis is performed. Defaults to ‘primary’.

  • num_rays (int, optional) – The number of rays used for the analysis. Defaults to 100000.

  • distribution (str, optional) – The distribution of rays. Defaults to ‘random’.

  • num_points (int, optional) – The number of points used for plotting the Encircled Energy curve. Defaults to 256.

airy_disc_x_y(wavelength: float) tuple[list[float], list[float]]

Generates the Airy disk radii for the x and y axes for each field.

Parameters:

wavelength – The wavelength for the calculation.

Returns:

x-axis radii and y-axis radii per field.

Return type:

A tuple of two lists

airy_radius(n_w: float, wavelength: float) float

Calculates the Airy disk radius.

Parameters:
  • n_w – The physical F-number.

  • wavelength – The wavelength of light in micrometers.

Returns:

The Airy disk radius.

angle_from_cosine(a: BEArray, b: BEArray) float

Calculates the angle in radians between two direction cosine vectors.

Parameters:
  • a – The first direction cosine vector.

  • b – The second direction cosine vector.

Returns:

The angle between the vectors in radians.

centroid()[source]

Calculate the centroid of the Encircled Energy.

Returns:

A list of tuples representing the centroid coordinates for

each field.

Return type:

list

f_number(n: float, theta: float) float

Calculates the physical F-number.

Parameters:
  • n – The refractive index of the medium.

  • theta – The half-angle of the cone of light in radians.

Returns:

The calculated physical F-number.

generate_chief_rays_centers(wavelength: float) BEArray

Generates the (x, y) intersection points for the chief ray of each field.

Parameters:

wavelength – The wavelength for the rays.

Returns:

An array of shape (num_fields, 2) with (x, y) coordinates.

generate_chief_rays_cosines(wavelength: float) BEArray

Generates direction cosines for the chief ray of each field.

Parameters:

wavelength – The wavelength for the rays.

Returns:

An array of shape (num_fields, 3) containing the direction cosines.

generate_marginal_rays(H_x: float, H_y: float, wavelength: float) tuple

Generates marginal rays at the four cardinal points of the pupil.

Parameters:
  • H_x – The x-field coordinate.

  • H_y – The y-field coordinate.

  • wavelength – The wavelength for the rays.

Returns:

A tuple containing the traced rays for north, south, east, and west pupil points.

generate_marginal_rays_cosines(H_x: float, H_y: float, wavelength: float) tuple

Generates direction cosines for each marginal ray of a given field.

Parameters:
  • H_x – The x-field coordinate.

  • H_y – The y-field coordinate.

  • wavelength – The wavelength for the rays.

Returns:

A tuple of direction cosine vectors for north, south, east, and west rays.

geometric_spot_radius() list[list[BEArray]]

Calculates the maximum geometric spot radius for each spot.

Returns:

A nested list of maximum radii for each field and wavelength.

rms_spot_radius() list[list[BEArray]]

Calculates the root-mean-square (RMS) spot radius for each spot.

Returns:

A nested list of RMS radii for each field and wavelength.

view(fig_to_plot_on: Figure | None = None, figsize: tuple[float, float] = (7, 4.5), *, show: bool = True) tuple[Figure, Axes][source]

Plot the Encircled Energy curve.

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

  • figsize (tuple, optional) – The size of the figure if a new one is created. Defaults to (7, 4.5).

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

Returns:

A tuple containing the figure and axes objects.

Return type:

tuple