Optiland and RayCrafter (dev) vs Zemax
TWINKLE scan lens (alone): Optiland and RayCrafter (dev) against Zemax
The galvo and scan lens of the TWINKLE excitation path on their own, compared with our own Zemax run. Optiland traces every ray at every galvo angle where Zemax does, to rounding error, and gives the same OPD. Its grid distortion and field curvature are wrong after the fold, and it refuses wavefronts with the galvo tilted. On the file as authored, with its galvo tilted, RayCrafter now keeps the scan line's bow (raycrafter #210): its chief rays land within 1e-9 mm of Zemax's, and rays, distortion and field curvature agree across the field. Its RMS spot and RMS wavefront differ a little (Partial: up to 0.0008 waves in the galvo scan), as does its Strehl ratio (up to 0.008), and its MTF on the curved image (on a flat one it matches; the one-wavelength MTF, which failed, was fixed by raycrafter #174). Its RMS spot radius against field agrees: the re-check of raycrafter #170; the AL7560 asphere, where it was 32 % high on the axis, now matches too.
- Optiland: Wavefront with the galvo tilted, gives no number (34 of 36 configurations: UnsupportedParaxialGeometryError (issue 8))
- Optiland: RMS spot against field, RmsSpotSizeVsField as it comes, differs by 5.275 %
- Optiland: RMS wavefront against field, RmsWavefrontErrorVsField as it comes, differs by 0.116 waves
- Optiland: Grid distortion, largest, differs by 103.7 percentage points
- Optiland: Field curvature, FieldCurvature as it comes, differs by 1.745 mm
Every failing row of the tables below, against our own Zemax run.
- Optiland: wavefront, PSF and Strehl with the galvo tilted. Refused. With the galvo straight they run, and the OPD agrees with Zemax. Cause: Optiland's paraxial engine (issue 8; upstream roadmap #865). Upstream: #865 (roadmap, with our comment), #1210.
- Optiland: grid distortion and field curvature after the fold. About 100% and 0, with no warning. The rays they are made from are right. Cause: both read global axes (issue 24). Upstream: PR #1217 (GridDistortion fixed on main; FieldCurvature is not), #1210 (folded systems in general).
- Optiland: 3D viewer. Shows only the first leg of the path and misplaces elements. Cause: not located (issue 10). Upstream: not yet filed.
- Optiland: galvo angles and tilted surfaces on import. Only configuration 1 loads and the tilted dichroic is ignored unless our workaround rewrites the file first. Anything loading these files without the workaround is silently wrong. Cause: Optiland's Zemax reader silently drops them (issues 5 to 7). Upstream: #1247.
System layout
WorksDrawn by this repository from Optiland's surface positions, sags and ray coordinates (Optiland's own draw fails on folds, issue 9). Glass is filled between surfaces, thick black lines are mirrors, the brown arrow-line is the ideal objective and the dashed line is the image plane. Everything is projected onto the plane of the folds.

Show Optiland's own 3D viewer (incomplete for this system)

