# Contrast Optimization: my merit function cannot be evaluated

• 0 replies
• 180 views

Userlevel 6
+2
• Luminary
• 721 replies

During the contrast optimization, OpticStudio uses a method called Moore-Elliott (also documented in our Help File under The Optimize Tab (sequential ui mode) > Optimization Overview > Sequential Optimization > Optimizing for MTF) where rays are traced by pairs.

• One ray is the original ray specified in the MECS operand

• The other one is a shifted ray. The shifted ray is the original ray shifted by a pupil shift. The shift is calculated as 2 times the optimization frequency over the cutoff frequency. The shifted ray is shifted once along X and once along Y.

So if the merit function cannot be evaluated with Moore-Elliott Contrast operands (MECA, MECS, and MECT), it can be that the shifted ray cannnot be traced because the shifted ray is not in the pupil.

To check the issue, I would use:

• the Single Ray Trace under Analyze ... Rays & Spots.

• the Contrast Loss map under Analyze ... MTF. On the Contrast Loss Map, you will see if some rays are missing at the edge of the pupil like this example below:

The next step then is how to fix it:

• One way is to simply ignore those rays by changing the sampling in the merit function to “rectangular array” and select “delete vignetted”.

• Another way is to check the surface where the shifted ray cannot be traced. It may that this surface is quite steep at the ray-intercept. You may want to redesign a bit the edge of that surface. It can involve undoing a bit the optimization and then change the pupil sampling so that it better controls the edge of the surface.

• Another solution is to ignore the operands that cause the errors. You can write a macro that reads through the operands and whenever an error is thrown, get rid of that operand.

Whatever solution you are going for, I think the important bit is to understand when the MTF contrast optimizer works best. It works ideally for frequencies which are below 10/15% of the cut-off frequency. So check the cut-off frequency. We also recommend to use that kind of optimization for not-well corrected systems.