optiland.wavefront.wavefront

This module defines the Wavefront class, which is designed to analyze the wavefront of an optical system.

Kramer Harrison, 2024

Classes

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

Performs wavefront analysis on an optical system.

class Wavefront(optic: Optic, fields: Fields | list[Field] = 'all', wavelengths: Wavelengths = 'all', num_rays: int = 12, distribution: DistributionType = 'hexapolar', strategy: WavefrontStrategyType = 'chief_ray', afocal: bool = False, remove_tilt: bool = False, **kwargs)[source]

Performs wavefront analysis on an optical system.

This class acts as a high-level controller that delegates the complex work of wavefront analysis to a specified strategy (e.g., ‘chief_ray’ or ‘centroid_sphere’). It computes ray intersection points with the exit pupil, the optical path difference (OPD), ray intensities, and the radius of curvature of the reference sphere.

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

  • fields (str or list[tuple[float, float]]) – The fields to analyze. Can be “all” to use all fields defined in the optic.

  • wavelengths (str or list[float]) – The wavelengths to analyze. Can be “all” for all wavelengths or “primary” for the primary wavelength.

  • num_rays (int) – The number of rays to use for pupil sampling.

  • distribution (str or Distribution) – The ray distribution pattern. Can be a name (e.g., “hexapolar”) or a Distribution object.

  • strategy (str) – The calculation strategy to use. Supported options are “chief_ray”, “centroid_sphere”, and “best_fit_sphere”. Defaults to “chief_ray”.

  • remove_tilt (bool) – If True, removes tilt and piston from the OPD data. Defaults to False.

  • **kwargs – Additional keyword arguments passed to the strategy.

data

A dictionary containing the computed WavefrontData for each (field, wavelength) pair.

Type:

dict

static fit_and_remove_tilt(data: WavefrontData, remove_piston: bool = False, ridge: float = 1e-12) be.ndarray[source]

Removes piston and tilt from OPD data using weighted least squares.

Parameters:
  • data (WavefrontData) – The wavefront data containing pupil coordinates and OPD.

  • remove_piston (bool, optional) – If True, removes piston term as well as tilt. Defaults to False.

  • ridge (float, optional) – Small diagonal regularization for stability. Defaults to 1e-12.

Returns:

OPD with piston and tilt removed, shape (N,).

Return type:

opd_detrended (be.ndarray)

get_data(field: tuple[float, float], wl: float) WavefrontData[source]

Retrieves precomputed wavefront data for a field and wavelength.

Parameters:
  • field (tuple[float, float]) – The field coordinates, or a FieldPoint.

  • wl (float) – The wavelength in µm, or a WavelengthPoint.

Returns:

A data container with the computed wavefront results.

Return type:

WavefrontData