Using the OpticStudio Non-Sequential Optimization Wizards

This article describes how the OpticStudio Non-Sequential Optimization Wizard supports the creation of common types of merit functions as well as targeting energy distributions to match any input image file.

Authored By Akash Arora


Article Attachments


Optimizing optical systems in Non-Sequential (NSC) Mode is frequently more complicated and time consuming than optimizing in Sequential Mode. The basics of NSC optimization are described in the article How to optimize non-sequential optical systems, wherein we find that all NSC merit functions must clear detectors and trace rays prior to computing criterion of interest.

This - sometimes repetitive and error-prone - process can be automated with the OpticStudio NSC Optimization Wizard. The wizard supports the creation of common types of merit functions as well as in targeting energy distributions to match any input image file. Let’s take a look at both capabilities and how they can enhance the optimization process.

The NSC Optimization Wizard

Many NSC systems seek to achieve common design goals, such as flux uniformity or maximum flux. The NSC Optimization Wizard provides a quick way to create a merit function composed of any number of these typical targets. The tool can be accessed in the Merit Function Editor via Optimization...Optimization Wizards...Optimization Wizard.

Access Wizards

You can also access the Wizards by clicking Wizards and Operands in the Merit Function Editor. (Note that this tool is not available in Mixed Mode.) The dialog, as shown below, conveniently divides the merit function components into functional categories.

Functional Categories

The Optimization Wizard will always add an NSDD operand to the top of the merit function which will clear the detectors at the start of every run. This is required for any NSC merit function and occurs regardless of the "Clear Data Settings". Beyond this, the "Clear Data Settings" option allows the user to clear individual detectors at any point in the merit function. Typically, this isn’t necessary. Unless you have a good reason to do so, leave this setting at its default value.

The Raytrace Settings support either conventional raytracing or LightningTrace™ (LT). Conventional raytracing is the default method; to use LT, select Use LightningTrace™. Note that LT only supports spatial data for rectangle and color detectors, and angular data for polar detectors; no other detectors are supported. The dialog will automatically update to show valid criteria for specific detectors when LT is enabled. For more information on LT and the sampling settings, see the OpticStudio Help File located here: The Analyze Tab (non-sequential ui mode)...Trace Rays Group...Lightning Trace.

All other conventional ray trace settings are identical to the Ray Trace Control dialog.

The "Criteria Settings" define the computed targets for the merit functions. The available criteria shown in the drop-down dialog are based upon the specified detector. Boundary targets can be easily defined with the "Boundary" drop-down menu. Then the target, be it a threshold or exact target, is defined in the appropriate text box. Additionally, a "Minimum Flux" target can be specified. This is sometimes necessary to avoid solutions with no rays landing on the detector. If there is a chance that the criterion being targeted is achieved with no rays on the detector, this should be set to a non-zero value. Otherwise, it will be ignored when generating the merit function.

The Optimization Wizard supports dynamic merit function creation with the Apply button. When pressed, OpticStudio adds operands for the currently defined settings, but the dialog remains open for additional criteria to be added. After clicking Apply, the "Clear Data" and "Raytrace" sections are deactivated by default. Typically, these settings are only defined once, at the beginning of the merit function. However, they can easily be reactivated if desired. In addition, the "Start At:" value is updated to the operand number at the end of the current merit function so that additions to the merit function don’t overwrite any currently defined operands. If only one criterion is desired, the OK button will add the necessary operands and close the dialog.

Projector example

As an example of how this tool works, open the following file: "{Zemax}\Samples\Non-sequential\Miscellaneous\Digital_projector_flys_eye_homogenizer.zmx." As the name indicates, this system was designed to be used in a digital projector. The Lenslet Arrays serve to homogenize the beam by simulating an array of sources, rather than just one, non-uniform source.

This model has already been optimized; however, we can set up a merit function to illustrate what criteria are important in this type of system.

Projector Example

