Optiland and RayCrafter (dev) vs Zemax

Paraxial excitation into a 30 mm block: Optiland and RayCrafter (dev) against Zemax

An ideal lens focusing a telecentric beam into a block of model glass, probably the sample chamber of a light-sheet microscope. Both tools trace the rays to within 3.3 nm of Zemax, the difference being the model glass's index. Off the axis Optiland's wavefront and MTF are wrong behind the ideal lens. Optiland's default wavefront refuses the telecentric system, and its distortion treats image heights as angles. RayCrafter (dev) works with the image in glass: its wavefront and Strehl ratio match, its MTF is within 0.0055 of Zemax (partial).

optiland 0.6.3 RayCrafter dev 5ecb2efd λ 0.587 µm Zemax OpticStudio 24.1.3 (file) EPD 15 mm fields 0, 5 mm Zemax run 2026-12-02 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 or MTF off the axis, behind the ideal lens. On the axis Optiland's wavefront, Strehl and MTF match Zemax. At 5 mm the MTF is out by up to 0.86. Cause: Optiland's paraxial lens gets the off-axis optical path wrong (issue 3). Upstream: #1248, #1110 (exit pupil at infinity; closed after 0.6.3).
  • Optiland: wavefront, PSF and MTF with the exit pupil at infinity. Refused with the default reference. strategy='centroid' runs. Cause: reference sphere of infinite radius (issue 3; reported upstream as #1110, closed after 0.6.3, not tried here). Upstream: #1248, #1110 (exit pupil at infinity; closed after 0.6.3).
  • Optiland: distortion and grid distortion with fields given as heights. f-tan and f-theta come out exchanged, near enough, with no warning. Cause: heights in mm are taken as degrees (issue 27). Upstream: not yet filed.

System layout

Works

Drawn from Optiland's surface positions and rays: the stop, the ideal lens 50 mm behind it, then the block of model glass up to the image.

Ray paths through the system
Light travels from left to right. The position of every surface is compared with Zemax in the first table.
Optiland spot diagrams
Optiland's spot diagrams at the file's own fields.

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.

9matching
3partial
11failing

Not matching: partial and fail rows.

QuantityLargest difference from ZemaxMatch / partial withinResult
Refractive index of each glass1.56,64.2. Optiland's data for 1.56,64.2 differ from Zemax's1.76e−061e−06 / 0.0001Partial
Rays at the image, ray by rayThe rays Zemax traced, every galvo angle or field3.26e−06 mm1e−06 / 0.001 mmPartial
Largest ray radius on every surface3.26e−06 mm1e−06 / 0.001 mmPartial
Wavefront, PSF and MTF as they comeValueError: No valid ray samples found for chief-ray wavefront. The wavefront, PSF and MTF rows below are with strategy='centroid', and OPD and Zernikes without piston and tilt; on the axis the OPD is then 0.000173 waves from Zemax'srefusedFail
OPD of every rayOn the axis 0.0002 waves; the figure is the 5 mm field (issue 3)12.38 waves0.001 / 0.01 wavesFail
Zernike coefficients (37 standard)On the axis 0.0001 waves; the figure is the 5 mm field (issue 3)2.669 waves0.001 / 0.01 wavesFail
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 count16.4 %0.1 / 2 %Fail
RMS wavefront against field, from Optiland's OPDPiston and tilt removed, as Zemax does3.418 waves0.001 / 0.01 waves, or 1 % of Zemax's if larger, to failFail
RMS wavefront against field, RmsWavefrontErrorVsField as it comesValueError: No valid ray samples found for chief-ray wavefront.refusedFail
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. On the axis 0.453 against 0.448; the figure is the 5 mm field0.43370.005 / 0.02Fail
Strehl ratio, FFTPSF as it comesA different meaning: light absorbed by the glass counts as lost0.43370.005 / 0.02Fail
MTF, tangential and sagittal, every fieldOn the axis within 0.0024; the figure is the 5 mm field0.85670.005 / 0.02Fail
Distortion, f-tan and f-thetaFields given as heights in mm are taken as degrees (issue 27)0.3325 percentage points0.005 / 0.05 percentage pointsFail
Grid distortion, largestFields given as heights in mm are taken as degrees (issue 27)0.127 percentage points0.005 / 0.05 percentage pointsFail
All 23 rows, matches included
QuantityLargest difference from ZemaxMatch / partial withinResult
Refractive index of each glass1.56,64.2. Optiland's data for 1.56,64.2 differ from Zemax's1.76e−061e−06 / 0.0001Partial
Position of every surface0 mm1e−09 / 1e−06 mmMatch
Rays at the image, ray by rayThe rays Zemax traced, every galvo angle or field3.26e−06 mm1e−06 / 0.001 mmPartial
Ray directions at the imageDirection cosines. Zemax's are reversed after an odd number of mirrors6.66e−161e−09 / 1e−06Match
Largest ray radius on every surface3.26e−06 mm1e−06 / 0.001 mmPartial
RMS spot of the same raysThe rays that get through, every one counted alike0 %0.1 / 2 %Match
Focal length, f-number, exit pupilSizes; Optiland's signs may differ after a mirror. The exit pupil is at infinity in both0 %0.0001 / 0.1 %Match
Wavefront, PSF and MTF as they comeValueError: No valid ray samples found for chief-ray wavefront. The wavefront, PSF and MTF rows below are with strategy='centroid', and OPD and Zernikes without piston and tilt; on the axis the OPD is then 0.000173 waves from Zemax'srefusedFail
OPD of every rayOn the axis 0.0002 waves; the figure is the 5 mm field (issue 3)12.38 waves0.001 / 0.01 wavesFail
Zernike coefficients (37 standard)On the axis 0.0001 waves; the figure is the 5 mm field (issue 3)2.669 waves0.001 / 0.01 wavesFail
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 count16.4 %0.1 / 2 %Fail
RMS wavefront against field, from Optiland's OPDPiston and tilt removed, as Zemax does3.418 waves0.001 / 0.01 waves, or 1 % of Zemax's if larger, to failFail
RMS wavefront against field, RmsWavefrontErrorVsField as it comesValueError: No valid ray samples found for chief-ray wavefront.refusedFail
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. On the axis 0.453 against 0.448; the figure is the 5 mm field0.43370.005 / 0.02Fail
Strehl ratio, FFTPSF as it comesA different meaning: light absorbed by the glass counts as lost0.43370.005 / 0.02Fail
MTF, tangential and sagittal, every fieldOn the axis within 0.0024; the figure is the 5 mm field0.85670.005 / 0.02Fail
RMS spot through focus, every field0.03656 %0.1 / 2 %Match
Best focus, every field0 mm0.0001 / 0.001 mmMatch
Distortion, f-tan and f-thetaFields given as heights in mm are taken as degrees (issue 27)0.3325 percentage points0.005 / 0.05 percentage pointsFail
Grid distortion, largestFields given as heights in mm are taken as degrees (issue 27)0.127 percentage points0.005 / 0.05 percentage pointsFail
Field curvature, FieldCurvature as it comesAt the edge of the field2.18e−05 mm0.01 / 0.1 mmMatch
Field curvature, from Optiland's raysNear-axis rays of each beam, in the image surface's own axes2.18e−05 mm0.01 / 0.1 mmMatch

RayCrafter against Zemax

This is RayCrafter's development branch

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

The rows below are on a system with a flat image.

14matching
0partial
0failing

Every row matches Zemax.

All 14 rows, matches included
QuantityLargest difference from ZemaxMatch / partial withinResult
Focal length and f-number0 %0.0001 / 0.1 %Match
Chief ray at the image, every fieldFields where both programs block the chief ray are left out4.4e−10 mm1e−06 / 0.001 mmMatch
Ray fan (tangential), every fieldFields where no ray gets through are left out. The model glass's index differs (issue 31)2.66e−15 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
Beam angle of each field (fields given as image heights)Zemax's is its chief ray's direction in object space5e−10 deg1e−06 / 0.001 degMatch
RMS spot against field0 %0.1 / 2 %Match
RMS wavefront against field0.000669 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 decimals0.0022440.005 / 0.02Match
MTF plot (one wavelength)0.0047080.005 / 0.02Match
MTF plot (all wavelengths)0.0047080.005 / 0.02Match
Distortion, f-tan and f-theta2.95e−05 percentage points0.005 / 0.05 percentage pointsMatch
Grid distortion, largest3.98e−14 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 convention2.97e−12 mm0.01 / 0.1 mmMatch
Field curvature, change from the axis2.97e−12 mm0.01 / 0.1 mmMatch
What RayCrafter said when it imported the file
  • The file has a model glass (index 1.56, Abbe number 64.1673, partial dispersion offset -0.0009). Its index at other wavelengths follows Zemax's model glass formula.
  • The file gives its fields as image heights, which were turned into beam angles: 5 mm is 5.711 deg.
  • Surface 3 is a flat face with Custom (nd 1.56, Vd 64.1673, dPgF -0.0009) behind it and no lens of its own; it was imported as an aperture 60 mm across (the file's aperture there) that holds the medium.

Optiland: the file's own fields

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. Where the off-axis PSF fails, that is Optiland's ideal-lens problem (the optical path across a paraxial surface off axis, evaluation #12), not the design'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 file's own fields.

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).
Ray fan, last field.
Ray fan, last field.
MTF (one wavelength), first field.
MTF (one wavelength), first field.
MTF (one wavelength), second field.
MTF (one wavelength), second 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 0.25 µm) and the FWHM to within 0.4 % (0.5 % 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.

  • 3. The ideal lens is wrong off the axis, and the default wavefront refuses a telecentric system. The wavefront, PSF and MTF at 5 mm cannot be used. Open Upstream: #1248, #1110 (exit pupil at infinity; closed after 0.6.3).
  • 27. Distortion treats heights in mm as angles in degrees. f-tan and f-theta distortion and grid distortion are wrong, with no warning. Open Upstream: not yet filed.
  • 31. A model glass has a slightly different dispersion. 1.8e-6 in index at this wavelength, 3.3 nm at the image. A difference rather than a bug. Difference 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%.

3matching
0partial
0failing

Every row matches Zemax.

All 3 rows, matches included
QuantityZemaxOptilandDifferenceResult
Semi-diameter, surface 1 (mm)Zemax: DIAM stored in the .ZMX (computed by Zemax)7.50007.50000.00%Match
Semi-diameter, surface 2 (mm)Zemax: DIAM stored in the .ZMX (computed by Zemax)12.500012.50000.00%Match
Semi-diameter, surface 4 (mm)Zemax: DIAM stored in the .ZMX (computed by Zemax)5.00635.00630.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.

Zemax #CommentTypeRadius, Zemax (mm)Radius, Optiland (mm)Thickness (mm)GlassSemi-diameter (mm)Clear aperture (mm)
0STANDARD∞∞∞0
1STANDARD (stop)∞∞507.5
2PARAXIAL∞∞30.853912.5
3STANDARD∞∞30___BLANK30 (fixed)30
4STANDARD∞∞05.006

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.

SystemWhat it isTests
The file's own fieldsThe file untouched, at its own fieldsOptiland, RayCrafter

Reproduce

export UV_PROJECT_ENVIRONMENT=~/uv_venvs/evaluation_mac
uv run python -m evaluation_tools.from_zemax.analyze_zmx designs/from_zemax/paraxial_excitation_chamber
uv run python -m evaluation_tools.from_zemax.compare_optiland designs/from_zemax/paraxial_excitation_chamber
uv run python -m evaluation_tools.from_zemax.compare_raycrafter designs/from_zemax/paraxial_excitation_chamber
uv run python -m evaluation_tools.build_summary                    # regenerates all HTML

Zemax's field curvature plot gives the focus shift as in air (-0.084 mm), while its RMS against focus shifts inside the glass; both comparisons here follow each plot's meaning. The file's name says n = 1.52; the glass in it has n_d = 1.56.