Optiland and RayCrafter (dev) vs Zemax

TWINKLE tube lens (alone): Optiland and RayCrafter (dev) against Zemax

The galvo and tube-lens pair of the TWINKLE excitation path on their own, compared with our own Zemax run. It is far inside the diffraction limit, so this is a test of small numbers. Optiland traces every ray where Zemax does, to rounding error, and gives the same OPD. Its grid distortion and field curvature are wrong after the fold. On the file as authored, with its galvo tilted, RayCrafter now keeps the scan line's bow (raycrafter #210): its chief rays land within 2e-9 mm of Zemax's, and rays, distortion, field curvature, spots and wavefront agree across the field. Only its MTF on the curved image differs a little (Partial; 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 0.6.3 RayCrafter dev 5ecb2efd λ 0.92 µm Zemax OpticStudio 22.2.1 (file) EPD 4.39 mm fields 0° Zemax run 2026-12-01 Zemax 24.1.3 (our run)
Not working on this page

Every failing row of the tables below, against our own Zemax run.

What we know about them
  • 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: 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

Works

Drawn 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.

Ray paths projected onto the plane of the system
Beam enters from below, turns at the 45° galvo mirror and passes the tube-lens pair to focus on the right. The position of every surface is compared with Zemax in the first table.

Interactive 3D

Static 3D render of the optical system from optiland's VTK viewer Loading 3D model…

The scene from Optiland's own VTK 3D viewer, rendered offscreen and exported as glTF. Drag to rotate, scroll to zoom, right-drag to pan.

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.

17matching
1partial
4failing

Not matching: partial and fail rows.

QuantityLargest difference from ZemaxMatch / partial withinResult
Wavefront with the galvo tilted8 of 12 configurations: UnsupportedParaxialGeometryError (issue 8)refusedFail
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 count48.49 %0.1 / 2 %Fail
RMS wavefront against field, RmsWavefrontErrorVsField as it comesA different meaning: piston and tilt are kept0.008316 waves0.001 / 0.01 waves, or 1 % of Zemax's if larger, to failPartial
Grid distortion, largestAfter a fold, x is read in global axes (issue 24)105.5 percentage points0.005 / 0.05 percentage pointsFail
Field curvature, FieldCurvature as it comesAt the edge of the field. After a fold, global axes are read (issue 24)1.439 mm0.01 / 0.1 mmFail
All 22 rows, matches included
QuantityLargest difference from ZemaxMatch / partial withinResult
Refractive index of each glassSF2, N-BK72.22e−161e−06 / 0.0001Match
Position of every surface1.21e−13 mm1e−09 / 1e−06 mmMatch
Rays at the image, ray by rayThe rays Zemax traced, every galvo angle or field1.28e−13 mm1e−06 / 0.001 mmMatch
Ray directions at the imageDirection cosines. Zemax's are reversed after an odd number of mirrors3.44e−151e−09 / 1e−06Match
Largest ray radius on every surface2.13e−14 mm1e−06 / 0.001 mmMatch
RMS spot of the same raysThe rays that get through, every one counted alike0 %0.1 / 2 %Match
Wavefront with the galvo tilted8 of 12 configurations: UnsupportedParaxialGeometryError (issue 8)refusedFail
Focal length, f-number, exit pupilSizes; Optiland's signs may differ after a mirror8.17e−07 %0.0001 / 0.1 %Match
OPD of every ray1.53e−09 waves0.001 / 0.01 wavesMatch
Zernike coefficients (37 standard)7.04e−09 waves0.001 / 0.01 wavesMatch
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 count48.49 %0.1 / 2 %Fail
RMS wavefront against field, from Optiland's OPDPiston and tilt removed, as Zemax does1.7e−08 waves0.001 / 0.01 waves, or 1 % of Zemax's if larger, to failMatch
RMS wavefront against field, RmsWavefrontErrorVsField as it comesA different meaning: piston and tilt are kept0.008316 waves0.001 / 0.01 waves, or 1 % of Zemax's if larger, to failPartial
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 gives0.0003560.005 / 0.02Match
Strehl ratio, FFTPSF as it comesA different meaning: light absorbed by the glass counts as lost0.0019520.005 / 0.02Match
MTF, tangential and sagittal, every field0.0024460.005 / 0.02Match
Distortion, f-tan and f-theta3.94e−11 percentage points0.005 / 0.05 percentage pointsMatch
Grid distortion, largestAfter a fold, x is read in global axes (issue 24)105.5 percentage points0.005 / 0.05 percentage pointsFail
Field curvature, FieldCurvature as it comesAt the edge of the field. After a fold, global axes are read (issue 24)1.439 mm0.01 / 0.1 mmFail
Field curvature, from Optiland's raysNear-axis rays of each beam, in the image surface's own axes0.006672 mm0.01 / 0.1 mmMatch
Seidel coefficients, sizesZemax prints six decimals. Optiland's signs may be opposite4.92e−07 mm1e−06 / 1e−05 mmMatch

RayCrafter against Zemax

This is RayCrafter's development branch

Tested at commit 5ecb2efd of dev, not the release on PyPI.

RayCrafter on this file as authored: nothing fails

The image surface is curved. See the table below (raycrafter #191).

The image curved, as in the file

Curved image: RMS spot radius against field angle.
Curved image: RMS spot radius against field angle.
Curved image: Strehl ratio and RMS wavefront against field angle.
Curved image: Strehl ratio and RMS wavefront against field angle.
RayCrafter's PSF against Zemax's Huygens PSF, a section through each peak.
RayCrafter's PSF against Zemax's Huygens PSF: a section along y through each peak, scaled to its peak, in µm from the chief ray's image. RayCrafter's PSF is on Zemax's own pixel grid (Bench.psf with pixel_um) and both are centred on the chief ray's image (Zemax's "Center coordinates" in the Huygens PSF header are its chief ray's). The dashed line is RayCrafter with every ray at the same amplitude, as Zemax's Huygens PSF sums them: it shows why RayCrafter's own PSF, which weights the rays to conserve energy, can be a little wider; it is not a PSF a user gets. Peak positions agree to within 0.00 µm (a Zemax pixel is 4 µm) and the FWHM to within 2.2 % (2.2 % with equal amplitudes). Not scored: the Strehl ratio rows already score the height of the peak; position and width are shown for the eye.
15matching
2partial
0failing

Not matching: partial and fail rows.

QuantityLargest difference from ZemaxMatch / partial withinResult
Curved image, as in the file: MTF plot (one wavelength)0.0069750.005 / 0.02Partial
Curved image, as in the file: MTF plot (all wavelengths)0.0069750.005 / 0.02Partial
All 17 rows, matches included
QuantityLargest difference from ZemaxMatch / partial withinResult
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 image2.17e−09 mm1e−06 / 0.001 mmMatch
As authored: galvo scan: where the chief ray lands (x and y)Distance between the two programs' chief rays on the image2.17e−09 mm1e−06 / 0.001 mmMatch
As authored: galvo scan: RMS spot0 %0.1 / 2 %Match
As authored: galvo scan: RMS wavefront2.94e−05 waves0.001 / 0.01 waves, or 1 % of Zemax's if larger, to failMatch
Curved image, as in the file: Focal length and f-number9.99e−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 out1.07e−14 mm1e−06 / 0.001 mmMatch
Curved image, as in the file: Ray fan (tangential), every fieldFields where no ray gets through are left out3.91e−14 mm1e−06 / 0.001 mmMatch
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 field0 %0.1 / 2 %Match
Curved image, as in the file: RMS wavefront against field6.45e−05 waves0.001 / 0.01 waves, or 1 % of Zemax's if larger, to failMatch
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 decimals0.0003560.005 / 0.02Match
Curved image, as in the file: MTF plot (one wavelength)0.0069750.005 / 0.02Partial
Curved image, as in the file: MTF plot (all wavelengths)0.0069750.005 / 0.02Partial
Curved image, as in the file: Distortion, f-tan and f-theta3.12e−09 percentage points0.005 / 0.05 percentage pointsMatch
Curved image, as in the file: Grid distortion, largest1.46e−07 percentage points0.005 / 0.05 percentage pointsMatch
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 convention0.001663 mm0.01 / 0.1 mmMatch
Curved image, as in the file: Field curvature, change from the axis0.001663 mm0.01 / 0.1 mmMatch

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.

16matching
0partial
0failing

Every row matches Zemax.

All 16 rows, matches included
QuantityLargest difference from ZemaxMatch / partial withinResult
Galvo scan: distance of the chief ray from the axisBeams at the equivalent angles1.11e−12 mm1e−06 / 0.001 mmMatch
Galvo scan: RMS spot0 %0.1 / 2 %Match
Galvo scan: RMS wavefront4.41e−06 waves0.001 / 0.01 waves, or 1 % of Zemax's if larger, to failMatch
Focal length and f-number9.99e−14 %0.0001 / 0.1 %Match
Chief ray at the image, every fieldFields where both programs block the chief ray are left out1.07e−14 mm1e−06 / 0.001 mmMatch
Ray fan (tangential), every fieldFields where no ray gets through are left out3.55e−14 mm1e−06 / 0.001 mmMatch
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 field0 %0.1 / 2 %Match
RMS wavefront against field1.27e−05 waves0.001 / 0.01 waves, or 1 % of Zemax's if larger, to failMatch
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 decimals5.08e−050.005 / 0.02Match
MTF plot (one wavelength)0.0014960.005 / 0.02Match
MTF plot (all wavelengths)0.0014960.005 / 0.02Match
Distortion, f-tan and f-theta8.15e−10 percentage points0.005 / 0.05 percentage pointsMatch
Grid distortion, largest4.48e−06 percentage points0.005 / 0.05 percentage pointsMatch
Field curvatureRayCrafter takes the best focus of a whole fan, Zemax that of rays near the chief ray. Signs are opposite by convention7.48e−05 mm0.01 / 0.1 mmMatch
Field curvature, change from the axis7.48e−05 mm0.01 / 0.1 mmMatch
What RayCrafter said when it imported the file
  • 2 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.10605 mm, at which Zemax does not block rays. It is round and was enlarged to 6.6 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.

Chief-ray position, its departure from a straight line, RMS spot, and the worst distance of any ray from Zemax's, against galvo angle.
Chief-ray position, its departure from a straight line, RMS spot, and the worst distance of any ray from Zemax's, against galvo angle.
Spot diagrams about their centroids: Zemax (red dots) above, Optiland (amber dots) below. Same rays, so the RMS here counts every ray alike.
Spot diagrams about their centroids: Zemax (red dots) above, Optiland (amber dots) below. Same rays, so the RMS here counts every ray alike.

Optiland: field sweep, image curved as in the file

Against field angle. Blue: from Optiland's rays and OPD with Zemax's meaning. Orange: Optiland's own analysis as it comes, where it differs.
Against field angle. Blue: from Optiland's rays and OPD with Zemax's meaning. Orange: Optiland's own analysis as it comes, where it differs.
Optiland only (not RayCrafter): MTF and a section of the Huygens PSF (scaled to its peak) at three fields.
Optiland only (not RayCrafter): MTF and a section of Optiland's Huygens PSF (scaled to its peak) at three fields, against Zemax's. RayCrafter's PSF against the same Zemax PSF is in its own figure.

Optiland: field sweep, flat image

Against field angle. Blue: from Optiland's rays and OPD with Zemax's meaning. Orange: Optiland's own analysis as it comes, where it differs.
Against field angle. Blue: from Optiland's rays and OPD with Zemax's meaning. Orange: Optiland's own analysis as it comes, where it differs.
Optiland only (not RayCrafter): MTF and a section of the Huygens PSF (scaled to its peak) at three fields.
Optiland only (not RayCrafter): MTF and a section of Optiland's Huygens PSF (scaled to its peak) at three fields, against Zemax's. RayCrafter's PSF against the same Zemax PSF is in its own figure.

RayCrafter: its own plots

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

Galvo scan with beams at the equivalent angles.
Galvo scan with beams at the equivalent angles.
RMS spot radius against field angle.
RMS spot radius against field angle.
Strehl ratio and RMS wavefront against field angle.
Strehl ratio and RMS wavefront against field angle.
Distortion, f-tan and f-theta.
Distortion, f-tan and f-theta.
Field curvature. Zemax's sign is turned only after an odd number of mirrors, which reverses its z (the legend says where).
Field curvature. Zemax's sign is turned only after an odd number of mirrors, which reverses its z (the legend says where).
MTF (one wavelength), first field.
MTF (one wavelength), first field.
MTF (one wavelength), middle field.
MTF (one wavelength), middle field.
MTF (all wavelengths), middle field.
MTF (all wavelengths), middle field.
MTF (all wavelengths), last field.
MTF (all wavelengths), last field.
RayCrafter's PSF against Zemax's Huygens PSF, a section through each peak.
RayCrafter's PSF against Zemax's Huygens PSF: a section along y through each peak, scaled to its peak, in µm from the chief ray's image. RayCrafter's PSF is on Zemax's own pixel grid (Bench.psf with pixel_um) and both are centred on the chief ray's image (Zemax's "Center coordinates" in the Huygens PSF header are its chief ray's). The dashed line is RayCrafter with every ray at the same amplitude, as Zemax's Huygens PSF sums them: it shows why RayCrafter's own PSF, which weights the rays to conserve energy, can be a little wider; it is not a PSF a user gets. Peak positions agree to within 0.00 µm (a Zemax pixel is 4 µm) and the FWHM to within 0.6 % (0.6 % with equal amplitudes). Not scored: the Strehl ratio rows already score the height of the peak; position and width are shown for the eye.

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%.

2matching
0partial
0failing

Every row matches Zemax.

All 2 rows, matches included
QuantityZemaxOptilandDifferenceResult
Semi-diameter, surface 1 (mm)Zemax: DIAM stored in the .ZMX (computed by Zemax)2.19502.19500.00%Match
Semi-diameter, surface 10 (mm)Zemax: DIAM stored in the .ZMX (computed by Zemax)2.18132.18130.00%Match
Not scored

Surface 4: Zemax 2.1950 mm, Optiland 3.1042 mm. The stored Zemax value (2.195 mm) is exactly 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 surfaceCommentZemax (mm)Optiland (mm)Ratio
12.19502.19501.0000
42.19503.10421.4142not scored
102.18132.18131.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 #CommentTypeRadius, Zemax (mm)Radius, Optiland (mm)Thickness (mm)GlassSemi-diameter (mm)Clear aperture (mm)
0STANDARD∞∞∞0
1STANDARD∞∞202.195
4STANDARD∞∞0MIRROR2.195
7STANDARD (stop)-1330.5-1330.5-2SF225.4 (fixed)25.4
8STANDARD-336-336-4.5N-BK725.4 (fixed)25.4
9AC508-750-ASTANDARD417.8417.8-425.4 (fixed)25.4
10STANDARD∞∞-02.181
11STANDARD-1330.5-1330.5-2SF225.4 (fixed)25.4
12STANDARD-336-336-4.5N-BK725.4 (fixed)25.4
13STANDARD417.8417.8-373.993525.4 (fixed)25.4
14STANDARD113.236113.23600

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.

SystemWhat it isTests
As authoredThe file untouched, at every galvo angleOptiland, RayCrafter
As authored, flat imageThe same with a flat image surfaceOptiland, RayCrafter (equivalent beams)
Field sweep, image curved as in the fileGalvo straight, the pupil on it, the beam tilted by Zemax fieldsOptiland, RayCrafter
Field sweep, flat imageThe same with a flat image surfaceOptiland, RayCrafter

Reproduce

export UV_PROJECT_ENVIRONMENT=~/uv_venvs/evaluation_mac
uv run python -m evaluation_tools.from_zemax.analyze_zmx designs/from_zemax/twinkle_tube_lens   # about 1 to 3 minutes
uv run python -m evaluation_tools.from_zemax.compare_optiland designs/from_zemax/twinkle_tube_lens
uv run python -m evaluation_tools.from_zemax.compare_raycrafter designs/from_zemax/twinkle_tube_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.