# Tolerancing surface irregularity using a phase surface

In this article, we demonstrate how to tolerance the irregularity of an off-axis parabola (OAP) using a phase surface. The method can be used on any surface type in OpticStudio. In the article "Adding a phase surface to an off-axis mirror", we demonstrated how to insert and position the phase surface for the OAP. Now, we’ll use the phase surface to tolerance the surface irregularity of the mirror in a variety of ways: manually, using a Zemax Programming Language (ZPL) macro; using the Application Programming Interface (ZOS-API) through Mathematica; and using the ZOS-API through Matlab.

Finally, we’ll discuss how to incorporate irregularity tolerancing into a larger tolerancing analysis.

Authored By Erin Elliot, Michael Humphreys

Article Attachments

## Introduction

In OpticStudio, the TEZI tolerancing operand allows for automatic tolerancing of irregularity for Standard, Even Asphere, or Toroidal surfaces with on-axis apertures. For other types of surfaces, or off-axis apertures, a more general method, utilizing a phase surface,can be used to tolerance surface irregularity.

In the following sections we demonstrate how to tolerance surface irregularity of an off-axis parabola using a Zernike Fringe Phase surface. As a continuation to "Adding a phase surface to an off-axis mirror", we’ll demonstrate using a phase surface for tolerancing the irregularity of an OAP in several ways: manually, using a ZPL macro, and using the ZOS-API.

## Optical manufacturing

When manufacturing an optical surface, one usually specifies the allowed departure from the perfectly shaped mirror as a surface irregularity, or the RMS departure from the perfect shape. An off-the-shelf lens or mirror might have a surface irregularity of 0.1λ at the HeNe test wavelength of 0.6328 µm, for example.  A custom lens, such as a lens used for null testing, might have an irregularity specification as tight as 0.01λ

Usually, the form of the irregularity is unknown. For conventional polishing, it might be safe to assume that the irregularity will consist of low-order aberrations like power and astigmatism. Often, irregularity will fall with increasing spatial frequencies, according to a Power Spectral Density (PSD) curve. Diamond turning is an exception, in that it can leave a high-frequency ripple in the part.

Tolerancing of the irregularity must be carried out before creating drawings and ordering the part. For a custom part, it is crucial to discuss the form of irregularity with the part’s manufacturer. The manufacturer may provide data from similar parts, or may be able to predict the most likely form of the irregularity. If the manufacturer cannot provide guidance, then it may be acceptable to tolerance irregularity using a set of polynomials whose magnitude falls as the spatial frequency increases.

In either case, the irregularity may be modeled in various ways by OpticStudio.

## Starting file

We will begin with the OAP found in the file ToleranceIrregularity_v01_StartingFile.zar file. The OAP has a diameter of 50.8 mm, a back focal distance of -166.6 mm, and a beam divergence angle of -36.9°, as shown below. The stop is positioned at the front edge of the off-axis part.

Figure 1: A layout plot of the OAP design, with a back focal distance of -166.6 mm.

A Zernike Fringe Phase surface has been positioned just after the OAP surface, as discussed in the article "Adding a phase surface to an off-axis mirror". The phase surface is decentered, tilted, and curved to match the surface of the OAP. The surface can be used to tolerance the irregularity of the off-axis part.

## Tolerancing irregularity manually

As an example of adding a surface perturbation manually, suppose that the OAP has an error in its radius of curvature. Changing the Radius of Curvature of the parent parabola would not result in a power deformation centered on the part center. The correct way to add a power error to the OAP is to use the Zernike Phase Surface. The Zernike Fringe Phase terms are listed in the OpticStudio Help files. The power term is found in Z­4, and the total phase added to the system by adjusting the Z4 coefficient will be:

The radius ρ is normalized by the Norm Radius column on the Zernike surface and is set to just slightly larger than the clear aperture on the part. The Z4 coefficient has units of waves. Setting Z4 to 0.5, we can calculate that at ρ = 1, the peak-to-valley wavefront added should be 1 wave.

Figure 2: Setting the Z4 term to 0.5 waves and the normalization radius to slightly larger than the clear aperture of the Zernike surface.

Figure 3: The wavefront map confirms that we’ve added 1 wave of peak-to-valley power to the Zernike surface.

### Converting from wavefront errors to surface errors

The wavefront map confirms the P-V wavefront of 1 wave (Figure 3) and shows that the RMS wavefront error is about 0.27 waves. Since this is a wavefront map, some care must be taken to convert the values to surface error. The primary wavelength of the system is 0.500 µm. And a defect on the surface will appear twice as large in wavefront space. So the corresponding P-V surface error will be: (1 wave) * (0.5 µm) / 2 = 0.25 µm. For a test wavelength of 0.6328 µm, that corresponds to a surface specification of 0.395 waves P-V.

The conversions are summarized in the following table.

 Term In wavefront map (0.5 µm) In micrometers In waves at HeNe (0.6328 µm) P-V wavefront error 1.0 λ 0.25 µm 0.395 λ RMS wavefront error 0.27 λ 0.0675 µm 0.107 λ

Table 1: Converting from wavefront errors to surface errors

## Tolerancing irregularity using a ZPL macro

We can also control the phase surface, and tolerance surface irregularity, using the Zemax Programming Language (ZPL).

