RayCrafter (dev) vs Zemax

Ideal objective, object imaged at infinity: RayCrafter (dev) against Zemax

An ideal (paraxial) lens of f = 10 mm with the object on its focal plane (object-space NA 0.25, 555 nm), object heights 0, 0.25 and 0.5 mm: every point leaves as a collimated beam.

RayCrafter dev 5ecb2efd Zemax 24.1.3 λ 0.555 µm Zemax run 2026-12-03

The design

An ideal (paraxial) lens of f = 10 mm with the object on its focal plane (object-space NA 0.25, 555 nm), object heights 0, 0.25 and 0.5 mm: every point leaves as a collimated beam.

RayCrafter's own ray diagram.
RayCrafter's own ray diagram.

What is tested

Distortion of a finite object whose light leaves collimated, measured on the leaving angles (Afocal Image Space), as RayCrafter has done since #166: none, with a scale of -1/f = -0.1 per mm, wherever the image plane is.

Issue: raycrafter #166.

RayCrafter against Zemax

This is RayCrafter's development branch

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 mm, 0.25 mm, 0.5 mm).

12matching
0partial
0failing

Every row matches Zemax.

All 12 rows, matches included
QuantityLargest difference from ZemaxMatch / partial withinResult
Zemax reads the aperture, fields, wavelength and afocal setting that were meant0 warnings0 / 0 warningsMatch
Surfaces: thicknesses, gaps and semi-diametersThe project file against the lens data Zemax holds0 mm1e−09 / 1e−06 mmMatch
Surfaces: curvatures and conicsCurvature in 1/mm01e−12 / 1e−09Match
Rays at the image, ray by ray: positionThe rays that both programs trace and get through: 331 at 0, 331 at 0.25, 331 at 0.55.69e−15 mm1e−06 / 0.001 mmMatch
Rays at the image, ray by ray: slopedx/dz and dy/dz. The design has ideal (paraxial) lenses, which each program bends rays through in its own way1.01e−161e−08 / 1e−05Match
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 % (331 of 331 rays through); at 0.25, RayCrafter 100.0 %, Zemax 100.0 to 100.0 % (331 of 331 rays through); at 0.5, RayCrafter 100.0 %, Zemax 100.0 to 100.0 % (331 of 331 rays through)0 % points0.5 / 2 % pointsMatch
Chief ray at the image, every field4.44e−16 mm1e−06 / 0.001 mmMatch
Focal length0 %0.0001 / 0.1 %Match
Divergence of the leaving light, every fieldRayCrafter: RMS angle to the mean direction. Zemax: its RMS spot radius, which is an angle when the image space is afocal0 %0.1 / 2 %Match
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.3.02e−140.005 / 0.02Match
Grid distortion, largestZemax 0 %, on the leaving angles4.39e−14 percentage points0.005 / 0.05 percentage pointsMatch
Distortion against object height3.47e−14 percentage points0.005 / 0.05 percentage pointsMatch

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 (10 rings). With Afocal Image Space ticked Zemax's trace ends on the exit pupil, so its rays are carried on to the image plane.

Spot diagrams about the chief ray: Zemax's rays (red dots) and RayCrafter's (blue dots).
Spot diagrams about the chief ray: Zemax's rays (red dots) and RayCrafter's (blue dots).
The rays both programs trace: worst difference at the image, against field.
The rays both programs trace: worst difference at the image, against field.

RayCrafter's own plots

What RayCrafter's window and report draw, with Zemax's points over them (open markers).

Distortion against object height.
Distortion against object height.

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 orderZemaxRayCrafter
effective focal length mm1010
FieldChief ray, Zemax (mm) Chief ray, RayCrafter (mm)Share through, Zemax (%) Share through, RayCrafter (%)RMS spot, Zemax (mm) RMS spot, RayCrafter (mm) Strehl, ZemaxStrehl, RayCrafter Worst ray position difference (mm) Worst ray slope difference
0 mm00100100nonenone113.468e-157.637e-17
0.25 mm-1.25-1.25100100nonenone115.094e-159.992e-17
0.5 mm-2.5-2.5100100nonenone115.687e-151.009e-16

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 #TypeRadius, RayCrafter (mm)Radius, Zemax (mm)Thickness (mm)GlassSemi-diameter (mm)
1Paraxial (stop)∞∞505

How Zemax was run

By make_zemax_reference.py, the same way for every design, on 2026-12-03, on objective_at_infinity_ideal.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 objective_at_infinity_ideal
uv run python -m evaluation_tools.from_raycrafter.compare_zemax objective_at_infinity_ideal
uv run python -m evaluation_tools.build_summary

12 quantities compared.