Optical Analysis Dashboard: Modeling Guide
The implementation follows a right-handed coordinate system with light propagating in the +Z direction. The optical axis lies along Z; heights are measured in Y (meridional plane) and X (sagittal plane). Surface vertices are located at positions $z_k$ along the axis.
Surface sag is computed for conic sections parameterized by radius of curvature $R$ and conic constant $K$:
where $c = 1/R$ is the curvature and $r = \sqrt{x^2 + y^2}$ is the radial distance from the axis. The conic constant determines surface type:
The surface gradient, required for normal computation:
The unit surface normal at point $(x, y, z)$:
A ray with origin $(x_0, y_0, z_0)$ and direction cosines $(L, M, N)$ intersects the conic surface at parameter $t$ satisfying:
Substituting into the conic equation yields a quadratic in $t$:
where, with $G = 1 + K$ and surface vertex at $z = z_v$:
The smallest positive root gives the intersection distance. Convergence threshold is $10^{-10}$ mm.
At each surface, the ray direction is updated according to Snell's law in vector form. Given incident direction $\hat{d}$, surface normal $\hat{n}$, and refractive indices $n_1, n_2$:
where:
Total internal reflection occurs when $\eta^2(1 - \cos^2\theta_i) > 1$.
For mirror surfaces:
Chromatic dispersion is modeled using the Cauchy approximation derived from the Abbe V-number. Given $n_d$ at the d-line (587.56 nm) and Abbe number $V_d$:
The Cauchy dispersion formula:
Coefficients are determined by:
Standard Fraunhofer lines: $\lambda_F = 486.13$ nm, $\lambda_d = 587.56$ nm, $\lambda_C = 656.27$ nm.
For first-order analysis, paraxial rays are traced using the matrix formalism. At each surface:
where $\phi = c(n_2 - n_1)$ is the surface power and $u$ is the paraxial ray angle.
where $t$ is the axial distance to the next surface.
From the marginal and chief ray traces:
where $y_1$ is the entrance pupil semi-diameter and $u_k'$ is the final marginal ray angle.
where $y_k$ is the marginal ray height at the last surface.
Pupils are located using the system-matrix formulation rather than surface-by-surface reverse imaging. Two trial paraxial rays are traced from the launch plane (just before surface 1) through the entire system:
Their heights at the stop surface define the two relevant matrix elements:
Any forward ray with object-space parameters $(y_{\text{obj}}, u_{\text{obj}})$ has height at the stop $y_s = M_{11}\,y_{\text{obj}} + M_{12}\,u_{\text{obj}}$. The chief ray is defined by $y_s = 0$, so $y_{\text{obj}} = -(M_{12}/M_{11})\,u_{\text{obj}}$. Its back-extension in object space crosses the axis at
The marginal ray from an object at infinity has $y_{\text{obj}} = D_{\text{EP}}/2$, $u_{\text{obj}} = 0$, so its height at the stop equals $D_{\text{stop}}/2$, giving
For the exit pupil, the same two trial rays are read off at the last optical surface. By linearity, the chief ray's height and post-refraction slope at the last optical surface are
The chief ray in image space crosses the axis at the exit pupil center:
The exit pupil semi-diameter is the marginal-ray height at $z_{\text{XP}}$. With $y_{\text{marg}} = (D_{\text{EP}}/2)\,y_{\text{HU}}$ and $u_{\text{marg}} = (D_{\text{EP}}/2)\,u_{\text{HU}}$ at the last optical surface,
Two degenerate cases: $M_{11}\to 0$ corresponds to the stop being conjugate to infinity through the optics in front of it (the entrance pupil is at infinity); $u_{\text{chief}}\to 0$ is image-space telecentricity (the exit pupil is at infinity). Both are flagged in the implementation.
This matrix-based approach replaces an earlier surface-by-surface reverse-imaging loop whose magnification calculation was approximate and which degenerated when the stop coincided with a refracting surface — exactly the case for several common starting designs.
Each real ray is constructed so that its straight-line extension in object space passes through its assigned sample point on the entrance pupil,
with $(p_x, p_y)$ the normalized pupil coordinates. The chief ray ($p_x = p_y = 0$) therefore passes through the entrance pupil center as required. For angular fields (object at infinity), every ray in a bundle shares direction $(0,\sin\theta,\cos\theta)$; for object-height fields, each ray's direction is the unit vector from the object point to its EP sample. This corresponds to "paraxial ray aiming" in commercial nomenclature; it remains paraxial in the sense that it assumes the paraxial entrance pupil is a faithful image of the stop (it ignores pupil aberration).
When the autofocus option is enabled, the thickness between the last refracting surface and the image surface (IMA) is adjusted so that the IMA sits at the paraxial focus:
where $\text{BFL}_{\text{paraxial}} = -y_{\text{IMA}} / u_{\text{IMA}}$ is computed from the marginal-ray trace. After the shift, the IMA's z-vertex equals the paraxial focus and the marginal ray height at the IMA is zero by construction. All downstream evaluations (spot, OPD, PSF, MTF) take place at this updated image plane.
The optical path length along a ray is accumulated as:
where $n_i$ is the refractive index and $d_i$ is the geometric path length in each medium.
The optical path difference is computed relative to a reference sphere centered on the chief ray intersection with the image surface. The reference sphere passes through the center of the exit pupil (Welford convention).
expressed in waves at the reference wavelength. Here $(x_p, y_p)$ are normalized pupil coordinates.
computed after piston removal (mean subtraction).
Third-order aberrations are computed using the Hopkins-Welford formulation with Abbe invariants.
where $y, u$ are marginal ray height and angle; $\bar{y}, \bar{u}$ are chief ray height and angle.
This quantity is conserved through the system.
The five Seidel aberration coefficients at each surface:
where $\Delta(u/n) = u'/n' - u/n$ is the change in $u/n$ at the surface.
where $V$ is the Abbe number of the material.
The wavefront is decomposed into Zernike polynomials using Noll ordering with standard normalization.
where $(n, m)$ are the radial and azimuthal indices corresponding to Noll index $j$.
where $\delta_{m0} = 1$ if $m = 0$, else $0$.
| $j$ | $n$ | $m$ | Name | $Z_j(\rho,\theta)$ |
|---|---|---|---|---|
| 1 | 0 | 0 | Piston | $1$ |
| 2 | 1 | 1 | Tilt X | $2\rho\cos\theta$ |
| 3 | 1 | -1 | Tilt Y | $2\rho\sin\theta$ |
| 4 | 2 | 0 | Defocus | $\sqrt{3}(2\rho^2 - 1)$ |
| 5 | 2 | -2 | Astigmatism 45° | $\sqrt{6}\rho^2\sin 2\theta$ |
| 6 | 2 | 2 | Astigmatism 0° | $\sqrt{6}\rho^2\cos 2\theta$ |
| 7 | 3 | -1 | Coma Y | $\sqrt{8}(3\rho^3 - 2\rho)\sin\theta$ |
| 8 | 3 | 1 | Coma X | $\sqrt{8}(3\rho^3 - 2\rho)\cos\theta$ |
| 11 | 4 | 0 | Primary Spherical | $\sqrt{5}(6\rho^4 - 6\rho^2 + 1)$ |
| 22 | 6 | 0 | Secondary Spherical | $\sqrt{7}(20\rho^6 - 30\rho^4 + 12\rho^2 - 1)$ |
| 37 | 8 | 0 | Tertiary Spherical | $3(70\rho^8 - 140\rho^6 + 90\rho^4 - 20\rho^2 + 1)$ |
Coefficients $a_j$ are determined by minimizing:
Solved via the normal equations $(Z^T Z)\vec{a} = Z^T \vec{W}$.
where $j_0 = 4$ excludes piston and tilt (alignment terms).
PSF computation assumes scalar Fraunhofer diffraction. The exit pupil field is modeled as uniform amplitude with phase determined by the OPD map.
where $A(\xi, \eta) = 1$ inside the pupil, $0$ outside, and $W$ is in waves.
computed using a 2D FFT with appropriate zero-padding.
For small aberrations, the Maréchal approximation:
where $\sigma_W$ is the RMS wavefront error in waves.
This is the radius to the first dark ring of the diffraction-limited PSF.
Equivalently, the OTF is the autocorrelation of the pupil function:
normalized such that $\text{MTF}(0) = 1$.
For a circular pupil with no aberrations:
where $\nu = f/f_{\text{cutoff}}$ is the normalized spatial frequency.
in cycles per unit length (typically lp/mm).
Where do rays from a point source land on the image plane? The spot diagram answers this in geometric-optics terms, ignoring diffraction entirely.
The RMS spot radius is computed as:
The Airy disk reference circle has radius $r_{\text{Airy}} = 1.22\lambda F/\#$.
Energy distribution within the spot. The diagram shows ray intersections, not intensity. A tight cluster of rays at spot center may contain less energy than the sparse periphery if pupil apodization varies. The Airy disk overlay provides scale but does not indicate whether the system is diffraction-limited.
Spot diagrams are fast. Use them for initial sensitivity studies, tolerance allocation previews, and sanity checks during optimization. When the spot is more than $3\times$ the Airy disk, geometric metrics dominate; when it approaches the Airy disk, transition to PSF/MTF analysis.
What is the shape of the wavefront emerging from the exit pupil? The OPD map answers this as a height function over the pupil, in units of wavelength.
The wavefront is characterized by:
Key metrics derived from the OPD:
The pupil amplitude distribution. Standard OPD analysis assumes uniform illumination. Real systems with Gaussian beams, apodized pupils, or vignetting have amplitude variations that affect PSF shape independently of phase errors. The Zernike decomposition assumes a circular, uniformly-weighted pupil.
The OPD map is the bridge between geometric aberrations and diffraction performance. Use it to identify aberration type (Zernike decomposition), assess correction strategy (which terms are correctable in post-processing or by active optics), and predict alignment sensitivity (tip/tilt and coma are first-order alignment errors).
What is the intensity distribution in the image of a point source? The PSF answers this including diffraction effects, and is the true impulse response of the optical system.
The PSF is computed via:
The Strehl ratio relates peak intensity to wavefront quality:
Detector sampling effects. The displayed PSF assumes continuous irradiance; finite pixel size convolves this with a rect function. Nyquist considerations for the detector are separate from optical PSF quality. The logarithmic display compresses dynamic range but can obscure subtle sidelobe structure at linear scale.
PSF is the ground truth for resolved imaging. Compare the displayed PSF against application requirements: is the core symmetric? Are sidelobes below the noise floor? Does the encircled energy at a given radius meet spec? For laser systems, PSF peak and width directly determine focused spot performance.
What fraction of object contrast survives as a function of spatial frequency? The MTF answers this as a curve from DC (unity) to the diffraction cutoff (zero).
The MTF is the magnitude of the OTF:
Key reference frequencies:
where $p$ is the detector pixel pitch.
Phase transfer. MTF is the modulus of the optical transfer function; the phase component (PTF) describes spatial shifts that can produce edge ringing or asymmetric blur. Coma and other odd aberrations have significant PTF signatures that MTF alone does not reveal.
MTF is the preferred specification metric for imaging systems with well-defined spatial frequency requirements. Use MTF50 (frequency at 50% contrast) for general resolution comparisons, MTF at Nyquist for detector-matched systems, and area under the MTF curve for weighted sharpness. Always evaluate at multiple field positions.
How does the geometric spot size at each field change as the image plane is shifted along the optical axis? Where is the best-focus position for each field, and how far apart are those positions?
For each field, rays are traced once to the nominal image plane and then propagated analytically along their direction cosines:
RMS radius is evaluated at each defocus step. Best-focus is found by parabolic fit on $r_{\text{RMS}}^2$ at the three lowest-RMS samples. The scan range is set by the depth of focus,
with the full scan spanning $\pm 5\,\delta z_{\text{DoF}}$.
Wavelength dependence. Each through-focus curve here is computed at the reference wavelength only; chromatic best-focus shift (longitudinal color) is not visualized in the same plot. Aberration balance also matters: a system with significant spherical aberration shows asymmetric through-focus curves, with best focus shifted away from the paraxial focus toward the marginal focus.
Used to estimate manufacturing focus tolerance (how much detector axial misalignment is acceptable before performance degrades), to identify the field whose best focus differs most from the design image plane (worst-case for a planar sensor), and to verify that autofocus has placed the image plane sensibly.
What fraction of the geometric rays from a point object fall within radius $r$ of the spot centroid? Equivalently, how concentrated is the geometric image?
For each field, ray distances from centroid are sorted; the cumulative fraction at radius $r$ is plotted. The diffraction-limited reference is the analytical Airy encircled energy:
where $J_0, J_1$ are Bessel functions of the first kind. At the first dark ring ($x \approx 3.8317$, $r = 1.22\lambda F/\#$), $E \approx 0.838$.
Pupil amplitude weighting. This plot treats every ray equally; real systems with apodization, vignetting, or coating non-uniformity have weighted energy distributions that the geometric ray density does not capture. For paraxial-aberration-free systems, geometric encircled energy approaches a step function, which can be misleading when compared to the diffraction limit.
EE is the natural metric for systems coupling into apertures: fiber-coupled receivers, pinhole spectrographs, slit instruments, photometric apertures in astronomy. Spec the system against the application's acceptance radius, not against an Airy multiple.
How does MTF at a fixed spatial frequency vary as the image plane is shifted along the axis? Where is the diffraction-MTF best focus for each field, and is it the same as the geometric best focus?
For each field the wavefront at the nominal image plane is computed once, then a quadratic defocus phase is added at each scan position:
where $\rho^2 = p_x^2 + p_y^2$ is the normalized pupil radial coordinate. The PSF and MTF are recomputed at each defocus by FFT of the modified pupil function. This is much faster than re-tracing rays for each focus position.
Field-dependent astigmatism. The defocus phase is symmetric in $\rho$, but real off-axis fields have astigmatic best focus that differs between sagittal and tangential lines. Plotting sagittal and tangential MTF separately recovers this; comparing only to the on-axis MTF can mask astigmatic imbalance.
Quantifies focus tolerance against an MTF specification. If the system must maintain MTF $\geq M_0$ at frequency $f_0$ across the field, the through-focus MTF curves directly bound the allowable focus shift. The spread of per-field MTF best-focus positions is also the most honest measure of how flat the system is across the field at a given resolution criterion.
How does the real chief-ray image height deviate from the paraxial F-tan(θ) relation as a function of field?
Distortion percentage is defined relative to paraxial image height:
For finite-conjugate object-height fields, the paraxial image height is replaced by $h_{\text{paraxial}} = -m\,h_{\text{obj}}$ where $m = -\text{imageZ}/\text{objectDistance}$.
Local mapping behavior versus monotonic departure. A system with pure third-order distortion has a monotonic $h_{\text{real}}$ vs $h_{\text{paraxial}}$, but mixed third + fifth order can produce mustache distortion that crosses zero at intermediate fields. Reading only the maximum percentage misses the mid-field reversal.
Use to assess whether the application can tolerate computational rectification. Imaging metrology and machine vision typically require <0.1%; consumer cameras tolerate several percent. For systems with active rectification, distortion magnitude trades against lateral color, since correcting one and not the other introduces wavelength-dependent residuals.
Where do the sagittal and tangential line foci land relative to the design image plane as a function of field? How wide is the astigmatic separation T − S across the field?
For each field, two close ray pairs are traced. Sagittal: $(p_x,p_y)=(\pm\delta, 0)$; tangential: $(\pm 0, \pm\delta)$. The sagittal line focus is the axial position where the two sagittal rays cross in $x$:
and similarly for tangential using $y$ and $M/N$. The astigmatic separation at each field is $\Delta z_T - \Delta z_S$; the Petzval-curvature contribution is approximately their mean.
Skew rays. The diagnostic uses only meridional ray pairs; the actual sagittal/tangential focal surfaces are constructions from infinitesimal ray pencils. For systems with significant higher-order aberrations or non-rotationally-symmetric construction, this 4-ray approximation can miss real astigmatic complexity.
Determines whether the design can use a planar detector. For sensors with depth-of-focus comparable to the field-curvature sag, no field flattener is needed; for tight tolerances or large fields, this plot identifies whether a thin field flattener near the image plane is required. The T − S split also indicates how much astigmatism the design has, which usually trades against coma and chromatic correction.
Each visualization in this dashboard represents a partial projection of the system's optical state. The spot diagram shows geometric ray behavior without diffraction. The OPD map shows wavefront shape without amplitude. The PSF shows monochromatic response without spectral weighting. The MTF shows contrast transfer without phase.
The canonical example: correcting spherical aberration improves RMS wavefront error but introduces a characteristic MTF dip at mid-frequencies before recovering near cutoff. A system optimized purely for RMS may fail an MTF floor specification even though it exceeds an RMS ceiling specification. The plots must be read together.
For small aberrations, these metrics are related:
As aberrations grow beyond $\lambda/10$ RMS, this relationship breaks down and the specific aberration distribution matters. Spherical aberration, coma, and astigmatism with identical RMS produce very different MTF curves.
Aberration content determines how many resolution elements can be recovered across the field. Severe field curvature may require multiple focal planes or curved detectors. Distortion affects geometric fidelity but not local resolution. The sampling analysis must match the aberration regime: a system dominated by coma requires finer angular sampling than one dominated by defocus.
First-order alignment errors introduce specific aberration signatures:
An OPD map that shows unexpected coma at the center field position suggests alignment error, not design deficiency. The Zernike decomposition assists in distinguishing alignment-induced aberrations from residual design aberrations.
Surface figure errors and material inhomogeneity add to the design wavefront. As-built performance is the convolution of design OPD with fabrication OPD:
A design that consumes the entire wavefront error budget leaves no margin for manufacturing; typical practice reserves 50-70% of the budget for fabrication contributions. This dashboard shows design-only performance; system leads must apply appropriate margin.
The transition criterion is the ratio of geometric blur to Airy disk diameter:
In the transition regime, neither domain fully applies. Both geometric and diffraction analyses should be consulted, and specifications should be stated in terms of the metric that most directly maps to application requirements. For detector-limited systems, ensquared energy within a pixel may be more relevant than either spot size or Strehl.