Tolerance analysis is an important part of any optical design. Such an analysis allows the designer to determine the sensitivity of the system to errors introduced during manufacturing and assembly.

In ZEMAX, possible errors may be introduced to the system individually (Sensitivity) or simultaneously (Monte Carlo). More information on these different types of tolerance analysis may be found in the chapter of the ZEMAX manual entitled “Tolerancing”, as well as in the Knowledge Base article entitled “How to Perform a Tolerance Analysis”.

During Sensitivity analysis, ZEMAX reports the magnitude of the individual perturbation and the corresponding change to the system criterion (e.g. RMS spot radius). During Monte Carlo analysis, however, ZEMAX only reports the change in the system criterion, since in this case all perturbations are considered simultaneously.

In most cases, the user is not interested in the individual perturbation values during a Monte Carlo analysis; usually, the goal of the analysis is to determine the variation in system performance that arises from the simultaneous application of tolerance errors in a statistical fashion. However, there may be times when it is useful to know the values for the individual perturbations in the Monte Carlo analysis, for example when some set of perturbations could be used to enhance system performance.

Although ZEMAX does not report the individual perturbations in a Monte Carlo analysis, this information is available to the user if the Monte Carlo files are saved. The user could simply open each Monte Carlo file in turn to determine the perturbations that were applied in that run.

For a large number of Monte Carlo runs – with an associated large number of files – this process would be tedious. However, the process can be automated using a ZPL macro. In the Knowledge Base article entitled “How to Open Consecutively-Named Lens Files Using a ZPL Macro”, information is given on how to open the Monte Carlo files from a macro. In this article, we’ll go into greater detail on how to extract data from each of the files, and generate a summary report of the individual perturbations in each file.