Skip to main content

Everyt ime i try to use the oprimization wizard and define a function; when i press the buttons: ‘ok’  and  ’apply’ i get this error message: “Can’t open File C:\Users\user1\Documents\Zemax\MeritFunction\favorite.mf!”. And i don’t understand why,. It seems that it is not saving the function that i am defining. With this i can’t use the optimizer because it says that there are no variables defined, it seems it is not saving correctly the merit functions that idefine?

What can i do to fix the problem? Am i doing something wrong? do i have to re-install OpticStudio?

Thanks in advance for the help

Hi @Mattia ,

I suspect that the file error is due to the use of the “Add Favorite Operands” feature. If checked, OpticStudio will add the merit function defined in Favorite.mf above the DMFS line. It will by default look in the <data>\MeritFunction folder to find this file. Since you have not created this file and likely aren’t wishing to add it, just make sure to uncheck this option:

Regarding the “no variables defined” error, this message relates to the data in the Lens Data Editor, and not the merit function itself. You need to set at least one parameter in your design to be variable, such as thickness, curvature, etc. The optimizer requires at least one degree of freedom to optimize the design.

Here is a great article on optimization that will likely be helpful in setting up the merit function and variables: How to design a singlet lens, Part 3: Optimization.

Best,
Ethan


Reply