Optiland and RayCrafter (dev) vs Zemax
Relay with custom spherical aberration: Optiland and RayCrafter (dev) against Zemax
Two groups of plano-convex lenses relaying a collimated 15 mm beam, to see how much spherical aberration they add. With the ignored surfaces taken out, Optiland traces every ray where Zemax does, to rounding error. Its default wavefront is 2.4 waves out here; its plane reference (afocal=True) matches Zemax but for the sign. RayCrafter (dev) agrees on the focal length and, since the pupil coordinates of an inverted stop are taken at the entrance pupil (raycrafter #212), on the ray fan (1e-8 mm; it was 14.98 mm apart, reversed), and its image is now where Zemax's is. With raycrafter #218 (a2f0adf) it gives the RMS wavefront of this nearly collimated output; its own wavefront map, fitted as Zemax's Wavefront Map is (piston and tilt over the pupil, raycrafter #243), gives 7.659 waves against 7.613 in Zemax's (0.6 %, Partial; within what Zemax's 64 x 64 grid itself moves an RMS by; the number RayCrafter reports, with the tilt taken out its own way, is 7.651), once the exit pupil of the pivoted beam is taken where Zemax has it (on the image plane); it gives no PSF or Strehl ratio, which Zemax did not make either (raycrafter #218).
- Optiland: OPD of every ray, differs by 2.396 waves
- Optiland: Zernike coefficients (37 standard), differs by 0.7958 waves
- Optiland: RMS wavefront of every field, from Optiland's OPD, differs by 0.6944 waves
- Optiland: Afocal: OPD of every ray, afocal=True as it comes, differs by 53.07 waves
- Optiland: Afocal: Zernike coefficients, afocal=True as it comes, differs by 26.15 waves
Every failing row of the tables below, against our own Zemax run.
- Optiland: surfaces set to be ignored are traced. The file's two doublets are ignored in Zemax. Without our workaround Optiland traces them, with no warning, and the rays are wrong. Cause: Optiland's Zemax reader does not read the flag (issue 28). Upstream: not yet filed.
- Optiland: the default wavefront with the exit pupil at the image. OPD and Zernike coefficients differ from Zemax's by up to 2.4 and 0.8 waves. Cause: not located; the reference sphere's radius is all but zero here (issue 30). Upstream: not yet filed.
- Optiland: the sign of the afocal wavefront. With afocal=True the OPD and Zernikes are Zemax's with the opposite sign. Cause: not located (issue 29). Upstream: not yet filed.
System layout
WorksDrawn from Optiland's surface positions and rays, with the four surfaces Zemax ignores taken out.


Optiland against Zemax
Optiland 0.6.3, as released, with the file preparation and patches listed under "Optiland issues found". Nothing here uses RayCrafter. Each row is the largest difference from our own Zemax run (OpticStudio 24.1.3) over every galvo angle or field of every system below.
Not matching: partial and fail rows.
| Quantity | Largest difference from Zemax | Match / partial within | Result |
|---|---|---|---|
| OPD of every rayDefault reference sphere, exit pupil at the image (issue 30); see the afocal rows | 2.396 waves | 0.001 / 0.01 waves | Fail |
| Zernike coefficients (37 standard) | 0.7958 waves | 0.001 / 0.01 waves | Fail |
| RMS wavefront of every field, from Optiland's OPDPiston and tilt removed, as Zemax does. 8.35 against 7.66 waves (issue 30) | 0.6944 waves | 0.001 / 0.01 waves, or 1 % of Zemax's if larger, to fail | Fail |
| Afocal: OPD of every ray, afocal=True as it comesThe sign is opposite to Zemax's (issue 29) | 53.07 waves | 0.001 / 0.01 waves | Fail |
| Afocal: Zernike coefficients, afocal=True as it comesThe sign is opposite to Zemax's (issue 29) | 26.15 waves | 0.001 / 0.01 waves | Fail |
All 17 rows, matches included
| Quantity | Largest difference from Zemax | Match / partial within | Result |
|---|---|---|---|
| Refractive index of each glassN-BK7 | 2.22e−16 | 1e−06 / 0.0001 | Match |
| Position of every surface | 5.68e−14 mm | 1e−09 / 1e−06 mm | Match |
| Rays at the image, ray by rayThe rays Zemax traced, every galvo angle or field | 7.16e−15 mm | 1e−06 / 0.001 mm | Match |
| Ray directions at the imageDirection cosines. Zemax's are reversed after an odd number of mirrors | 1.22e−15 | 1e−09 / 1e−06 | Match |
| Largest ray radius on every surface | 1.78e−14 mm | 1e−06 / 0.001 mm | Match |
| RMS spot of the same raysThe rays that get through, every one counted alike | 0 % | 0.1 / 2 % | Match |
| Focal length, f-number, exit pupilSizes; Optiland's signs may differ after a mirror. Both put the exit pupil within 1 µm of the image | 5.95e−07 % | 0.0001 / 0.1 % | Match |
| OPD of every rayDefault reference sphere, exit pupil at the image (issue 30); see the afocal rows | 2.396 waves | 0.001 / 0.01 waves | Fail |
| Zernike coefficients (37 standard) | 0.7958 waves | 0.001 / 0.01 waves | Fail |
| RMS spot of every field, from Optiland's raysWith the pupil averaging Zemax uses (Gaussian quadrature) | 0 % | 0.1 / 2 % | Match |
| RMS wavefront of every field, from Optiland's OPDPiston and tilt removed, as Zemax does. 8.35 against 7.66 waves (issue 30) | 0.6944 waves | 0.001 / 0.01 waves, or 1 % of Zemax's if larger, to fail | Fail |
| Seidel coefficients, sizesZemax prints six decimals. Optiland's signs may be opposite | 4.99e−07 mm | 1e−06 / 1e−05 mm | Match |
| Afocal: OPD of every ray, afocal=True as it comesThe sign is opposite to Zemax's (issue 29) | 53.07 waves | 0.001 / 0.01 waves | Fail |
| Afocal: OPD of every ray, sign turned | 1.97e−07 waves | 0.001 / 0.01 waves | Match |
| Afocal: Zernike coefficients, afocal=True as it comesThe sign is opposite to Zemax's (issue 29) | 26.15 waves | 0.001 / 0.01 waves | Fail |
| Afocal: Zernike coefficients, sign turned | 9.78e−08 waves | 0.001 / 0.01 waves | Match |
| Afocal: RMS wavefront, from Optiland's OPDPiston and tilt removed | 5.68e−08 waves | 0.001 / 0.01 waves, or 1 % of Zemax's if larger, to fail | Match |
RayCrafter against Zemax
Tested at commit 5ecb2efd of dev, not the release on PyPI.
The rows below are on a system with a flat image.
Not matching: partial and fail rows.
| Quantity | Largest difference from Zemax | Match / partial within | Result |
|---|---|---|---|
| RMS wavefront against Zemax's Wavefront Map, every fieldRayCrafter gives the RMS wavefront but no PSF or Strehl ratio (No diffraction image: the image plane is far from any focus, so the wavefront changes too fast across the pupil for a diffraction calculation. The RMS wavefront error is given; the spot diagram is the better guide) and Zemax made neither, so the RMS is compared with Zemax's Wavefront Map (piston and tilt removed) at 0 deg. Both numbers are fitted the same way: the evaluation takes a least-squares plane (piston and tilt) out of Zemax's Wavefront Map and out of RayCrafter's own wavefront map over the pupil, every point that got through alike (raycrafter #243, Rob's decision of 2026-12-04). RayCrafter's reported RMS wavefront and Zemax's RMS operand, which take the tilt out in direction cosines on a focused image, are a different convention (on the focused designs of #243 a plane in pupil coordinates was 1.5 to 8 % from Zemax's operand), so they are not what is compared here. RayCrafter's map is traced with 513 rays across the part of the pupil that gets light, where its RMS has converged (its window's 65 were 1.6 % low on US005899585 at 15.12 mm). Zemax's map is 64 x 64, and on a field whose rays are stopped where the wavefront is steep its RMS depends on where its grid falls: on US005899585 at 15.12 and 21.6 mm a 64 x 64 grid moved by under a step changes the RMS by 0.9 % (one standard deviation), so differences of that size can be Zemax's sampling. RayCrafter's own reported RMS wavefront, for information (waves): 0 deg: 7.651 (fitted 7.659). The difference is over 0.01 waves but within 1 % of Zemax's value, so it is not a fail | 0.04662 waves | 0.001 / 0.01 waves, or 1 % of Zemax's if larger, to fail | Partial |
All 5 rows, matches included
| Quantity | Largest difference from Zemax | Match / partial within | Result |
|---|---|---|---|
| Focal length and f-number | 6.34e−05 % | 0.0001 / 0.1 % | Match |
| Chief ray at the image, every fieldFields where both programs block the chief ray are left out | 0 mm | 1e−06 / 0.001 mm | Match |
| Ray fan (tangential), every fieldFields where no ray gets through are left out | 1.16e−08 mm | 1e−06 / 0.001 mm | Match |
| Ray fan: pupil points with a ray in one program only, every fieldLight that one program lets through and the other stops: vignetting that differs. Zemax draws a tangential fan point only if the ray one step lower in the pupil also gets through, so its window really starts one to two steps below its first point and ends up to one step above its last; a point where the edge may be is undecided and not counted (raycrafter #258); the sagittal fan is not compared (no vignetted sagittal reference to show Zemax does the same) | 0 % | 0 / 1 % | Match |
| RMS wavefront against Zemax's Wavefront Map, every fieldRayCrafter gives the RMS wavefront but no PSF or Strehl ratio (No diffraction image: the image plane is far from any focus, so the wavefront changes too fast across the pupil for a diffraction calculation. The RMS wavefront error is given; the spot diagram is the better guide) and Zemax made neither, so the RMS is compared with Zemax's Wavefront Map (piston and tilt removed) at 0 deg. Both numbers are fitted the same way: the evaluation takes a least-squares plane (piston and tilt) out of Zemax's Wavefront Map and out of RayCrafter's own wavefront map over the pupil, every point that got through alike (raycrafter #243, Rob's decision of 2026-12-04). RayCrafter's reported RMS wavefront and Zemax's RMS operand, which take the tilt out in direction cosines on a focused image, are a different convention (on the focused designs of #243 a plane in pupil coordinates was 1.5 to 8 % from Zemax's operand), so they are not what is compared here. RayCrafter's map is traced with 513 rays across the part of the pupil that gets light, where its RMS has converged (its window's 65 were 1.6 % low on US005899585 at 15.12 mm). Zemax's map is 64 x 64, and on a field whose rays are stopped where the wavefront is steep its RMS depends on where its grid falls: on US005899585 at 15.12 and 21.6 mm a 64 x 64 grid moved by under a step changes the RMS by 0.9 % (one standard deviation), so differences of that size can be Zemax's sampling. RayCrafter's own reported RMS wavefront, for information (waves): 0 deg: 7.651 (fitted 7.659). The difference is over 0.01 waves but within 1 % of Zemax's value, so it is not a fail | 0.04662 waves | 0.001 / 0.01 waves, or 1 % of Zemax's if larger, to fail | Partial |
What RayCrafter said when it imported the file
- Left out the surfaces Zemax is set to ignore: 5, 6, 12, 13.
- Surface 7 is curved but has air on both sides; ignored.
- Surface 14 is curved but has air on both sides; ignored.
- The stop (surface 15) is in air, and the file gives it no aperture, so it blocks no light with aiming off; it was not imported as an element.
- Surface 7 has a 25.4 mm round aperture in air; it was imported as an aperture 25.4 mm across, and none of the file's rays reach its edge.
- Surface 14 ("AC254-100-A") has a 25.4 mm round aperture in air; it was imported as an aperture 25.4 mm across, and none of the file's rays reach its edge.
- The file has no ray aiming and its stop is behind the front of the first lens, so, as in Zemax, each beam has the file's entrance pupil diameter and is aimed at the centre of the paraxial entrance pupil; it is not aimed to fill the stop, so off-axis beams may be vignetted or miss the stop's centre (#204).
Optiland: afocal image space

RayCrafter: its own plots
What RayCrafter's window and report draw, with Zemax's points over them (open markers), on the file's own fields.

Optiland issues found
Full details are in upstream/optiland_issues_found.md.
- 28. Ignored surfaces are traced. The file's two doublets are set to be ignored. Patched locally Upstream: not yet filed.
- 29. The afocal wavefront has the opposite sign. OPD and Zernikes are otherwise Zemax's. Open Upstream: not yet filed.
- 30. The default wavefront is wrong with the exit pupil at the image. Up to 2.4 waves of OPD. Open Upstream: not yet filed.
Semi-diameters stored in the file
Zemax stores, for every surface whose semi-diameter is automatic, the largest ray radius it computed. We re-trace the file in Optiland and take the largest local ray radius. Status is computed from the tolerances in comparison.json: match within 0.5%, partial within 5%.
Every row matches Zemax.
All 2 rows, matches included
| Quantity | Zemax | Optiland | Difference | Result |
|---|---|---|---|---|
| Semi-diameter, surface 15 (mm)Zemax: DIAM stored in the .ZMX (computed by Zemax) | 7.4924 | 7.4924 | 0.00% | Match |
| Semi-diameter, surface 16 (mm)Zemax: DIAM stored in the .ZMX (computed by Zemax) | 7.4924 | 7.4924 | 0.00% | Match |
Lens data
Prescription as stored in the Zemax file. The Optiland radius is read back from the loaded model, so a difference would show an import error. The four surfaces Zemax ignores (5, 6, 12 and 13) are left out.
| Zemax # | Comment | Type | Radius, Zemax (mm) | Radius, Optiland (mm) | Thickness (mm) | Glass | Semi-diameter (mm) | Clear aperture (mm) |
|---|---|---|---|---|---|---|---|---|
| 0 | STANDARD | ∞ | ∞ | ∞ | 0 | |||
| 1 | LA1253 | STANDARD | 103 | 103 | 2.8 | N-BK7 | 12.5 (fixed) | 12.5 |
| 2 | STANDARD | ∞ | ∞ | 0 | 12.5 (fixed) | 12.5 | ||
| 3 | LA1253 | STANDARD | 103 | 103 | 2.8 | N-BK7 | 12.5 (fixed) | 12.5 |
| 4 | STANDARD | ∞ | ∞ | 0 | 12.5 (fixed) | 12.5 | ||
| 7 | STANDARD | -128.23 | -128.23 | 200 | 12.7 (fixed) | 12.7 | ||
| 8 | STANDARD | ∞ | ∞ | 2.8 | N-BK7 | 12.5 (fixed) | 12.5 | |
| 9 | LA1253 | STANDARD | -103 | -103 | 0 | 12.5 (fixed) | 12.5 | |
| 10 | STANDARD | ∞ | ∞ | 2.8 | N-BK7 | 12.5 (fixed) | 12.5 | |
| 11 | LA1253 | STANDARD | -103 | -103 | 0 | 12.5 (fixed) | 12.5 | |
| 14 | AC254-100-A | STANDARD | -62.75 | -62.75 | 100 | 12.7 (fixed) | 12.7 | |
| 15 | STANDARD (stop) | ∞ | ∞ | 0 | 7.492 | |||
| 16 | STANDARD | ∞ | ∞ | 0 | 7.492 |
How Zemax was run
By make_zemax_reference.py, the same way for every design, on
2026-12-02.
What is asked for, and which tool each result tests, is in
zemax_analyses.md; every file is in
Zemax_reference_output.
| System | What it is | Tests |
|---|---|---|
| The file's own fields | The file untouched, at its own fields | Optiland, RayCrafter |
| Afocal image space | The same file with "Afocal Image Space" ticked: a plane reference for the wavefront | Optiland |
Reproduce
export UV_PROJECT_ENVIRONMENT=~/uv_venvs/evaluation_mac uv run python -m evaluation_tools.from_zemax.analyze_zmx designs/from_zemax/relay_custom_spha uv run python -m evaluation_tools.from_zemax.compare_optiland designs/from_zemax/relay_custom_spha uv run python -m evaluation_tools.from_zemax.compare_raycrafter designs/from_zemax/relay_custom_spha uv run python -m evaluation_tools.build_summary # regenerates all HTML
The spherical aberration of the pair is in the afocal system's wavefront: 7.66 waves RMS, mostly defocus (Zernike 4, 7.66 waves), with 0.087 waves of primary spherical (Zernike 11).