In the macro ToleranceIrregularity.ZPL, we’ve created a simple ZPL macro that places 0.05 waves of error on the phase surface at the system wavelength of 0.5 µm (this corresponds to 1/50 wave of RMS surface error at the HeNe test wavelength.) The macro uses a combination of the Zernike terms Z5 - Z9, which contain spherical aberration, astigmatism in any orientation, and coma in any orientation. A random value is assigned to each coefficient, and then the coefficients are scaled to achieve the target wavefront error.

The macro reports the Zernike coefficients and the resulting RMS wavefront error. The modified OpticStudio file is saved as ToleranceIrregularity_v03_ZPLMacro.zmx. The macro is a simple text file that can be opened and modified in any text editor. It must be placed in the {Zemax}\Macros folder before use. From the Programming tab, you can use the Macro List button to find the macro (ToleranceIrregularity.ZPL). A click on the file name runs the macro.

The macro assumes that the phase error on the surface is equal to the RMS wavefront error in the exit pupil, for this single-mirror system. That may not be true for a multimirror system. A more general version of this macro might use the Analyze...Polarization and Surface Physics...Surface...Surface Phase plot for the particular surface. Modifications could also be made to allow the user to specify the phase surface to use, and the target RMS phase error.

Figure 4: Example output from the ToleranceIrregularity_v05.ZPL macro.

## Tolerancing irregularity using ZOS-API

The API (Application Programming Interface) in OpticStudio is a powerful way to build custom simulations that use data from OpticStudio. The simulation can be controlled using any math or programming language that supports a .NET interface, such as Matlab, Python, C#, Mathematica, IDL, etc. Data can be collected from OpticStudio and analyzed and displayed in Matlab, for example.

For tolerancing, the API is especially powerful for creating custom Monte Carlo simulations. A full demonstration is out of scope for this article. But in the following demonstration, we add a phase perturbation to simulate surface irregularity on a mirror. This could be combined with any other perturbations desired, in order to create a complete Monte Carlo simulation of the system. One could also generate system sensitivities by applying the perturbations one at a time, and retrieving the effect on the RMS wavefront error, for example. (For more information about the ZOS-API interface, navigate to Programming>ZOS-API Help>ZOS-API Introduction in OpticStudio.)

In the following sections, we’ll use the API to add perturbations to the phase surface in Mathematica and in Matlab, in order to simulate surface errors on the mirror. We’ll also measure the resulting wavefront error in the system.

### OAP irregularity with ZOS-API and Mathematica

The file TolerancingIrregularity.nb contains a Mathematica program. (See TolerancingIrregularity.pdf if you don’t have Mathematica installed.) The program does the following:

• Connects to OpticStudio.
• Opens the starting file, ToleranceIrregularity_v01_StartingFile.zmx.The file has to be in the Downloads folder.
• Reads in the Zernike coefficients and displays them.
• Generates random Zernike coefficients from uniform distributions, all with a width of 1.2 waves.
• Places the coefficients into the file.
• Calculates the RMS.
• Scales the coefficients to achieve an RMS phase error of 0.05 waves.
• Places the coefficients into the file.
• Saves the file to: ToleranceIrregularity_v04_MathematicaOutputFile.zmx.

Note that the wavefront map in the output file will agree with the RMS value calculated by Mathematica only if tilt is removed from the wavefront.

The RMS phase perturbation that is added is 0.05 waves at the system wavelength of 0.5 µm. At a test wavelength of 0.6328 µm, and accounting for the double pass onto and away from the mirror, that corresponds to a surface error of 1/50 waves.

Figure 5: A spot diagram and wavefront map for the OAP, after assigning 0.05 waves of phase error to the Zernike Fringe Phase surface.

### OAP irregularity with ZOS-API and Matlab

In the file ToleranceIrregularity.m, we’ve again created a Matlab application that places 0.05 waves of error on the phase surface. There are separate functions for displaying the Zernike data and calculating the RMS phase values. In addition, the “buildZmxTestFile” function creates the required OAP file if the file isn’t found. Sample output from the program is shown in Figure 6.

Figure 6: Output after running the ToleranceIrregularity.m.

## Incorporating the phase surface into larger tolerancing runs

These macros can be used to see the effect of surface irregularity on the system performance, and therefore calculate a sensitivity to the surface irregularity. All of these programs could be modified to perturb many other parameters in order to carry out a Monte Carlo simulation. For example, a more complete simulation of an OAP might include power errors (using the Z4 term of the phase surface), tilt and decenter errors (carried out by perturbing tilt and decenter parameters in additional Coordinate Break surfaces), and optimizations of the image plane location.

The programs could also save multiple perturbed files, or just gather data from each file before resetting the perturbed parameters and repeating. For example, one might collect all of the perturbed values, the wavefront error, back focal distance, centroid location of the image on the image plane, and the location of the image plane with respect to the OAP vertex. In Mathematica or Matlab, one could also create histograms of all the data to show whether sampling is adequate and determine the standard deviations of all the resulting probability distributions.

Manual tolerancing routines written in this way are more difficult to set up, but allow almost infinite flexibility, especially when using the ZOS-API interface with a mathematical program.

KA-01792