geometries.sag_error#

Sag Error Geometry

The sag error geometry adds a Zernike sag error to any other geometry, its base. It models a form error of a manufactured surface, such as the irregularity of a tolerance analysis. The sag is

z(x, y) = base.sag(x, y) + sum_j c_j Z_j(x / R, y / R)

where Z_j is the j-th Fringe (University of Arizona) Zernike polynomial, which has no normalization constant, so that c_j is the amplitude of a term in lens units, and R is the normalization radius. The coefficients are in Fringe order, starting at Z1 (piston): Z5 is rho^2 cos(2 phi) and Z9 is 6 rho^4 - 6 rho^2 + 1. The polynomials extend beyond R without a check.

The geometry shares the coordinate system of its base and never changes it. The intersection is found by Newton-Raphson iteration, seeded by the intersection with the base.

Kramer Harrison, 2026

Classes

SagErrorGeometry(base, coefficients, norm_radius)

A geometry with a Zernike sag error added to a base geometry.

class SagErrorGeometry(base: BaseGeometry, coefficients: Any, norm_radius: float, tol: float = 1e-10, max_iter: int = 100)[source]#

A geometry with a Zernike sag error added to a base geometry.

The base is not changed. Its radius, conic and coordinate system are the radius, conic and coordinate system of this geometry, so changes of these values (for example by an optimization variable) change the base. If all coefficients are zero, the sag, the normals and the distances are those of the base, with the same bits.

The paraxial radius includes the rho^2 part of the rotationally symmetric terms; the non-rotational terms (for example astigmatism) have no mean curvature and are not seen by the paraxial trace.

Parameters:
  • base – The geometry to which the sag error is added.

  • coefficients – The Fringe Zernike coefficients in lens units, from Z1 (piston).

  • norm_radius – The normalization radius R of the Zernike polynomials.

  • tol – Tolerance of the Newton-Raphson iteration. Defaults to 1e-10.

  • max_iter – Maximum iterations of the Newton-Raphson iteration. Defaults to 100.

property coefficients: Any#

The Fringe Zernike coefficients in lens units, from Z1.

property cs#

The coordinate system, shared with the base.

distance(rays, aperture=None)[source]#

Return the distance to the surface along each ray.

Newton-Raphson iteration from the intersection with the base, or the distance to the base if all coefficients are zero.

flip() → None[source]#

Flip the base and change the sign of the coefficients.

classmethod from_dict(data: dict) → SagErrorGeometry[source]#

Create a sag error geometry from a dictionary.

Parameters:

data – The dictionary of to_dict.

Returns:

The geometry, with a new base.

Return type:

SagErrorGeometry

globalize(rays)#

Convert rays from the local coordinate system to the global coordinate system.

Parameters:

rays (RealRays) – The rays to convert.

property is_symmetric: bool#

True if the base and all nonzero Zernike terms are rotationally symmetric.

property k#

The conic constant of the base, or 0 if the base has none.

localize(rays)#

Convert rays from the global coordinate system to the local coordinate system.

Parameters:

rays (RealRays) – The rays to convert.

property norm_radius: float#

The normalization radius of the Zernike polynomials.

property paraxial_radius#

The vertex radius, with the rho^2 part of the symmetric terms.

property radius#

The radius of the base, or infinity if the base has none.

sag(x=0, y=0)[source]#

Return the sag of the base plus the Zernike sag error.

scale(scale_factor: float) → None[source]#

Scale the base, the normalization radius and the coefficients.

set_radius(value: float) → None[source]#

Set the radius of the base.

surface_normal(rays)[source]#

Return the surface normal at the ray positions.

to_dict() → dict[source]#

Convert the geometry to a dictionary, with the base.

update_normalization(semi_aperture: float) → None[source]#

Update the normalization of the base; R does not change.