# How to modify field data in the Merit Function Editor using the FDMO operand

The FMDO optimization operand allows field points to be re-defined on the fly during optimization. This means that any operand that uses a field number as an argument can be computed anywhere in the field of view. This article explains how to use this powerful capability.

Article Attachments

## Introduction

Discrete sets of field points may be specified in OpticStudio within the Field Data Editor. However, there are rare situations during optimization where it is necessary to have an arbitrary number of, and arbitrary values for, the field points. This can be done using the FDMO operand.

FDMO allows system data - field point values, in this case - to be modified on-the-fly inside of the Merit Function Editor. All operands which follow the FDMO operand in the Merit Function Editor use the modified field data. The original field data are restored with the use of the FDRE operand. Field data will also be restored when a CONF operand is reached, or when the last operand in the Merit Function Editor is reached.

## A simple example with the FDMO operand

An example (FDMO_test.zmx) demonstrating the use of the FDMO operand can be found in the .ZIP file located at the top of this article. This example contains a simple system of dummy surfaces, for which the ray coordinates can be easily calculated analytically. The design has three configurations: each configuration allows both the field type to be modified and for surface 1 to either be included or ignored: The field point values for Field 1 and Field 2 are (0,0) and (0,1), respectively, with radial normalization of the field coordinates: Ray coordinates are determined for this simple case using the CENX and CENY operands. These calculations are consistent with the equation: so that the ray position on the image plane (i.e. the image height) is simply the ratio of the object height to the object distance multiplied by the image distance (= 10 mm). The object distance is 200 mm (thickness of object plane plus thickness of surface 1) for configurations 1 and 3 and 100 mm for configuration 2 (where surface 1 is ignored).

Calculations of the ray x and y positions are performed in the Merit Function Editor, both for the original field data as well as for modified field data: As the x and y coordinates of the field data for each field point are varied, the corresponding values for the image height in x and y track accordingly. Notice that when each CONF operand is reached, the original field data are restored.

## Calculating the Strehl Ratio at arbitrary fields

A more interesting example which employs the FDMO operand is for the calculation of the Strehl ratio at arbitrary field points. This calculation is currently available using the analysis feature Analysis...RMS...RMS vs. Field, where the Strehl ratio (S) is calculated from the RMS wavefront error (s) using the formula: The Strehl ratio may also be calculated using the STRH operand, which employs the Huygen’s PSF computation. To calculate the Strehl ratio at arbitrary field using the STRH operand, we construct a Merit Function which alternates FDMO operands and STRH operands. This procedure is automated using a ZPL macro (FDMO_TEST.ZPL), which can be found in the .ZIP file located at the end of this article. This macro is to be used with the lens file {Zemax}\Samples\Sequential\Objectives\Doublet.zmx (before running the macro with this file, you will need to add a field data point in the Field Data dialog box, with x=0 and y=2). The macro uses the keyword SETOPERAND to place the FDMO and STRH operands in the Merit Function Editor with the appropriate input values. The functions MFCN and OPER and then used to evaluate the Merit Function and return values for the Strehl ratio, respectively. The PLOT keyword is then used plot the results to a graphical window.

Computation of the Strehl ratio using the above formula is also performed in the macro, and results obtained from the two methods are presented in the same graph for comparison: For values of the Strehl ratio corresponding to diffraction limited performance (S > 0.25), there is very good agreement between the methods of calculation. For lower values of S the methods disagree in this case. However, the formula used to calculate the blue curve is generally only valid for small values of the wavefront error, which is becomes less and less true as S gets smaller. Thus, in this region the Huygens computation (as given by the STRH operand) is much more likely to yield an accurate result.

If you open up the Merit Function Editor after executing the macro, you will find that the appropriate number of FDMO and STRH operands have been placed within it: KA-01453