The error function is minimized in automatic design in the least squares sense. Unless constraints have been included with the WTC control, it is composed only of weighted aberration terms. Specifically, such a merit function could be expressed as
As a practical matter, such a simple set of weights is not oriented to the designer's needs since it does not allow for cross terms (e.g., a given weight on the second field for the third zoom position). Thus CODE V uses weighting arrays for X or Y components as a function of field and zoom, wavelength weights as a function of wavelength and zoom, and aperture (or ray-) weights as a function of ray and zoom position. The composite error function is of the form
In the output, the partial error functions are the two terms above, omitting WTX(Z,F) and WTY(Z,F). These two weights then are applied as above to form the composite error function.
The indicated weights are related to, but not identical-with, the CODE V entries of the same names. If s2r and its partials s2x and s2y are to have any physical meaning, the weights must be carefully normalized. Thus, wavelength weights of 1, 2, 1 and 2, 4, 2 must produce the same values of s2r, s2x and s2y This means that a change of weights will cause only a redistribution of emphasis without departing frown the physical significance.
where
X0, Y0 are the ray coordinates in the pupil |
a is the CODE V entry, WTA |
A is the normalization factor for this weight |
The value of a can be used to shift emphasis from the center of the pupil to the edge which~has some correlation to shifting the emphasis on MTF from low frequencies to high frequencies, and can be used to fine tune the final performance. The default value of a (0.5 for ray aberration error functions) gives emphasis to minimizing blur diameter, while values in the range of 0.65 to 0.75 correspond more closely to minimizing the variance of the wave front OPD, which is most useful for near-diffraction limited lenses. If the OPD request has been made, wavefront aberrations are used directly and the default value is 0, giving uniform attention to each ray. If Gaussian or user-defined pupil anodization has been specified for the system, the weigliting for each ray is modified to reflect this anodization; the aperture weight factor is multiplied by a weight that appropriately represents the anodization at that point in the pupil. However, no normalization factors are introduced for this modification; thus the physical spot size estimated from the error function would be smaller in the presence of pupil anodization than it would be if normalized.
WTW corresponds very closely to the wavelength weight entry, except that it has been normalized separately in each zoom position for wavelength. The normalization arising from the differences between zoom position is included in the normalization for WTX and WTY. This means that each partial s2x and s2y includes the effect of aperture and wavelength weights but completely excludes field and zoom weights even though the designer has implied a zoom weight in his wavelength weights. The value of s2x and s2y are the weighted mean square of the x and y half-widths of the image x106, respectively.
WTX and WTY are modified by the above mentioned zoom normalization and by their own normalization from the CODE Y entries of the same names. The normalization arising from the entries is done so that when WTX = WTY, the composite s2 represents the weighted mean square radius of the image x 106 and, when WTX or WTY = 0, s2 represents the weighted mean square of the image half-width x 106. Unequal values of WTX and WTY generate a smooth continuum between thee two cases.
If WTC is used for any constraint, a term of error function is developed of the form
where Dc is the departure of the constraint from its target.
WTC is the value entered for WTC and the composite merit function is
s2, s2r and s2c are all printed in the output.
The amount of departure of the constraint from its target will depend on three things:
Some experimentation is necessary to find the desirable values for WTC; these may need modification as the design progresses to later configurations.
All ray aberrations are measured from the reference wavelength chief ray intersection with the image plane. This means that each wavelength is being optimized as a full image rather than as a set of isolated chromatic aberrations (axial color, lateral color, etc.). Use of two wavelengths is sufficient to establish correctability of primary axial and lateral color plus all of the compound effects of spherochromatism chromatic variation of coma, astigmatism and distortion of all orders. Use of three wavelengths provides the additional secondary chromatic effects such as secondary spectrum and its analogs in the other aberrations. This unified treatment aids in achievingproper balance over the entire spectral band and field.
The purpose of the wavefront variance error function is to provide a performance criterion which relates directly to the Strehl ratio in near diffraction limited optical systems. In addition, the coordinates of the image centroid at each field angle are computed and may be constrained directly or via user-defined constraints.
Based on the input ray grid specification (DEL), ray grids are traced at each wavelength, field, and zoom position. The wavefront variance is minimized at each field by computing the optimum phase shift and x and y shifts from the chief ray to the best fit image centroid. Given this information, the terms in the error function are then computed.
The error function terms represent the variance with respect to the best image point in the image plane At each field, the contribution to the variance for each grid ray is obtained by an expansion of the wave error allow the neighborhood of the ray (L G. Seppala "Optical Interpretation of the Merit Function in Grey's Lens Design Progam," Applied Optics, 13, 3 (March 1974), pp. 671-678). Both the phase retardation of the ray and the wavefront slope (obtained from the transverse ray aberrations) are used in the expansion. The variance contribution E for each ray is:
E = 4 · WTR · WTW · WTA · WTGX · WTGY · OPD2
+ 4/3 · WVB · [WTX · WTW · WTA · WTGX3 · (EN · DX)2
+ WTY · WTW · WTA · WTGY3 · (EN · Dy)2 ]
where
WTA, WTW, WTX, WTY, WVB have their CODE V meanings
WTR = SQRT(WTX2 + WTY2)
WTGX, WTGY are aperture integration limits
OPD is the phase retardation
Dx, Dy the transverse aberration with respect to the best image point
EN the Z component direction cosine of the ray
It is important to recognize that the square root of the function being minimized is listed and not the function (variance). This output differs from the transverse ray aberration error function where the sum of the squares is output. Thus in the case of the same convergence of the two error functions, a factor of 10 reduction in the printed OPD error function corresponds to a factor of 100 reduction in the printed transverse ray error function.
The error function and the units of its printout were chosen so that the designer could compare the results of AUTO and WAVE and find a reasonable degree of correlation. Decreasing the DEL parameter in AUTO will improve the correlation of the printed values for the two options. The important parameter, however, is the change in variance minimization rates with decreased DEL. Adequate optimization results may often be obtained with DELs which produce function values differing from WAVE.
Either an OPD or D-d (DMD) request provide wave aberrations as merit function components. Since the wave aberration of a single ray inherently is a single number and has no x or y component, some of the capabilities of CODE V correction balancing would be lost if no special provision were made. Also, scaling of wave aberration components is desirable to provide error function magnitudes which are similar to those of the corresponding ray aberrations; it is essential when D-d aberrations are combined with ray aberrations. To accomplish both goals of x and y components and consistent scaling, the wave aberrations are converted using a simple defocus model:
where | W is the wave aberration |
X0, Y0 are defined as before | |
R = SQRT(X02 + Y02) | |
f/no is the paraxial f/no |
Note that in the combined value DX2 + DY2, X0/R and Y0/R drop out if WTX=WTY.
This scaling process gives some sense of separation into x and y components when the user wants to emphasize one or the other with weights but not in the direct manner of ray aberrations. For most systems, this "soft" separation into x and y components is entirely satisfactory; an example, however, where the complete separation of ray aberrations into components is needed would be a spectrograph where blurring along the spectral line is completely acceptable and an important added degree of from in the design.
It is not recommended to use DMD on systems containing HOEs, GRT surfaces, or gradient index materials.
There are four ways to calculate the aberrations which go into the merit function. These are summarized in Table 3.
Table 3. Merit function aberration calculation.
Type of Aberration | ||
---|---|---|
Input | Reference Wavelength | Non-reference Wavelength |
Default | ray | ray |
D-d | ray | D-d |
OPD | wave | wave |
D-d and OPD | wave | D-d |
When through-focus optimization (TFO) is enabled, the zoom-focus weights (WTT) are cascaded with the field-zoom-focus weights (WTX and WTY) according to the relations:
WTX(Z,F,D) = WTX(Z,F,D) · WTT(Z,D) and
WTY(Z,F,D) = WTY(Z,F,D) · WTT(Z,D),
where D stands for defocus. The defocus position weights are internally normalized such that when default values are used, the three focal planes generated by the TFO command have the same cumulative weight as the single focal plane in a zoom position where TFO is not enabled. That is, turning on TFO with default WTT values does not change the relative zoom weights. Of course, the error function calculation with TFO turned on includes an additional sum over focus position. The normalization for WTX and WAY is done separately for each focus position; i.e., these weights are normalized over all field-zoom values in the same manner as when TFO is not enabled.
The component of the MTF error function for each frequency is as follows:
MTF component = WTM2 · [(MTF-TGM)2 + WTP · (PTF)2 ]
where | MTF is the modulation transfer function value |
PTF is the phase transfer function value | |
WTM, TGM and WTP have their CODE V meanings, but note that WTM is normalized |
The user-defined error function is a single number that may or may not have any physical significance, depending on how users define their aberrations. The contribution to the error function for a predefined aberration type is given by:
Predefined error function component = (AWW · AWE · ABRweight)2 (ABRvalue - ABRtarget)2
The contribution to the error function for a user-defined aberration is given by
User-defined error function component = (ABRweight)2 (ABRvalue - ABRtarget)2
Since it is not possible to provide a pre-defined set of constraints that encompasses. all possible needs in optical design, CODE V allows you to easily define constraints that are specific to your own needs. This capability is now closely linked with the CODE V Macro-PLUS™ language, which allows access to the CODE V database and other calculations, ray data, etc. and also defines the syntax for the functions and expressions that are used in user-defined constraints; please see the section on Macro-PLUS for a description of these items.
Things to Remember
Once a UDC has been defined, it can be used in the definition of further expressions or specified for control during the AUTO execution. The usage of a UDC as a constraint is done in the same manner as any other specific constraint. The form is:
@UDC_name > |=| < targetwhere @UDC_name is the UDC name and target is the desired value or bound for the constraint. (Note that @ is used instead of the ^ variable designator of Macro-PLUS; this is to denote the fact that the UDC will be evaluated later. when AUT needs to, rather than immediately at input time). There is no limit on the number of characters making up a UDC name; however, the AUTO output format will truncate names over 21 characters long. This should be long enough for virtually all situations.
For example, assume we wished to bound the sag of surface 5 in our lens to be less than 2 mm at a height of 10 mm on the surface. CODE V has a pre-defined sag function (SAGE) that contains 4 arguments, the first being the surface number, the second the zoom position number, and the third and fourth then and y coordinates respectively on the the surface. Thus, all that is needed in this case is to input:
@SAG_S5 == SAGF(5,1,0.0,10.0) @SAG_S5 < 2.0When defining expressions to be constrained in AUTO, you must insure that the expressions are continuous in value and slope. Failure to do so will result in erratic and unpredictable convergence. Types of expressions to be avoided are the following:
@RATIO == SQRTF(X**2)/Xis discontinuous in value since it can take on either the value of +1 or -1, depending on the sign of X. On the other hand, the function
@RADIUS == SQRTF(X**2)is discontinuous in slope (+X). If the value of X oscillates around zero, nonsense derivatives will be generated, leading to erratic convergence. The SQRTF and ABSF functions should only be used in situations where the argument is considerably away from ~ zero and in which the sign cannot change.
As with any specific constraint, the value may be displayed only (without constraining it) as a means of monitoring its value throughout the course of the optimization. This is done with the DSP command such as
DSP @RATIO
Concerns about discontinuities in value or slope do not apply if the display-only mode is to be used.
User expressions can often be helpful in customizing the error function; like any other specific constraint, the entry of the WTC following the constraint entry causes the weighted difference between the value and the target to be abided to the error function. (Please see the earlier discussion of WTC in the Technical Notes and elsewhere in the AUTO option).
Error conditions can occur when the expressions are evaluated during optimization. For example:
In case of these or similar errors, the expression which is the source of the error can often be found by examining the constraint values and/or costs. If needed, the expressions can be broken down so that the denominator or argument is a separate statement, which can then be listed by declaring it to be a display-only constraint.
The applications of user-defined constraints can range from the very simple to the very complex. These examples may help to illustrate that wide range.
@OBSR == (Y R2 S2 F1)/(Y R2 S1 F1) @OBER < .4
@DEL_OAL2 == (OAL Sl..I-1 Z2) - (OAL Sl..I-1 Z1) @DEL_OAL3 == (OAL Sl..I-1 Z3) - (OAL Sl..I-1 Z1) @DEL_OAL2 = 0.0 @DEL_0AL3 = 0.0
It is also common in such systems that the image distance must be constant between zoom positions. This is done by:
@DEL_IMD2 == (IMD Z2) - (IMD Z1) @DEL_IMD3 == tIMD Z3) - (IMD Z1) @DEL_IMD2 = 0.0 @DEL_IMD3 = 0.0
The method involves tracing two rays: the waist ray, characterizing the waist diameter, and the divergence ray, characterizing the beam divergence angle. Two object points are used, the first is on-axis, the second is at the waist radius. The divergence ray is the on-axis marginal ray (R2 F1), and the waist ray is the off-axis marginal ray (R2 F2). The object distance is set equal to the Rayleigh distance and the EPD is set equal to the waist diameter. Let the variable ^waist be the waist diameter. Then we need to modify the lens setup as follows (assuming the lens is originally set up with the object distance at the original waist distance and the dimensions are mm):
THI S0 3.1416*^waist**2/((wl wl)*le-6) EPD ^waist YOB 0 ^waist/2
We need to define UDCs representing the divergence ray and the waist ray. We also will define UDCs for a quantity V, which is the direction tangents of these rays. The direction tangents can be obtained as the ratios of the Y and Z direction cosines. Let the global variable ^surf be the surface at which we want to control the Gaussian parameters.
AUTO @YD == (Y R2 Fl S^surf) @YW == (Y R2 F2 S^surf) - @VD == (M R2 Fl S^surf)/(N R2 F1 S^surf) @VW == (M R2 F2 S^surf)/(N R2 F2 S^surf)
Now we can define the beam radius at the surface W. the waist location, Z0, and the waist diameter, W0. The UDC equations are:
@W == SQRTF(@YD*@YD + @YW*@YW) @Z0 == (@YD*@VD + @YW*@VW)/(@VD*@VD + @VW*@VW) @W0 == (@YW*@VD - @YD*@VW)/SQRTF(@VD*@VD + @VW*@VW)
The desired quantities are then given their constraint values (@W = 0.02, etc.). It is important not to overconstrain the available variables with exact constraint requests. It is at times both desirable and necessary to input these types of constraints with WTC requests, including them in the error function and thereby solving for them in a least squares manner rather than exactly. The default error function can then be suppressed, if desired, be setting the WTW or WTF values to zero, or by using the ERR CON command.
FCT @abs_thi(NUM ^i, NUM ^j) ! ! This function returns the sum of the absolute values of the ! thicknesses from surfaces ^i to ^j ! LCL NUM ^k ^sum_thi ! ^sum_thi == 0.0 FOR ^k ^i ^j-1 l ^sum_thi == ^sum_thi + ABSF((THI S^k)) END FOR ! END FCT ^sum_thi
The sequence containing this UDF would be read into CODE V prior to executing AUTO for the first time. UDCs could then be defined and constrained in AUTO using this UDF:
@ABS_OAL_2_7 == @ABS_THI(2,7) @ABS_OAL_9_13 == @ABS_THI(9,13) @ABS_OAL_2_7 = 1350.0 @ABS_OAL_9_13 = 2475.0
Excerpted from the CODE V Reference Manual. (c) Copyright 2002 by Optical Research Associates. Excerpted by permission of Optical Research Associates. All rights reserved. No part of this excerpt may be reproduced or reprinted without permission in writing from Optical Research Associates.
Maintained by John Loomis, last updated 19 June 1999