RayCrafter (dev) vs Zemax

Stopped-down beam: autofocus: RayCrafter (dev) against Zemax

A beam cut to a tenth of its width, once sent by RayCrafter's autofocus to 1 mm behind the lens. Run again, autofocus now agrees with Zemax (150 mm). The size of the light agrees to within 0.8 %; it was 2.5 to 3 % small until RayCrafter searched the edge of the opening more finely (raycrafter #197).

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

The design

A 10 mm beam at 555 nm cut to 1.001 mm by an aperture 5 mm in front of an ideal 50 mm lens, with the image plane 10 mm behind the focus. RayCrafter's autofocus once sent it 1 mm behind the lens (raycrafter #129).

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

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°).

9matching
0partial
0failing

Every row matches Zemax.

All 9 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
Focal length0 %0.0001 / 0.1 %Match
Share of the pupil's rays that get through the aperturesRayCrafter's vignetting analysis 1.00 %; Zemax's rays allow 1.00 to 1.21 %0.0025 % points0.5 / 2 % pointsMatch
Radius of the light at the imageZemax 0.1, RayCrafter 0.099551. Zemax: 331 of 30301 rays get through. RayCrafter: 331 rays of a pattern fitted to the opening0.4495 %1 / 2 %Match
RMS spot radiusZemax 0.070945, RayCrafter 0.070393. Zemax: 331 of 30301 rays get through. RayCrafter: 331 rays of a pattern fitted to the opening0.7786 %1 / 2 %Match
Divergence behind the lensZemax 7094.3, RayCrafter 7039.1. Zemax: 331 of 30301 rays get through. RayCrafter: 331 rays of a pattern fitted to the opening0.7785 %1 / 2 %Match
Autofocus: where the image plane goesZemax 150, RayCrafter 150. Zemax: where the RMS spot of its rays is smallest0 mm0.0001 / 0.001 mmMatch

Rays

An aperture stops all but a small part of the beam. Zemax traces a dense hexapolar pupil, of which only the middle gets through; RayCrafter fits its pattern to the opening. The rays are therefore not paired.

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 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 mm5050
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°nonenonenonenonenonenonenonenonenonenone

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)
1Standard∞∞50.5
2Paraxial (stop)∞∞6025.4

How Zemax was run

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

9 quantities compared.