For any projection system the two most important targets are flux uniformity and efficiency. We can construct a merit function targeting both values. Open the Merit Function Editor and open the Optimization Wizard. As stated previously, the "Clear Data Settings" and "Clear Detectors:" settings should be left as is. Under the raytrace settings, enable Split Rays, Use Polarization, and Ignore Errors. Our targets are for the final image plane, so select detector object 7 from the target settings. We will define "Spatial Uniformity" as the criterion and target it "Equal To" zero. Note that this is actually targeting the standard deviation of the flux distribution, thus zero is perfectly uniform. Leave all other settings at their defaults and press Apply. The dialog settings and merit function created are shown below.

Merit Function pic 1

Merit Function 2

The necessary operands have been added to the merit function. Note that the dialog stays open and the "Clear Data Settings" "Raytrace Settings" are now disabled. Any additional criteria we target do not need these operands defined again. Also, the "Start At:" value has been updated to follow all currently defined operands. Any additions to the merit function will come after the currently existing operands.

If we wanted to target an efficiency of 100%, we could have easily used the minimum flux setting; however, we will target a realistic threshold for the efficiency. A reasonable target for a projector is an efficiency of at least 65%. The source in this projector is a 10,000 lumen lamp. Our goal will, therefore, be a total flux greater than 6,500 lumens. Define the settings as shown below and click OK this time.Merit Function 3

Merit Function 4

OpticStudio has added the additional operands for total flux after the previously defined merit function. After defining the appropriate variables, the system would be ready for optimization. This process of applying additional criterion allows the merit function to be defined quickly and easily.

The NSC Bitmap Wizard

The NSC Bitmap Wizard is a specialized tool designed for targeting complex flux and color distributions on detectors. Most of the settings in the dialog, shown below, are identical to the previously discussed merit function tool. The difference here lies in the "Target Settings" section.

NSC Bitmap Wizard

Only Detector Rectangles and Detector Colors will be shown in the detector dialog, as they are the only detector types supported by this feature. The input file can be any BMP, JPG, or PNG file that is located in the "{Zemax}\IMAFiles" directory. This input image defines the relative distribution of flux and color; however, it doesn’t define the absolute flux. The total flux setting allows the targets to be scaled to achieve some total flux, while retaining the relative distribution defined in the image. If a Detector Color is chosen, the color targets setting will be enabled.

The preview shows exactly what the defined settings look like in terms of the target distribution on the detector. If the image resolution differs from the detector resolution, the image will be resampled to the size of the detector. Note that aliasing can occur for low resolution detectors, as well as simply displaying the image in the dialog. In the dialog above, a 306x306 bitmap is down-sampled to a 50x50 detector. Alternatively, the option to resample the detector is available. By activating "Resample Detector", the number of pixels on the detector will be changed to match the number of pixels in the bitmap. 

The preview also shows whether color targets are selected or if the targets will simply focus on the flux at each pixel (greyscale). The preview is a quick and powerful way to visualize the desired target based upon the defined settings.

The ability to add operands without closing the dialog applies to this tool as well. Note that the number of operands added to the merit function can be very large when using the Bitmap Wizard. For a greyscale target, one operand is added for each pixel on the detector. For a color target, three operands are added for each pixel on the detector. Even modest size image files can take some time to add targets to the merit function. A 306x306 detector requires 93,636 operands for greyscale and 280,908 operands for color. It is advisable to use the lowest resolution image that accurately represents the desired flux/color distribution.

When OK or Apply are clicked, OpticStudio will give a progress indicator at the top of the window. If the process is taking too long, the Terminate button can be pressed to abort. In this case, OpticStudio will delete any operands that were added to the merit function before the process was terminated.

Color target example

As a simple illustration of this tool, let’s take a look at the merit function created for a simple checkered color target. The image “ColorTestMeritFunction” used in this sample is intentionally basic to illustrate what the tool is doing, and is attached to this article. As shown below, an image consisting of colored quadrants is used as the target.

Colored Quadrants

OpticStudio adds three targets for each pixel when color targets are enabled. These target the X, Y, and Z tristimulus values of each pixel. In addition, a total flux operand is placed above them to ensure the absolute flux is targeted on the detector as well. It may seem tedious to define targets this way, however this method of targeting individual pixels is very efficient. Once rays are traced, OpticStudio can very quickly determine the color and intensity at any pixel. The time-consuming part of optimization is ray tracing; thereafter, data is readily computed.


Was this article helpful?
0 out of 0 found this helpful



Please sign in to leave a comment.