RayCrafter (dev) vs Zemax
Object in water under a coverslip: RayCrafter (dev) against Zemax
An object point in water under a coverslip, exported by RayCrafter and traced by Zemax. Rays, spots and the RMS wavefront match (0.03445 against 0.03442 waves). The Strehl ratio is not compared: RayCrafter's is 0.954, which is what the RMS wavefront both programs agree on gives, exp(-(2π × 0.0344)²) = 0.954, and what Zemax's own wavefront map (0.954) and FFT PSF (0.9543) give; Zemax's Huygens PSF gives 0.961, from a reference sphere of the opposite sign (its exit pupil position is +1.4 mm; evaluation #84). RayCrafter reproduces that Huygens grid to 0.002 with the sphere reversed.
The design
An object point in water (object-space NA 0.03 = n sin theta) under a 0.17 mm N-BK7 coverslip, imaged by a Thorlabs AC254-050-A at 550 nm.

What is tested
An object in a medium: Zemax's surface 0 glass, and what Zemax takes object-space NA to be there.
Issue: raycrafter #202.
RayCrafter against Zemax
RayCrafter at commit 5ecb2efd of
dev, not the release on PyPI. The .zmx was exported at
d5d3377b.
RayCrafter opens the project itself; Zemax (OpticStudio
24.1.3) the .zmx RayCrafter exported from it.
So a difference may be in the export, in a calculation, or in what a quantity means. Each row is
the largest difference over every field (0 mm).
Every row matches Zemax.
All 17 rows, matches included
| Quantity | Largest difference from Zemax | Match / partial within | Result |
|---|---|---|---|
| Zemax reads the aperture, fields, wavelength and afocal setting that were meant | 0 warnings | 0 / 0 warnings | Match |
| Surfaces: thicknesses, gaps and semi-diametersThe project file against the lens data Zemax holds | 0 mm | 1e−09 / 1e−06 mm | Match |
| Surfaces: curvatures and conicsCurvature in 1/mm | 0 | 1e−12 / 1e−09 | Match |
| Refractive index of each glassN-BAF10, N-BK7, SF10 | 0 | 1e−06 / 0.0001 | Match |
| Rays at the image, ray by ray: positionThe rays that both programs trace and get through: 1261 at 0 | 6.5e−08 mm | 1e−06 / 0.001 mm | Match |
| Rays at the image, ray by ray: slopedx/dz and dy/dz | 1.19e−09 | 1e−08 / 1e−05 | Match |
| Share of the pupil's rays that get through the aperturesRayCrafter's vignetting analysis against the range that Zemax's rings of rays allow: at 0, RayCrafter 100.0 %, Zemax 100.0 to 100.0 % (1261 of 1261 rays through) | 0 % points | 0.5 / 2 % points | Match |
| Chief ray at the image, every field | 0 mm | 1e−06 / 0.001 mm | Match |
| Focal length | 2.22e−14 % | 0.0001 / 0.1 % | Match |
| RMS spot radius, every fieldZemax by Gaussian quadrature, RayCrafter from its spot diagram | 0 % | 0.1 / 2 % | Match |
| Ray fans, tangential and sagittal | 6.5e−08 mm | 1e−06 / 0.001 mm | Match |
| RMS spot against focus, every fieldWhere the two ranges overlap | 0.04584 % of the largest | 0.1 / 2 % of the largest | Match |
| RMS wavefront, every field | 2.72e−05 waves | 0.001 / 0.01 waves, or 1 % of Zemax's if larger, to fail | Match |
| MTF (one wavelength), every fieldAt RayCrafter's own frequencies. | 0.002774 | 0.005 / 0.02 | Match |
| MTF (one wavelength), cutoff frequency, every fieldOf the fields where Zemax's table reaches beyond the cutoff. Cycles/mm, RayCrafter then Zemax: 101 and 100 | 0.7345 % | 2 / 5 % | Match |
| MTF (all wavelengths), every fieldAt RayCrafter's own frequencies. | 0.002774 | 0.005 / 0.02 | Match |
| MTF (all wavelengths), cutoff frequency, every fieldOf the fields where Zemax's table reaches beyond the cutoff. Cycles/mm, RayCrafter then Zemax: 101 and 100 | 0.7345 % | 2 / 5 % | Match |
Strehl ratio, fields where Zemax's Huygens PSF disagrees with its own wavefront map: Zemax reports a positive exit pupil position, and its Huygens PSF is reproduced by RayCrafter's summed over the reference sphere of the opposite sign to the one of Zemax's own wavefront map; the whole explanation, with the numbers, is in the section “Strehl ratio: Zemax's Huygens PSF disagrees with Zemax's own wavefront map” (https://github.com/raycrafter-optical-design/evaluation/issues/84). at 0 mm: Zemax 0.961, RayCrafter 0.954, Zemax's own wavefront map 0.954
Strehl ratio: Zemax's Huygens PSF disagrees with Zemax's own wavefront map
Where Zemax reports the exit pupil at a positive position, its Huygens PSF is the diffraction image of a different wavefront from the one in its own Wavefront Map, and the Strehl ratio it prints is not that of the wavefront it reports. RayCrafter's Strehl ratio is computed from the wavefront Zemax's map shows, summed over the reference sphere of the sign that map and Zemax's OPD use (it differs from Zemax's wavefront map by 0.000 at 0 mm, Zemax's FFT PSF by 0.000 at 0 mm). So the two Strehl ratios cannot be compared at these fields. This is an inconsistency inside Zemax's output; we do not claim to know that Zemax's code is wrong. Decision of the project's owner, evaluation #84: the page must say so in full, and it does here.
RayCrafter's Strehl ratio is read on the pixel grid of Zemax's Huygens PSF (its largest pixel, as Zemax reads it). The grid differences are the largest difference of relative intensity over the 128 x 128 pixels, RayCrafter's PSF against Zemax's: once with the reference sphere of the exit pupil as RayCrafter has it and as Zemax's own Wavefront Map and OPD have it, and once with the sphere's radius reversed (the one change; RayCrafter does the sum). Where the reversed sphere reproduces Zemax's grid and the right one does not, Zemax's Huygens PSF used the opposite sign.
| Field (mm) | Zemax exit pupil position (mm) | Strehl, Zemax Huygens | Strehl, RayCrafter (Zemax's grid) | Strehl of Zemax's own wavefront map | Peak of Zemax's FFT PSF | Grid difference, sphere as it is | Grid difference, sphere reversed |
|---|---|---|---|---|---|---|---|
| 0 mm | 1.42 | 0.961 | 0.954 | 0.9540 | 0.9543 | 0.0587 | 0.0024 |
Zemax's FFT PSF. Its text prints no Strehl ratio and its values are "not normalized". Read as a Strehl ratio, the largest value of its grid is on the scale where a perfect wavefront peaks at 1, as the fields where nothing tells the two signs apart show (nearly diffraction limited, so that the wavefront map's own Strehl ratio is known): no field of this page is one, so the scale is not checked here (on the folded designs' pages it is checked on the axis). That scale is read off those fields, not computed: Zemax gives no unaberrated PSF of the same sampling. The peak is a pixel of the 256 x 256 grid, so it can sit a little below the true peak. Where a column shows a dash, Zemax was not asked for the FFT PSF there, or for a wavefront map.
What is and is not shown. Shown: Zemax's Huygens grid is reproduced by RayCrafter with the sphere reversed, and by nothing else we tried. Not shown: why Zemax's Huygens PSF uses the sign it does, and why the Strehl ratio of Zemax's wavefront map (or its FFT PSF) differs from RayCrafter's by what the table gives (the programs sum the light differently: Zemax's FFT takes plane waves, RayCrafter and Zemax's Huygens PSF sum the wavelets of the reference sphere).
Rays
Both programs trace a hexapolar pupil, with the first point of each ring at +x, so the rays that both trace can be paired one by one: RayCrafter's spot diagram (6 rings) with Zemax's ray trace (20 rings).


RayCrafter's own plots
What RayCrafter's window and report draw, with Zemax's points over them (open markers).


The numbers behind the rows
For the rows that have no plot of their own. Zemax's values are from our own run; RayCrafter's from its analysis of the project.
| First order | Zemax | RayCrafter |
|---|---|---|
| effective focal length mm | 50.14 | 50.14 |
| Field | Chief ray, Zemax (mm) | Chief ray, RayCrafter (mm) | Share through, Zemax (%) | Share through, RayCrafter (%) | RMS spot, Zemax (mm) | RMS spot, RayCrafter (mm) | Strehl, Zemax | Strehl, RayCrafter | Worst ray position difference (mm) | Worst ray slope difference |
|---|---|---|---|---|---|---|---|---|---|---|
| 0 mm | 0 | 0 | 100 | 100 | 0.003522 | 0.003522 | 0.961 | 0.9543 | 6.505e-08 | 1.193e-09 |
Lens data
The radius and thickness in the project file beside the radius Zemax holds, with Zemax's catalogue and index for each glass.
| Zemax # | Type | Radius, RayCrafter (mm) | Radius, Zemax (mm) | Thickness (mm) | Glass | Semi-diameter (mm) |
|---|---|---|---|---|---|---|
| 1 | Standard (stop) | ∞ | ∞ | 0.17 | N-BK7 SCHOTT, n = 1.518522 | 11 |
| 2 | Standard | ∞ | ∞ | 95 | 11 | |
| 3 | Standard | 33.34 | 33.34 | 9 | N-BAF10 SCHOTT, n = 1.673057 | 12.7 |
| 4 | Standard | -22.28 | -22.28 | 2.5 | SF10 SCHOTT, n = 1.733661 | 12.7 |
| 5 | Standard | -291.07 | -291.07 | 97.714538 | 12.7 |
How Zemax was run
By make_zemax_reference.py, the same way for every design, on
2026-12-03 22:25, on immersion_object_under_coverslip.zmx exactly as
exported (0 failed steps). zmx_export.json ties
that file to the project, and the run refuses a file that does not fit it. What is asked for, and
why: zemax_analyses.md; every file:
Zemax_reference_output.
Reproduce
export UV_PROJECT_ENVIRONMENT=~/uv_venvs/evaluation_mac uv run python -m evaluation_tools.from_raycrafter.export_zmx --check immersion_object_under_coverslip uv run python -m evaluation_tools.from_raycrafter.compare_zemax immersion_object_under_coverslip uv run python -m evaluation_tools.build_summary
17 quantities compared.