Skip to main content

I’m having some trouble running a tolerancing script in OpticStudio, where I continually get the “nominal criterion cannot be computed” error when I attempt to run the script. I’ve tracked it down to a CPAR compensator I’ve defined on a Zernike Fringe Phase surface. I’m attempting to use the phase surface Z9 term to null the system spherical for each Monte Carlo file in the tolerance analysis.

I’ve confirmed the compensator is defined correctly (CPAR Surf# Param23), and I’m able to set the same parameter to a variable and optimize in the nominal design file, so I can’t understand why the tolerance script cannot implement this as a compensator. If I comment out the CPAR line, the nominal criteria evaluates and the script runs without issue. Can anyone explain why I’m unable to use this compensator?

Hi!

I am facing a similar issue when trying to perform a MC defining as the tolerancing criterion a user script. If I define the CPAR in the script referring to a coordinate break and specifying tiltX or tiltY as the compensator, everything works fine without errors. However, if I set the CPAR in the script to refer to a “Zernike standard sag” surface and assign parameter numbers 16 or 17 (to set as a compensators Z2 and Z3) then I get the same error, i.e. “nominal criterion cannot be computed”. 

I also tested a similar approach, but instead of usin the script, I directly set the merit function as the criterion and defined the compensators in the tolerance data editor as CPAR Surf# Param16 and Param17. In that case, the error does not appear and  I can get the results without any problem. 

Did you figure out how to solve this? Or does anyone know how to handle this issue specifically through a user script?

 

Thank you very much!!


I also found no issue when I defined the compensators in the tolerance data editor. I also found that Zernike terms are also not correctly perturbed when using the “PERTURB” command in a tolerance script (no error is thrown for this, but after generating MC files you will find that the specified terms will still have a 0 value). So the issue seems to be related to Zernike terms specifically.

I went as far as to open a ticket with Zemax on this issue and it’s still unresolved. Customer support was able to replicate but no luck with a solution, even temporary. For my case I think I wound up using a combination of workarounds: I used Irregular surface type instead for perturbing irregularity, and to use a Zernike surface as a compensator I first generate MCs without the compensator defined, then used a ZPL macro to reopen the MCs, set desired parameters to variable, then reoptimized and saved. It was considerably more time consuming and still didn’t quite replicate the routine I was hoping for, but it got me through.

In your case, the Irregular surface type may work, it has Tilt X and Tilt Y parameters.


I also tried something similar to what you mentioned, but using the ZOS API. I run the MC simulations correcting the tilt with a coordinate break, save the MC files, reopen them, and then optimize with the Z2 and Z3 terms of the Zernike Standard Sag as variables, saving the files again.

Since the CB approach followed by reoptimization works well for me, I think I’ll stick with that solution. However, it’s good to know that no issues come up with the irregular surface.

Thank you for your answer! Let’s hope the support team can figure out how to solve the issue. 


This looks like a bug. 

In the days of old, there was something called the Extra Data Editor.  The Lens Data Editor only had a 12 fixed parameters and any surfaces that needed parameters above 12 had to use the EDE.  In the tolerancing script, there is a CEDV which the Help Files states is deprecated but it was never actually removed and it still works.  For CPAR, since it originally could only handle 12 parameters, if you try to enter a value larger than 12 in the Int2 position, OpticStudio throws a hard-coded error.  CEDV has an offset of the original 12 parameters, so if you want to make the Z9 (Par 23) term a variable in a user script, you can use CEDV Surf# 11.

Another option if you don’t want to subtract 12 and keep to keep your file/script readable to other uses would be to place the parameter under multi-config control and use CMCO.


Reply