Hi everyone!
I've built a user extension called Wavefront Reconstructor for Zemax that reconstructs the wavefront map directly from an NSC ray trace. If you've ever needed wavefront error metrics in Non-Sequential mode and found yourself stuck, this might be useful.
The extension reads the .ZRD file produced by the NSC ray trace, extracts the ray positions and direction cosines at the detector, and reconstructs the wavefront surface using Frankot–Chellappa integration. It outputs PV and RMS in both microns and waves.
One thing to keep in mind: the wavefront error is referenced to a perfect flat wavefront at the detector plane (afocal reference), not to the exit pupil as in Sequential mode.
Tested on OpticStudio 2017 and 2025.
—
Installation: copy all 8 files into your Extensions folder:
C:\Users\<username>\Documents\Zemax\ZOS-API\Extensions
Files included:
Wavefront Reconstructor.exe
Wavefront Reconstructor.exe.config
MathNet.Numerics.dll
ScottPlot.dll
ScottPlot.WinForms.dll
System.Drawing.Common.dll
System.Numerics.Vectors.dll
System.ValueTuple.dll
Once copied, Wavefront Reconstructor will appear in the Extensions menu inside OpticStudio. Open it, click Connect to link it to the running instance, fill in the parameters and click Compute Wavefront:
• Detector Object # — object number of the detector in the NSC editor
• Propagation Axis — main optical axis of your system (x, y or z)
• Split / Scatter NSC Rays — enable if your system has beam splitters or scattering surfaces
• Sampling — grid resolution for the reconstruction (e.g. 512×512)
• Wavelength (µm) — reference wavelength to get PV and RMS in waves
• Clip % — trims the top outliers of the wavefront histogram
• Intensity Filter — ignores rays below a fraction of the peak intensity
• Segments Filter — limits the maximum ray split level accepted

For a full explanation of the pipeline and a demo video, see my LinkedIn post:
https://www.linkedin.com/posts/jes%C3%BAs-mu%C3%B1oz-jim%C3%A9nez-9b777a239_wavefront-map-in-non-sequential-mode-from-share-7475990256392196097-tW_g/?highlightedUpdateUrn=urn%3Ali%3Aactivity%3A7475990257528852481&origin=SOCIAL_SHARE&utm_source=share&utm_medium=member_desktop&rcm=ACoAADthZBsBMwv47dROK0eiQFmxG--qAkVp5Ds
Hope it helps!
Jesús