RayCrafter (dev) vs Zemax
Asphere AL7560: RayCrafter (dev) against Zemax
The asphere AL7560, exported by RayCrafter and traced by Zemax. The surfaces are read as written. Rays, RMS spot radius and field curvature match. Not all matches: the RMS wavefront differs by up to 0.0105 waves, and the MTF on the axis by 0.016.
The design
Thorlabs AL7560, with high-order terms below 1e-16, the right way round, under a collimated 60 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. The RMS spot radius also re-checks the fix of #170.
Issue: raycrafter #160, raycrafter #170.
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.544 % of the largest | 0.1 / 2 % of the largest | Partial |
| RMS wavefront against fieldPiston and tilt removed; at the largest field, Zemax 6.57 and RayCrafter 6.559 waves. The difference is over 0.01 waves but within 1 % of Zemax's value, so it is not a fail | 0.01051 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. RayCrafter gives none for 1 of 2: “The aberrations are too large for a diffraction calculation: far below the diffraction limit. The spot diagram is the better guide”. RayCrafter's PSF weights each ray by sqrt(J), J being how far its part of the pupil spreads over direction cosine, so that energy is conserved (raycrafter #236); Zemax's Huygens PSF gives every ray the same amplitude. With every ray at the same amplitude RayCrafter's Strehl ratio is 0.1186 at 0 deg (0.0046 from Zemax's 0.114, against 0.0052 as it is). The row scores RayCrafter as it is | 0.005212 | 0.005 / 0.02 | Partial |
| MTF (one wavelength), every fieldAt RayCrafter's own frequencies. Zemax says its sampling is too low at this field. Partial, not Fail, at 0 deg: Zemax's 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.016 (more than 0.005; a plane fit of L and M on px, py, over half their range). The difference from the FFT MTF there is 0.021. Zemax's Huygens MTF, which makes no such assumption, is the comparison to make (evaluation #86, https://github.com/raycrafter-optical-design/evaluation/issues/86); it is not available here as a trusted reference. Not a tolerance that grows with the departure: the difference stays in the row | 0.02112 | 0.005 / 0.02 | Partial |
| MTF (all wavelengths), every fieldAt RayCrafter's own frequencies. Zemax says its sampling is too low at this field. Partial, not Fail, at 0 deg: Zemax's 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.016 (more than 0.005; a plane fit of L and M on px, py, over half their range). The difference from the FFT MTF there is 0.021. Zemax's Huygens MTF, which makes no such assumption, is the comparison to make (evaluation #86, https://github.com/raycrafter-optical-design/evaluation/issues/86); it is not available here as a trusted reference. Not a tolerance that grows with the departure: the difference stays in the row | 0.02112 | 0.005 / 0.02 | Partial |
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 glassN-BK7 | 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 | 1.41e−07 mm | 1e−06 / 0.001 mm | Match |
| Rays at the image, ray by ray: slopedx/dz and dy/dz | 2.46e−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 | 2.22e−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) | 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 | 2.36e−07 mm | 1e−06 / 0.001 mm | Match |
| RMS spot against focus, every fieldWhere the two ranges overlap | 0.544 % 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 6.57 and RayCrafter 6.559 waves. The difference is over 0.01 waves but within 1 % of Zemax's value, so it is not a fail | 0.01051 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. RayCrafter gives none for 1 of 2: “The aberrations are too large for a diffraction calculation: far below the diffraction limit. The spot diagram is the better guide”. RayCrafter's PSF weights each ray by sqrt(J), J being how far its part of the pupil spreads over direction cosine, so that energy is conserved (raycrafter #236); Zemax's Huygens PSF gives every ray the same amplitude. With every ray at the same amplitude RayCrafter's Strehl ratio is 0.1186 at 0 deg (0.0046 from Zemax's 0.114, against 0.0052 as it is). The row scores RayCrafter as it is | 0.005212 | 0.005 / 0.02 | Partial |
| MTF (one wavelength), every fieldAt RayCrafter's own frequencies. Zemax says its sampling is too low at this field. Partial, not Fail, at 0 deg: Zemax's 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.016 (more than 0.005; a plane fit of L and M on px, py, over half their range). The difference from the FFT MTF there is 0.021. Zemax's Huygens MTF, which makes no such assumption, is the comparison to make (evaluation #86, https://github.com/raycrafter-optical-design/evaluation/issues/86); it is not available here as a trusted reference. Not a tolerance that grows with the departure: the difference stays in the row | 0.02112 | 0.005 / 0.02 | Partial |
| MTF (one wavelength), cutoff frequency, every fieldOf the fields where Zemax's table reaches beyond the cutoff. Cycles/mm, RayCrafter then Zemax: 1828 and 1815 | 0.7276 % | 2 / 5 % | Match |
| MTF (all wavelengths), every fieldAt RayCrafter's own frequencies. Zemax says its sampling is too low at this field. Partial, not Fail, at 0 deg: Zemax's 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.016 (more than 0.005; a plane fit of L and M on px, py, over half their range). The difference from the FFT MTF there is 0.021. Zemax's Huygens MTF, which makes no such assumption, is the comparison to make (evaluation #86, https://github.com/raycrafter-optical-design/evaluation/issues/86); it is not available here as a trusted reference. Not a tolerance that grows with the departure: the difference stays in the row | 0.02112 | 0.005 / 0.02 | Partial |
| MTF (all wavelengths), cutoff frequency, every fieldOf the fields where Zemax's table reaches beyond the cutoff. Cycles/mm, RayCrafter then Zemax: 1828 and 1815 | 0.7276 % | 2 / 5 % | Match |
| Grid distortion, largestZemax 0.0034 % | 4.18e−06 percentage points | 0.005 / 0.05 percentage points | Match |
| Distortion, f-tanAt the largest field: Zemax -0.003396 %, RayCrafter -0.003396 % | 3.47e−11 percentage points | 0.005 / 0.05 percentage points | Match |
| Distortion, f-thetaAt the largest field: Zemax 0.006759 %, RayCrafter 0.006759 % | 6.7e−11 percentage points | 0.005 / 0.05 percentage points | Match |
| Field curvature, change from the axisAt 0, 1°, the angles RayCrafter plots | 0.000391 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.000391 mm | 0.01 / 0.1 mm | Match |
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 | 59.35 | 59.35 |
| f number | 0.9891 | 0.9891 |
| 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.001676 | 0.001676 | 0.114 | 0.1192 | 3.201e-14 | 6.939e-16 |
| 1° | 1.036 | 1.036 | 100 | 100 | 0.04519 | 0.04519 | 0.002 | none | 1.413e-07 | 2.456e-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) | 30.67 | 30.67 | 35.5 | N-BK7 SCHOTT, n = 1.516798 | 37.5 |
| 2 | Standard | ∞ | ∞ | 35.946243 | 37.5 |
How Zemax was run
By make_zemax_reference.py, the same way for every design, on
2026-12-03, on asphere_AL7560.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_AL7560 uv run python -m evaluation_tools.from_raycrafter.compare_zemax asphere_AL7560 uv run python -m evaluation_tools.build_summary
24 quantities compared.