optimization.operand.image_quality#

Image Quality Operands Module

This module provides operands that summarize the image quality of an optical system at a single field point and wavelength: RMS wavefront error, MTF at one spatial frequency, and boresight error. They are intended for optimization and, in particular, for tolerancing, where they are evaluated once per Monte Carlo trial or sensitivity step.

Kramer Harrison, 2026

Classes

ImageQualityOperand()

Static methods computing image quality metrics of an optic.

class ImageQualityOperand[source]#

Static methods computing image quality metrics of an optic.

Methods:
  • rms_wavefront – RMS wavefront error (piston removed) in waves.

  • mtf – Modulation transfer function at one spatial frequency.

  • boresight_x – Boresight error along the image x axis in milliradians.

  • boresight_y – Boresight error along the image y axis in milliradians.

static boresight_x(optic: Optic, wavelength: str | float, Hx: float = 0.0, Hy: float = 0.0) → be.ndarray[source]#

Calculates the boresight error along the image x axis.

The boresight error is the x coordinate of the chief ray (pupil coordinates Px = Py = 0) on the image surface, in global coordinates, divided by the paraxial effective focal length f2 and expressed in milliradians. The scalar paraxial f2 treats tilted or decentered surfaces as centered, so the scale is effectively the nominal EFL.

This follows OpticStudio’s BSER operand, defined as the radial chief-ray image coordinate of the on-axis field divided by the effective focal length; boresight_x and boresight_y are its signed components, so sqrt(boresight_x**2 + boresight_y**2) is the radial boresight error. A centered system has zero boresight error; tilts and decenters of elements deviate the line of sight and make it nonzero. The sign follows that of f2 (negative for systems whose paraxial EFL is negative, e.g. a single concave mirror).

Parameters:
  • optic – The optic object.

  • wavelength – The wavelength in µm, or ‘primary’.

  • Hx – The normalized x field coordinate. Default is 0 (on axis).

  • Hy – The normalized y field coordinate. Default is 0 (on axis).

Returns:

The boresight error along x in milliradians.

static boresight_y(optic: Optic, wavelength: str | float, Hx: float = 0.0, Hy: float = 0.0) → be.ndarray[source]#

Calculates the boresight error along the image y axis.

Same as boresight_x(), using the y coordinate of the chief ray on the image surface.

Parameters:
  • optic – The optic object.

  • wavelength – The wavelength in µm, or ‘primary’.

  • Hx – The normalized x field coordinate. Default is 0 (on axis).

  • Hy – The normalized y field coordinate. Default is 0 (on axis).

Returns:

The boresight error along y in milliradians.

static mtf(optic: Optic, Hx: float, Hy: float, wavelength: str | float, frequency: float, azimuth: Literal['tangential', 'sagittal'] = 'tangential', method: Literal['sampled', 'geometric'] = 'sampled', num_rays: int = 64) → be.ndarray[source]#

Calculates the MTF at one spatial frequency, field and wavelength.

Following Optiland’s MTF analyses, the tangential MTF is evaluated for a frequency along the image y axis and the sagittal MTF for a frequency along the image x axis, independent of the field azimuth.

Two methods are available:

  • 'sampled' (default): the diffraction MTF from optiland.mtf.SampledMTF, which evaluates the pupil autocorrelation directly at the requested frequency. Unlike the FFT MTF it needs no PSF grid, so it is the cheaper diffraction method for a single frequency, as required per Monte Carlo trial.

  • 'geometric': the geometric MTF from optiland.mtf.GeometricMTF (scaled by the diffraction-limited MTF). It is faster for strongly aberrated systems but not differentiable, because it histograms the spot.

Parameters:
  • optic – The optic object.

  • Hx – The normalized x field coordinate.

  • Hy – The normalized y field coordinate.

  • wavelength – The wavelength in µm, or ‘primary’.

  • frequency – The spatial frequency in cycles/mm in image space.

  • azimuth – ‘tangential’ (frequency along image y) or ‘sagittal’ (frequency along image x). Default is ‘tangential’.

  • method – ‘sampled’ or ‘geometric’. Default is ‘sampled’.

  • num_rays – The number of rays across the pupil diameter of the uniform pupil grid. Default is 64.

Returns:

The MTF value, dimensionless in [0, 1].

Raises:

ValueError – If azimuth or method is not recognized.

static rms_wavefront(optic: Optic, Hx: float, Hy: float, num_rays: int, wavelength: str | float, distribution: DistributionType = 'gaussian_quad', remove_tilt: bool = False) → be.ndarray[source]#

Calculates the RMS wavefront error at one field and wavelength.

The OPD is computed with optiland.wavefront.Wavefront using its default chief-ray reference sphere, in waves at wavelength. The RMS is taken about the weighted mean OPD, i.e. piston is always removed (the “RMS referenced to the mean” convention). Note that optiland.analysis.RmsWavefrontErrorVsField instead reports sqrt(mean(opd**2)) about the chief-ray reference, which includes piston, so the two agree only when the mean OPD is zero.

Each pupil sample is weighted by its ray intensity, so vignetted or invalid rays (zero intensity) do not contribute, and additionally by the quadrature weight when the distribution provides one (as for the default 'gaussian_quad'). Otherwise samples are weighted equally.

Parameters:
  • optic – The optic object.

  • Hx – The normalized x field coordinate.

  • Hy – The normalized y field coordinate.

  • num_rays – The pupil sampling parameter. For ‘gaussian_quad’ it is the number of rings; for ‘hexapolar’ the number of rings; for ‘uniform’ the number of rays across the pupil diameter.

  • wavelength – The wavelength in µm, or ‘primary’.

  • distribution – The pupil distribution. Default is ‘gaussian_quad’.

  • remove_tilt – If True, also remove x/y tilt with a weighted least-squares plane fit over the exit pupil coordinates (the “RMS referenced to the centroid” convention). Default is False.

Returns:

The RMS wavefront error in waves.