RayCrafter (dev) vs Zemax
Asphere ACL2520U: RayCrafter (dev) against Zemax
The asphere ACL2520U, exported by RayCrafter and traced by Zemax. The surfaces are read as written, and the glass now agrees (raycrafter #216): rays, RMS spot radius, field curvature and focal length match. Not all matches: RMS spot against focus and RMS wavefront (0.0023 waves) are Partial, and the MTF fails at 1 deg: it differs from Zemax's Huygens MTF by 0.053 (from its FFT MTF by 0.050) and lies 0.033 outside the band between them, where the Strehl ratio is 0.009 and agrees. Zemax's FFT MTF assumes the pupil index is linear in the direction cosine, which its own rays here do not obey, so it is not the reference where that fails; Zemax's Huygens MTF, made on a grid fine enough to trust, is (evaluation #86).
Zemax's own two methods (FFT and Huygens) disagree with each other by more than our fail limit. The rows below keep their verdicts, each against one Zemax number. Where RayCrafter lies inside the band between Zemax's two numbers it is no further from either than they are from each other; where it lies outside, it is further from both than Zemax's own methods are from each other. Each row's note and Zemax against itself give both Zemax numbers, their difference and RayCrafter's value.
- MTF. Zemax's FFT MTF and its Huygens MTF differ by up to 0.099 (at 1 deg), 5.0 times our fail limit of 0.02. Taking every frequency, RayCrafter's MTF is beside the band (outside it by up to the fail limit of 0.02) at 0 deg; outside the band (by more than 0.02) at 1 deg, the band being the range between Zemax's two curves. Plots with both Zemax curves, the band and RayCrafter's: 1 deg.
- RMS wavefront. Zemax gives one number per field, so there is no Zemax spread to show for it.
- MTF (one wavelength), every field: differs by 0.05284
- MTF (all wavelengths), every field: differs by 0.05284
Glass: RayCrafter now uses Zemax's data for B270, the SCHOTT catalogue the exported file names (raycrafter #216); the index is the same to 1e-16, where it was 8e-5 below. The rays, focal length and Strehl ratio, which this moved, now match.
MTF: Zemax's pupil mapping departs from linear in the direction cosine by 0.012 (0 deg) and 0.024 (1 deg), against 0.005, so its FFT MTF is itself approximate and RayCrafter's MTF is scored against Zemax's Huygens MTF (evaluation #86). The Huygens MTF is on a window of 159 um (512 samples of 0.31 um) with a frequency step of 6.3 cycles/mm, and at 1 deg the window is 2.9 times the 55 um spot, so it passes the trust rule (huygens_trust.py: step at most 10 cycles/mm, window at least twice the spot). Against it RayCrafter differs by 0.0084 at 0 deg (Partial; 0.021 from the FFT MTF) and 0.053 at 1 deg (Fail; 0.050 from the FFT MTF). Zemax's own FFT and Huygens MTFs differ from each other by 0.025 and 0.099. Run 6 made the Huygens MTF on a 512 x 512 pupil (it was coarser), which moved the 1 deg difference from 0.062 to 0.053; Zemax's Geometric MTF (rays only, no diffraction) is drawn beside it, not scored. The not-comparable rule does not apply here: the density of rays in direction cosine varies only 1.17 and 1.23 times across the pupil (the rule needs more than 1.3), so the weighting of the pupil moves the MTF by less than the limit, and at 1 deg RayCrafter lies 0.033 outside the band between Zemax's two curves, over the limit of 0.02. The cause of that gap is not established (raycrafter #236 explains 0.011 to 0.024 of it, as the energy-conserving weighting RayCrafter now uses) (raycrafter #199).
RMS wavefront of a strongly aberrated image: RayCrafter now measures the phase about a sphere at the exit pupil, as Zemax does (raycrafter #199), so the two agree to 0.0023 waves of Zemax's 1.67 waves at the largest field; the difference is still more than the match threshold of 0.001 waves, so the row is Partial.
The design
Thorlabs ACL2520U-A conic condenser, the right way round, under a collimated 18 mm beam at 587.6 nm, 0 and 1 degree, image at RayCrafter's autofocus.

What is tested
RayCrafter's ZMX export of an asphere (it writes the PARM lines itself), and the rays through it traced by both programs.
Issue: raycrafter #160.
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°, 1°).
Not matching: partial and fail rows.
| Quantity | Largest difference from Zemax | Match / partial within | Result |
|---|---|---|---|
| RMS spot against focus, every fieldWhere the two ranges overlap | 0.5072 % of the largest | 0.1 / 2 % of the largest | Partial |
| RMS wavefront against fieldPiston and tilt removed; at the largest field, Zemax 1.674 and RayCrafter 1.672 waves. Zemax gives one RMS wavefront number per field (its RMS Wavefront operand), so there is no Zemax spread to show for this row: it compares that one number with RayCrafter's | 0.002309 waves | 0.001 / 0.01 waves, or 1 % of Zemax's if larger, to fail | Partial |
| MTF (one wavelength), every fieldAt RayCrafter's own frequencies. Zemax's Geometric MTF (rays only, no diffraction; shown as triangles, not scored) differs from RayCrafter's by 0 deg: 0.126; 1 deg: 0.082. Against Zemax's Huygens MTF, not its FFT MTF, at 0 deg, 1 deg: the FFT MTF takes the pupil index as linear in the direction cosine, and Zemax's own rays at the image depart from that by 0.012, 0.024 (more than 0.005; a plane fit of L and M on px, py, over half their range), while the Huygens MTF follows the rays' own directions. It is not exact either: it gives every ray of its pupil grid the same amplitude, so where the density of rays in direction cosine varies across the pupil it weights the pupil by that density, where conservation of energy gives its square root (evaluation #86, https://github.com/raycrafter-optical-design/evaluation/issues/86). The difference from the Huygens MTF there is 0.008, 0.053; from the FFT MTF, which is not scored there, 0.021, 0.050. Zemax's own FFT and Huygens MTFs differ from each other by 0.025, 0.099 at 0 deg, 1 deg (largest of the two azimuths). Zemax's own FFT and Huygens MTFs differ by more than the fail limit (0.02) at 0 deg, 1 deg, so matching Zemax is a band, not a line (zemax-spread). 0 deg: at 70 cycles/mm, where Zemax's two MTFs differ most (tangential), Zemax FFT 0.533, Zemax Huygens 0.557 (they differ by 0.025, 1.2 times the fail limit), RayCrafter 0.550: inside the band, 0.007 from the nearer Zemax value; over all frequencies RayCrafter is at most 0.004 outside the band; 1 deg: at 32 cycles/mm, where Zemax's two MTFs differ most (sagittal), Zemax FFT 0.361, Zemax Huygens 0.460 (they differ by 0.099, 5.0 times the fail limit), RayCrafter 0.412: inside the band, 0.048 from the nearer Zemax value; over all frequencies RayCrafter is at most 0.033 outside the band | 0.05284 | 0.005 / 0.02 | Fail |
| MTF (all wavelengths), every fieldAt RayCrafter's own frequencies. Zemax's Geometric MTF (rays only, no diffraction; shown as triangles, not scored) differs from RayCrafter's by 0 deg: 0.126; 1 deg: 0.082. Against Zemax's Huygens MTF, not its FFT MTF, at 0 deg, 1 deg: the FFT MTF takes the pupil index as linear in the direction cosine, and Zemax's own rays at the image depart from that by 0.012, 0.024 (more than 0.005; a plane fit of L and M on px, py, over half their range), while the Huygens MTF follows the rays' own directions. It is not exact either: it gives every ray of its pupil grid the same amplitude, so where the density of rays in direction cosine varies across the pupil it weights the pupil by that density, where conservation of energy gives its square root (evaluation #86, https://github.com/raycrafter-optical-design/evaluation/issues/86). The difference from the Huygens MTF there is 0.008, 0.053; from the FFT MTF, which is not scored there, 0.021, 0.050. Zemax's own FFT and Huygens MTFs differ from each other by 0.025, 0.099 at 0 deg, 1 deg (largest of the two azimuths). Zemax's FFT and Huygens MTFs are of one wavelength: the numbers against the band are in the note of the one-wavelength row and in the section on Zemax against itself | 0.05284 | 0.005 / 0.02 | Fail |
All 24 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 glassB270 | 0 | 1e−06 / 0.0001 | Match |
| Rays at the image, ray by ray: positionThe rays that both programs trace and get through: 469 at 0, 469 at 1 | 8.99e−08 mm | 1e−06 / 0.001 mm | Match |
| Rays at the image, ray by ray: slopedx/dz and dy/dz | 4.14e−10 | 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 % (469 of 469 rays through); at 1, RayCrafter 100.0 %, Zemax 100.0 to 100.0 % (469 of 469 rays through) | 0 % points | 0.5 / 2 % points | Match |
| Chief ray at the image, every field | 8.33e−16 mm | 1e−06 / 0.001 mm | Match |
| Focal length and f-numberCompares Zemax's image-space F/# with RayCrafter's f-number, which is the focal length over the diameter of the beam that gets through; for an unclipped beam that is the same quantity, so the two agree to rounding (they differ only where a rim clips the beam, as on clipped_negative_lens, where it is recorded, not scored) | 0 % | 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 | 8.99e−08 mm | 1e−06 / 0.001 mm | Match |
| RMS spot against focus, every fieldWhere the two ranges overlap | 0.5072 % of the largest | 0.1 / 2 % of the largest | Partial |
| RMS spot against fieldFrom the axis to the largest field, 21 angles | 0 % | 0.1 / 2 % | Match |
| RMS wavefront against fieldPiston and tilt removed; at the largest field, Zemax 1.674 and RayCrafter 1.672 waves. Zemax gives one RMS wavefront number per field (its RMS Wavefront operand), so there is no Zemax spread to show for this row: it compares that one number with RayCrafter's | 0.002309 waves | 0.001 / 0.01 waves, or 1 % of Zemax's if larger, to fail | Partial |
| Strehl ratio, every fieldRayCrafter's Strehl ratio on the pixel grid of Zemax's Huygens PSF, as Zemax reads its own (its largest pixel); Zemax's prints three decimals. | 0.002292 | 0.005 / 0.02 | Match |
| MTF (one wavelength), every fieldAt RayCrafter's own frequencies. Zemax's Geometric MTF (rays only, no diffraction; shown as triangles, not scored) differs from RayCrafter's by 0 deg: 0.126; 1 deg: 0.082. Against Zemax's Huygens MTF, not its FFT MTF, at 0 deg, 1 deg: the FFT MTF takes the pupil index as linear in the direction cosine, and Zemax's own rays at the image depart from that by 0.012, 0.024 (more than 0.005; a plane fit of L and M on px, py, over half their range), while the Huygens MTF follows the rays' own directions. It is not exact either: it gives every ray of its pupil grid the same amplitude, so where the density of rays in direction cosine varies across the pupil it weights the pupil by that density, where conservation of energy gives its square root (evaluation #86, https://github.com/raycrafter-optical-design/evaluation/issues/86). The difference from the Huygens MTF there is 0.008, 0.053; from the FFT MTF, which is not scored there, 0.021, 0.050. Zemax's own FFT and Huygens MTFs differ from each other by 0.025, 0.099 at 0 deg, 1 deg (largest of the two azimuths). Zemax's own FFT and Huygens MTFs differ by more than the fail limit (0.02) at 0 deg, 1 deg, so matching Zemax is a band, not a line (zemax-spread). 0 deg: at 70 cycles/mm, where Zemax's two MTFs differ most (tangential), Zemax FFT 0.533, Zemax Huygens 0.557 (they differ by 0.025, 1.2 times the fail limit), RayCrafter 0.550: inside the band, 0.007 from the nearer Zemax value; over all frequencies RayCrafter is at most 0.004 outside the band; 1 deg: at 32 cycles/mm, where Zemax's two MTFs differ most (sagittal), Zemax FFT 0.361, Zemax Huygens 0.460 (they differ by 0.099, 5.0 times the fail limit), RayCrafter 0.412: inside the band, 0.048 from the nearer Zemax value; over all frequencies RayCrafter is at most 0.033 outside the band | 0.05284 | 0.005 / 0.02 | Fail |
| MTF (one wavelength), cutoff frequency, every fieldOf the fields where Zemax's table reaches beyond the cutoff. Cycles/mm, RayCrafter then Zemax: 1608 and 1597; 1609 and 1597 | 0.7561 % | 2 / 5 % | Match |
| MTF (all wavelengths), every fieldAt RayCrafter's own frequencies. Zemax's Geometric MTF (rays only, no diffraction; shown as triangles, not scored) differs from RayCrafter's by 0 deg: 0.126; 1 deg: 0.082. Against Zemax's Huygens MTF, not its FFT MTF, at 0 deg, 1 deg: the FFT MTF takes the pupil index as linear in the direction cosine, and Zemax's own rays at the image depart from that by 0.012, 0.024 (more than 0.005; a plane fit of L and M on px, py, over half their range), while the Huygens MTF follows the rays' own directions. It is not exact either: it gives every ray of its pupil grid the same amplitude, so where the density of rays in direction cosine varies across the pupil it weights the pupil by that density, where conservation of energy gives its square root (evaluation #86, https://github.com/raycrafter-optical-design/evaluation/issues/86). The difference from the Huygens MTF there is 0.008, 0.053; from the FFT MTF, which is not scored there, 0.021, 0.050. Zemax's own FFT and Huygens MTFs differ from each other by 0.025, 0.099 at 0 deg, 1 deg (largest of the two azimuths). Zemax's FFT and Huygens MTFs are of one wavelength: the numbers against the band are in the note of the one-wavelength row and in the section on Zemax against itself | 0.05284 | 0.005 / 0.02 | Fail |
| MTF (all wavelengths), cutoff frequency, every fieldOf the fields where Zemax's table reaches beyond the cutoff. Cycles/mm, RayCrafter then Zemax: 1608 and 1597; 1609 and 1597 | 0.7561 % | 2 / 5 % | Match |
| Grid distortion, largestZemax 0.003422 % | 1.78e−07 percentage points | 0.005 / 0.05 percentage points | Match |
| Distortion, f-tanAt the largest field: Zemax -0.003422 %, RayCrafter -0.003422 % | 3.51e−11 percentage points | 0.005 / 0.05 percentage points | Match |
| Distortion, f-thetaAt the largest field: Zemax 0.006733 %, RayCrafter 0.006733 % | 6.69e−11 percentage points | 0.005 / 0.05 percentage points | Match |
| Field curvature, change from the axisAt 0, 1°, the angles RayCrafter plots | 0.000113 mm | 0.01 / 0.1 mm | Match |
| Field curvatureRayCrafter takes the best focus of a whole fan, Zemax that of rays near the chief ray, so they differ with spherical aberration | 0.000113 mm | 0.01 / 0.1 mm | Match |
Zemax against itself
Where Zemax's own two methods disagree by more than the fail limit, a single Zemax number is not what RayCrafter should match. Both Zemax numbers are shown here and in the plots, with RayCrafter's. No tolerance or verdict is changed by this section. RMS wavefront against field has one Zemax number only, so there is nothing to spread for it.
MTF: FFT against Huygens
Zemax computes the MTF two ways. The values are at the spatial frequency where its two curves differ most (the worse azimuth). RayCrafter is inside the band when it lies between the two Zemax values, beside it when it is outside by up to the fail limit (0.02), and outside it beyond that; the last column is the largest such distance over all frequencies. The band is shaded in the plots.
| Field | At (cycles/mm) | Zemax FFT MTF | Zemax Huygens MTF | Zemax's own difference | RayCrafter MTF | RayCrafter against the band there | Largest distance outside the band, all frequencies |
|---|---|---|---|---|---|---|---|
| 0 deg | 70 | 0.533 | 0.557 | 0.025 | 0.550 | inside the band, 0.007 from the nearer Zemax value | 0.004 |
| 1 deg | 32 | 0.361 | 0.460 | 0.099 | 0.412 | inside the band, 0.048 from the nearer Zemax value | 0.033 |

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 (12 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 | 20 | 20 |
| f number | 1.111 | 1.111 |
| 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° | 0 | 0 | 100 | 100 | 0.003575 | 0.003575 | 0.178 | 0.1803 | 9.155e-15 | 6.262e-16 |
| 1° | 0.3482 | 0.3482 | 100 | 100 | 0.01278 | 0.01278 | 0.009 | 0.008437 | 8.985e-08 | 4.144e-10 |
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 | Even Asphere (stop) | 10.462 | 10.462 | 12 | B270 SCHOTT, n = 1.523078 | 12.5 |
| 2 | Standard | ∞ | ∞ | 12.072273 | 12.5 |
How Zemax was run
By make_zemax_reference.py, the same way for every design, on
2026-12-04 13:31, on asphere_ACL2520U.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 asphere_ACL2520U uv run python -m evaluation_tools.from_raycrafter.compare_zemax asphere_ACL2520U uv run python -m evaluation_tools.build_summary
24 quantities compared.