Hi Sunny,
I’m regularly using the optimizer through ZOS-API with Python and never ran into this issue. I’ve tried running your code on the default lens file in OpticStudio about 10 times and all of them worked fine.
Can you tell us if its happening with all the files or only with a particular one? If it happens only with a particular file, it might be helpful to share this file. Also, if you have something else in the code that might be causing it, it might be worth sharing as well.
Hope you find a fix soon.
Take care,
David
Hi @sunny.howard! As David mentioned, this probably isn’t an issue with the ZOS-API. My guess is that there is something happening during the optimization that OpticStudio cannot resolve. Crashes like these can be tricky to pin down, so I suggest looking into the following:
What kind of Merit Function are you using? Is it a built-in one, or one you generated yourself?
- If it’s one you wrote, take a look at the operands you’re using. I wonder if there’s an operand which cannot be calculated during one of the cycles in the optimization.
Also, what values have you set as variable?
- It sounds like perhaps there is a conflict between what you are trying to achieve via the Merit Function, and what you are allowing to change with your variables. It might help to to use boundary operands to constrain your solution space.
Do you have ray aiming active?
- Ray aiming is an iterative algorithm. If it’s active, confirm it’s required. If it is, ensure that potential changes in your system will not “break” the ray aiming. For example - if you have a tilt as a variable in your system, test to see what value cause the algorithm to fail.
Since the crashes happen during optimization, I would guess the problem has to do with changes happening to the system. These are some ideas I have off the top of my head based on that fact. There could be other avenues to check, but I suggest starting with these .
Thank you both for your swift replies!
The problem stopped happening at somepoint, and weirdly I am now actually struggling to reproduce it… so its fixed?! If it reoccurs I will follow your advice!
Thanks again,
Sunny