raytrace.real_ray_tracer

Real Ray Tracer Module

This module contains the RealRayTracer class, which is responsible for tracing real rays through an optical system. It uses the RayGenerator class to create rays and the surface group of the optical system to trace them.

Kramer Harrison, 2025

Classes

RealRayTracer(optic)

Class to trace real rays through an optical system

class RealRayTracer(optic)[source]

Class to trace real rays through an optical system

This class is responsible for building rays (via a ray generator) and tracing these through an optical system (via the surface group).

Parameters:

optic (Optic) – The optical system to be traced.

set_aiming(mode: str, max_iter: int = 10, tol: float = 1e-06, **kwargs)[source]

Configure the ray aiming strategy.

Parameters:
  • mode – The aiming mode (“paraxial”, “iterative”, “robust”).

  • max_iter – Maximum iterations for iterative solvers.

  • tol – Convergence tolerance for iterative solvers.

  • **kwargs – Additional configuration parameters.

trace(Hx, Hy, wavelength, num_rays: int | None = 100, distribution: DistributionType | BaseDistribution | None = 'hexapolar')[source]

Trace a distribution of rays through the optical system.

Parameters:
  • Hx (float or numpy.ndarray) – The normalized x field coordinate.

  • Hy (float or numpy.ndarray) – The normalized y field coordinate.

  • wavelength (float) – The wavelength of the rays.

  • num_rays (int, optional) – The number of rays to be traced. Defaults to 100.

  • distribution (str or Distribution, optional) – The distribution of the rays. Defaults to ‘hexapolar’.

Returns:

The RealRays object containing the traced rays.”

Return type:

RealRays

trace_generic(Hx, Hy, Px, Py, wavelength)[source]

Trace generic rays through the optical system.

Parameters:
  • Hx (float or numpy.ndarray) – The normalized x field coordinate.

  • Hy (float or numpy.ndarray) – The normalized y field coordinate.

  • Px (float or numpy.ndarray) – The normalized x pupil coordinate.

  • Py (float or numpy.ndarray) – The normalized y pupil coordinate

  • wavelength (float) – The wavelength of the rays.