mtf.geometric#

Geometric Modulation Transfer Function (MTF) Module.

This module provides the GeometricMTF class for computing the MTF of an optical system based on spot diagram data.

Kramer Harrison, 2025

Classes

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

Smith, Modern Optical Engineering 3rd edition, Section 11.9

class GeometricMTF(optic: Optic, fields: str | list = 'all', wavelength: str | float = 'primary', num_rays=100, distribution: DistributionType = 'uniform', num_points=256, max_freq='cutoff', scale=True)[source]#

Smith, Modern Optical Engineering 3rd edition, Section 11.9

This class represents the Geometric MTF (Modulation Transfer Function) of an optical system. It inherits from the SpotDiagram class.

Parameters:
  • optic (Optic) – The optical system for which to calculate the MTF.

  • fields (str or list, optional) – The field points at which to calculate the MTF. Defaults to ‘all’.

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

  • num_rays (int, optional) – The number of rays to trace for each field point. Defaults to 100.

  • distribution (str, optional) – The distribution of rays within each field point. Defaults to ‘uniform’.

  • num_points (int, optional) – The number of points to sample in the MTF curve. Defaults to 256.

  • max_freq (str or float, optional) – The maximum frequency to consider in the MTF curve. Defaults to ‘cutoff’.

  • scale (bool, optional) – Whether to scale the MTF curve using the diffraction-limited curve. Defaults to True.

Variables:
  • num_points (int) – The number of points to sample in the MTF curve.

  • scale (bool) – Whether to scale the MTF curve.

  • max_freq (float) – The maximum frequency to consider in the MTF curve.

  • freq (be.ndarray) – The frequency values for the MTF curve.

  • mtf (list) – The MTF data for each field point. Each element is a list containing tangential and sagittal MTF data (be.ndarray) for a field.

  • diff_limited_mtf (be.ndarray) – The diffraction-limited MTF curve.

Methods:
  • view (figsize=(12, 4), add_reference=False) – Plots the MTF curve.

  • _generate_mtf_data() – Generates the MTF data for each field point.

  • _compute_field_data (xi, v, scale_factor) – Computes the MTF data for a given field point.

  • _plot_field (ax, mtf_data, field, color) – Plots the MTF data for a given field point.

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() list[tuple[BEArray, BEArray]]#

Calculates the geometric centroid of each spot for the reference wavelength.

Returns:

A list of (x, y) centroid coordinates for each field.

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] = (12, 4), add_reference: bool = False) tuple[Figure, Axes][source]#

Plots the MTF curve.

Parameters:
  • fig_to_plot_on (plt.Figure, optional) – The figure to plot on. If provided, the existing figure is cleared and reused. Defaults to None, which creates a new figure.

  • figsize (tuple, optional) – The size of the figure. Defaults to (12, 4).

  • add_reference (bool, optional) – Whether to add the diffraction limit reference curve. Defaults to False.

Returns:

A tuple containing the matplotlib figure and axes objects.

If fig_to_plot_on is provided, the existing figure is cleared and reused; otherwise, a new figure is created.

Return type:

tuple