optiland.rays.ray_aiming.robust

Robust Ray Aiming Module

This module implements a recursive robust ray aiming algorithm.

Kramer Harrison, 2025

Classes

RobustRayAimer(optic[, max_iter, tol, ...])

This class implements a robust ray aiming algorithm designed to handle challenging optical systems where standard iterative methods might fail.

class RobustRayAimer(optic: Optic, max_iter: int = 20, tol: float = 1e-08, scale_fields: bool = True, **kwargs: Any)[source]

This class implements a robust ray aiming algorithm designed to handle challenging optical systems where standard iterative methods might fail. It employs a recursive subdivision approach to explore the pupil space, ensuring that rays are correctly mapped from the object or entrance pupil to the stop surface.

optic

The optical system instance.

Type:

Optic

max_iter

Maximum number of iterations for the internal solver.

Type:

int

tol

Numerical tolerance for convergence.

Type:

float

scale_fields

If True, scales field coordinates during the aiming process to improve numerical stability.

Type:

bool

aim_rays(fields: tuple, wavelengths: Any, pupil_coords: tuple, initial_guess: tuple | None = None) tuple[source]

Calculate ray starting coordinates using recursive robust expansion.

This method continually deforms the paraxial solution (t=0) into the real solution (t=1).

Parameters:
  • fields (tuple) – Field coordinates.

  • wavelengths (Any) – Wavelengths in microns.

  • pupil_coords (tuple) – Normalized pupil coordinates.

  • initial_guess (tuple | None, optional) – Optional starting guess. If provided, the method first attempts to solve directly using the iterative solver with this guess. If efficient, this skips the robust expansion.

Returns:

Solved ray parameters (x, y, z, L, M, N).

Return type:

tuple