upstream/optiland_issues_found.md). The projected layout above, drawn from the same ray coordinates, shows the whole path.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 |
|---|---|---|---|
| Wavefront with the galvo tilted34 of 36 configurations: UnsupportedParaxialGeometryError (issue 8) | refused | Fail | |
| RMS spot against field, RmsSpotSizeVsField as it comesEqual weights on hexapolar rings count the pupil's edge too much, and only the rays that get through count | 5.275 % | 0.1 / 2 % | Fail |
| RMS wavefront against field, RmsWavefrontErrorVsField as it comesA different meaning: piston and tilt are kept | 0.116 waves | 0.001 / 0.01 waves, or 1 % of Zemax's if larger, to fail | Fail |
| Strehl ratio, FFTPSF, glass absorption divided outAgainst Zemax's Huygens PSF, which prints three decimals and is itself a little above what Zemax's own wavefront gives | 0.008091 | 0.005 / 0.02 | Partial |
| Strehl ratio, FFTPSF as it comesA different meaning: light absorbed by the glass counts as lost | 0.01238 | 0.005 / 0.02 | Partial |
| Grid distortion, largestAfter a fold, x is read in global axes (issue 24) | 103.7 percentage points | 0.005 / 0.05 percentage points | Fail |
| Field curvature, FieldCurvature as it comesAt the edge of the field. After a fold, global axes are read (issue 24) | 1.745 mm | 0.01 / 0.1 mm | Fail |
All 22 rows, matches included
| Quantity | Largest difference from Zemax | Match / partial within | Result |
|---|---|---|---|
| Refractive index of each glassBK7, N-BK7, N-LAK22, N-SF6HT | 2.22e−16 | 1e−06 / 0.0001 | Match |
| Position of every surface | 5.48e−14 mm | 1e−09 / 1e−06 mm | Match |
| Rays at the image, ray by rayThe rays Zemax traced, every galvo angle or field | 6.4e−14 mm | 1e−06 / 0.001 mm | Match |
| Ray directions at the imageDirection cosines. Zemax's are reversed after an odd number of mirrors | 3.89e−15 | 1e−09 / 1e−06 | Match |
| Largest ray radius on every surface | 4.26e−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 |
| Wavefront with the galvo tilted34 of 36 configurations: UnsupportedParaxialGeometryError (issue 8) | refused | Fail | |
| Focal length, f-number, exit pupilSizes; Optiland's signs may differ after a mirror | 2.52e−05 % | 0.0001 / 0.1 % | Match |
| OPD of every ray | 2.96e−08 waves | 0.001 / 0.01 waves | Match |
| Zernike coefficients (37 standard) | 9.44e−09 waves | 0.001 / 0.01 waves | Match |
| RMS spot against field, from Optiland's raysWith the pupil averaging Zemax uses (Gaussian quadrature) | 0 % | 0.1 / 2 % | Match |
| RMS spot against field, RmsSpotSizeVsField as it comesEqual weights on hexapolar rings count the pupil's edge too much, and only the rays that get through count | 5.275 % | 0.1 / 2 % | Fail |
| RMS wavefront against field, from Optiland's OPDPiston and tilt removed, as Zemax does | 4.19e−07 waves | 0.001 / 0.01 waves, or 1 % of Zemax's if larger, to fail | Match |
| RMS wavefront against field, RmsWavefrontErrorVsField as it comesA different meaning: piston and tilt are kept | 0.116 waves | 0.001 / 0.01 waves, or 1 % of Zemax's if larger, to fail | Fail |
| Strehl ratio, FFTPSF, glass absorption divided outAgainst Zemax's Huygens PSF, which prints three decimals and is itself a little above what Zemax's own wavefront gives | 0.008091 | 0.005 / 0.02 | Partial |
| Strehl ratio, FFTPSF as it comesA different meaning: light absorbed by the glass counts as lost | 0.01238 | 0.005 / 0.02 | Partial |
| MTF, tangential and sagittal, every field | 0.002867 | 0.005 / 0.02 | Match |
| Distortion, f-tan and f-theta | 2.03e−10 percentage points | 0.005 / 0.05 percentage points | Match |
| Grid distortion, largestAfter a fold, x is read in global axes (issue 24) | 103.7 percentage points | 0.005 / 0.05 percentage points | Fail |
| Field curvature, FieldCurvature as it comesAt the edge of the field. After a fold, global axes are read (issue 24) | 1.745 mm | 0.01 / 0.1 mm | Fail |
| Field curvature, from Optiland's raysNear-axis rays of each beam, in the image surface's own axes | 0.001044 mm | 0.01 / 0.1 mm | Match |
| Seidel coefficients, sizesZemax prints six decimals. Optiland's signs may be opposite | 4.51e−07 mm | 1e−06 / 1e−05 mm | Match |
RayCrafter against Zemax
Tested at commit 5ecb2efd of dev, not the release on PyPI.
The image surface is curved. See the table below (raycrafter #191).
The image curved, as in the file



Not matching: partial and fail rows.
| Quantity | Largest difference from Zemax | Match / partial within | Result |
|---|---|---|---|
| Curved image, as in the file: MTF plot (one wavelength) | 0.007927 | 0.005 / 0.02 | Partial |
| Curved image, as in the file: MTF plot (all wavelengths) | 0.007927 | 0.005 / 0.02 | Partial |
All 17 rows, matches included
| Quantity | Largest difference from Zemax | Match / partial within | Result |
|---|---|---|---|
| As authored: galvo scan: distance of the chief ray from the axisThe file as authored: each galvo angle imported as a beam, on the curved image | 7.79e−10 mm | 1e−06 / 0.001 mm | Match |
| As authored: galvo scan: where the chief ray lands (x and y)Distance between the two programs' chief rays on the image | 9.37e−10 mm | 1e−06 / 0.001 mm | Match |
| As authored: galvo scan: RMS spot | 0 % | 0.1 / 2 % | Match |
| As authored: galvo scan: RMS wavefront | 0.000818 waves | 0.001 / 0.01 waves, or 1 % of Zemax's if larger, to fail | Match |
| Curved image, as in the file: Focal length and f-number | 4.44e−14 % | 0.0001 / 0.1 % | Match |
| Curved image, as in the file: Chief ray at the image, every fieldFields where both programs block the chief ray are left out | 2.13e−14 mm | 1e−06 / 0.001 mm | Match |
| Curved image, as in the file: Ray fan (tangential), every fieldFields where no ray gets through are left out | 2.84e−14 mm | 1e−06 / 0.001 mm | Match |
| Curved image, as in the file: 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 |
| Curved image, as in the file: RMS spot against field | 0 % | 0.1 / 2 % | Match |
| Curved image, as in the file: RMS wavefront against field | 0.000779 waves | 0.001 / 0.01 waves, or 1 % of Zemax's if larger, to fail | Match |
| Curved image, as in the file: 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.003519 | 0.005 / 0.02 | Match |
| Curved image, as in the file: MTF plot (one wavelength) | 0.007927 | 0.005 / 0.02 | Partial |
| Curved image, as in the file: MTF plot (all wavelengths) | 0.007927 | 0.005 / 0.02 | Partial |
| Curved image, as in the file: Distortion, f-tan and f-theta | 2.17e−08 percentage points | 0.005 / 0.05 percentage points | Match |
| Curved image, as in the file: Grid distortion, largest | 2.97e−05 percentage points | 0.005 / 0.05 percentage points | Match |
| Curved image, as in the file: Field curvatureRayCrafter takes the best focus of a whole fan, Zemax that of rays near the chief ray. Signs are opposite by convention | 0.000512 mm | 0.01 / 0.1 mm | Match |
| Curved image, as in the file: Field curvature, change from the axis | 0.000512 mm | 0.01 / 0.1 mm | Match |
With the image made flat (not the file as authored)
The rows below are on a system with a flat image. Here, as an extra comparison, the galvo scan is given ordinary beams at the equivalent angles; the scan of the file as authored is above.
Not matching: partial and fail rows.
| Quantity | Largest difference from Zemax | Match / partial within | Result |
|---|---|---|---|
| Galvo scan: RMS spot | 0.4369 % | 0.1 / 2 % | Partial |
| Galvo scan: RMS wavefront | 0.001073 waves | 0.001 / 0.01 waves, or 1 % of Zemax's if larger, to fail | Partial |
| RMS wavefront against field | 0.001173 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'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.7593 at 5.5 deg (0.0057 from Zemax's 0.765, against 0.0057 as it is); 0.6932 at 8.25 deg (0.0058 from Zemax's 0.699, against 0.0058 as it is); 0.5954 at 11 deg (0.0076 from Zemax's 0.603, against 0.0076 as it is). The row scores RayCrafter as it is | 0.00758 | 0.005 / 0.02 | Partial |
All 16 rows, matches included
| Quantity | Largest difference from Zemax | Match / partial within | Result |
|---|---|---|---|
| Galvo scan: distance of the chief ray from the axisBeams at the equivalent angles | 2.93e−13 mm | 1e−06 / 0.001 mm | Match |
| Galvo scan: RMS spot | 0.4369 % | 0.1 / 2 % | Partial |
| Galvo scan: RMS wavefront | 0.001073 waves | 0.001 / 0.01 waves, or 1 % of Zemax's if larger, to fail | Partial |
| Focal length and f-number | 4.44e−14 % | 0.0001 / 0.1 % | Match |
| Chief ray at the image, every fieldFields where both programs block the chief ray are left out | 2.13e−14 mm | 1e−06 / 0.001 mm | Match |
| Ray fan (tangential), every fieldFields where no ray gets through are left out | 2.84e−14 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 spot against field | 0 % | 0.1 / 2 % | Match |
| RMS wavefront against field | 0.001173 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'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.7593 at 5.5 deg (0.0057 from Zemax's 0.765, against 0.0057 as it is); 0.6932 at 8.25 deg (0.0058 from Zemax's 0.699, against 0.0058 as it is); 0.5954 at 11 deg (0.0076 from Zemax's 0.603, against 0.0076 as it is). The row scores RayCrafter as it is | 0.00758 | 0.005 / 0.02 | Partial |
| MTF plot (one wavelength) | 0.003286 | 0.005 / 0.02 | Match |
| MTF plot (all wavelengths) | 0.003286 | 0.005 / 0.02 | Match |
| Distortion, f-tan and f-theta | 2.06e−08 percentage points | 0.005 / 0.05 percentage points | Match |
| Grid distortion, largest | 3e−05 percentage points | 0.005 / 0.05 percentage points | Match |
| Field curvatureRayCrafter takes the best focus of a whole fan, Zemax that of rays near the chief ray. Signs are opposite by convention | 1.99e−05 mm | 0.01 / 0.1 mm | Match |
| Field curvature, change from the axis | 1.99e−05 mm | 0.01 / 0.1 mm | Match |
What RayCrafter said when it imported the file
- 3 lens(es) are not in the catalogue and were named "Imported lens N".
- The fold mirror at surface 4 has no aperture, only a semi-diameter of 3.13338 mm, at which Zemax does not block rays. It is round and was enlarged to 6.7 mm across so that none of the file's own rays is blocked.
Optiland: galvo scan
The file exactly as authored. Open circles and black dots are Zemax, blue is Optiland.


