Using Tolerance Scripts

Tolerance Script overview

Tolerance scripts are macro-like command files that define a procedure to follow for evaluating the perfomance of a lens during tolerancing. Scripts allow simulation of a complex alignment and evaluation procedure for a lens. With scripts, the following actions can be taken to evaluate a perturbed lens:

  • Add or remove compensators.

  • Load new merit functions.

  • Optimize defined compensators using any merit function.

  • Monitor and report any value OpticStudio can compute via a merit function (which includes essentially any value OpticStudio can compute since the merit function may call ZPL macros). Other data, such as Zernike coefficients, may also be computed.

  • Write data out to text or binary files for later analysis.

  • Save lenses at any stage of the analysis to a ZMX file.

Any number of these operations may be combined in the script; so multiple merit functions and compensator groups may be defined. The script is executed many times during the evaluation of the tolerance analysis, including:

  • Once to compute the nominal data.

  • Twice for each tolerance operand in the sensitivity analysis, (once for the min and once for the max tolerance).

  • Multiple times for each tolerance operand in the inverse sensitivity analysis (inverse sensitivity may require iteration).

  • Once for each generated Monte Carlo lens.

The tolerance script files must be text files ending in the extension TSC, and be placed in the <data>\Tolerance folder (for details, search the help files for "Folders").

When using tolerance scripts, the min and max boundary values of compensators are not enforced; search the help files for "General comments about min and max values on compensators" for more information. If any compensators are defined in the script, then no compensators are allowed in the Tolerance Data Editor.

Next: