solves.quick_focus#

Quick Focus Solve Module

Defines the quick focus solve.

Seçkin Berkay Öztürk, 2025

Classes

QuickFocusSolve(optic, *args)

Quick Focus :param optic: The optic object.

class QuickFocusSolve(optic, *args)[source]#

Quick Focus :param optic: The optic object. :type optic: Optic

Raises:

ValueError – If the optical system is not defined.

apply()[source]#

Applies the QuickFocusSolve to the optic.

This method calculates the optimal focus distance and sets the z-position of the last surface (image plane) accordingly.

Raises:

UnsupportedParaxialGeometryError – If the beam path is folded off global +z, before any mutation – moving the image plane along z only would take it off its physical leg.

classmethod from_dict(optic, data)#

Creates a solve from a dictionary representation.

Parameters:
  • optic (Optic) – The optic object.

  • data (dict) – The dictionary representation of the solve.

Returns:

The solve.

Return type:

BaseSolve

optimal_focus_distance(Hx=0, Hy=0, wavelength=0.55, num_rays=5, distribution='hexapolar')[source]#

Compute the optimal location of the image plane where the RMS spot size is minimized. This is based on solving the quadratic equation that describes the RMS spot size as a function of the propagation distance.

Parameters:
  • Hx (float) – The normalized x field.

  • Hy (float) – The normalized y field.

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

  • num_rays (int) – The number of rays to trace.

  • distribution (str) – The distribution of rays to trace.

Returns:

The optimal axial position (z-coordinate) of the image plane

that minimizes the RMS spot size.

Return type:

float

Raises:

UnsupportedParaxialGeometryError – If the beam path is folded off global +z (or entered along another direction), before any ray is traced. The returned value is a Cartesian global-z focus coordinate, which is not frame-correct for a folded output arm – a caller writing it into cs.z would move the image plane off its physical leg.

to_dict()#

Returns a dictionary representation of the solve.

Returns:

A dictionary representation of the solve.

Return type:

dict