Optiland: field sweep, image curved as in the file


Optiland: field sweep, flat image


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










Optiland issues found
Full details are in upstream/optiland_issues_found.md (issues 5 to 10 are new with these designs).
- 5. Surface tilts (SCBD) ignored. The tilted dichroic loads untilted, with no warning. Patched locally Upstream: #1247.
- 6. Parameter pickups (PPAR) ignored. Only matters when a value is edited. Patched locally Upstream: #1247.
- 7. Multi-configuration data dropped. Only configuration 1 loads; the galvo angles are configurations. Worked around Upstream: #1247.
- 8. Paraxial engine refuses tilted systems. Blocks wavefront, PSF and Strehl on the tilted galvo systems. Open Upstream: #865 (roadmap, with our comment), #1210.
- 9. 2D layout mangles folded systems. This page draws its own projection. Worked around Upstream: not yet filed.
- 24. Field curvature is wrong after a fold. It reads global axes. Grid distortion had the same fault and is fixed on main. With our Zemax run: Open Upstream: PR #1217 (GridDistortion fixed on main; FieldCurvature is not), #1210 (folded systems in general).
Semi-diameters stored in the file
An older check, from the authors' Zemax (22.2.1). Zemax stores, for every surface whose semi-diameter is automatic, the largest ray radius it computed. We re-trace the same file in Optiland (all fields and wavelengths, 40-ring hexapolar pupil) and take the largest local ray radius. Those values come from the file itself, so they are exact Zemax output, not read off a plot. 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 1 (mm)Zemax: DIAM stored in the .ZMX (computed by Zemax) | 2.1950 | 2.1950 | 0.00% | Match |
| Semi-diameter, surface 17 (mm)Zemax: DIAM stored in the .ZMX (computed by Zemax) | 17.0202 | 17.0202 | 0.00% | Match |
Surface 4: Zemax 2.2278 mm, Optiland 3.1274 mm. The stored Zemax value (2.2278 mm) is close to the bare beam radius (2.195 mm), what a mirror at normal incidence would give, not the 1.414 x larger footprint on a 45 degree mirror. Every later surface agrees with Optiland to four digits, and the excitation file's value for the same mirror and beam (3.1042 mm) equals Optiland's 45 degree footprint. We think this stored value was not refreshed after the break was inserted; the cause is not established.
Semi-diameters, every automatic surface
The same comparison as the verdict table, with the ratio, including any row that was not scored.
| Zemax surface | Comment | Zemax (mm) | Optiland (mm) | Ratio | |
|---|---|---|---|---|---|
| 1 | 2.1950 | 2.1950 | 1.0000 | ||
| 4 | 2.2278 | 3.1274 | 1.4038 | not scored | |
| 17 | 17.0202 | 17.0202 | 1.0000 |
Lens data
Prescription as stored in the Zemax file (coordinate breaks left out; Optiland absorbs them into the neighbouring surfaces). The Optiland radius is read back from the loaded model, so a difference would show an import error. Thicknesses are signed Zemax values: negative after a mirror.
| Zemax # | Comment | Type | Radius, Zemax (mm) | Radius, Optiland (mm) | Thickness (mm) | Glass | Semi-diameter (mm) | Clear aperture (mm) |
|---|---|---|---|---|---|---|---|---|
| 0 | STANDARD | ∞ | ∞ | ∞ | 0 | |||
| 1 | STANDARD | ∞ | ∞ | 20 | 2.195 | |||
| 4 | STANDARD | ∞ | ∞ | 0 | MIRROR | 2.228 | ||
| 7 | STANDARD | ∞ | ∞ | -2.5 | BK7 | 25.4 (fixed) | 25.4 | |
| 8 | KPC070AR.16 | STANDARD | -103.36 | -103.36 | -4.599 | 25.4 (fixed) | 25.4 | |
| 9 | LB1199-B | STANDARD | -204.98 | -204.98 | -6.16 | N-BK7 | 25.4 (fixed) | 25.4 |
| 10 | STANDARD | 204.98 | 204.98 | -5 | 25.4 (fixed) | 25.4 | ||
| 11 | AC508-200-B | STANDARD | -134 | -134 | -8.2 | N-LAK22 | 25.4 (fixed) | 25.4 |
| 12 | STANDARD | 109.2 | 109.2 | -5 | N-SF6HT | 25.4 (fixed) | 25.4 | |
| 13 | The SL-TL telescope | STANDARD | 515.2 | 515.2 | -2 | 25.4 (fixed) | 25.4 | |
| 14 | is exactly 2X | STANDARD | -515.2 | -515.2 | -5 | N-SF6HT | 25.4 (fixed) | 25.4 |
| 15 | see Disatnce2 file | STANDARD | -109.2 | -109.2 | -8.2 | N-LAK22 | 25.4 (fixed) | 25.4 |
| 16 | AC508-200-B | STANDARD (stop) | 134 | 134 | -93.9831 | 25.4 (fixed) | 25.4 | |
| 17 | STANDARD | 113.236 | 113.236 | 0 | 17.02 |
How Zemax was run
By make_zemax_reference.py, the same way for every design, on
2026-12-01.
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 |
|---|---|---|
| As authored | The file untouched, at every galvo angle | Optiland, RayCrafter |
| As authored, flat image | The same with a flat image surface | Optiland, RayCrafter (equivalent beams) |
| Field sweep, image curved as in the file | Galvo straight, the pupil on it, the beam tilted by Zemax fields | Optiland, RayCrafter |
| Field sweep, flat image | The same with a flat image surface | Optiland, RayCrafter |
Reproduce
export UV_PROJECT_ENVIRONMENT=~/uv_venvs/evaluation_mac uv run python -m evaluation_tools.from_zemax.analyze_zmx designs/from_zemax/twinkle_scan_lens # about 1 to 3 minutes uv run python -m evaluation_tools.from_zemax.compare_optiland designs/from_zemax/twinkle_scan_lens uv run python -m evaluation_tools.from_zemax.compare_raycrafter designs/from_zemax/twinkle_scan_lens uv run python -m evaluation_tools.build_summary # regenerates all HTML
zemax_text.py holds the workarounds for features Optiland ignores (tilted surfaces, pickups, configurations). analyze_zmx.py runs the analysis and pages/generic_page.py writes this page. The Zemax files come from the TWINKLE repository.