xzos/PyZDDE

PyZDDE giving different results than Zemax

lakodarmstadt opened this issue · 3 comments

Hi,
I know the title might sound a bit weird but I have trouble with a python script using pyZDDE giving (only sometimes!) different results for PhysicalOpticsPropagation than Zemax itself. I am not even sure if this is a pyZDDE problem, but maybe someone has encountered something similar already and can help.
So the situation is the following: I have two similar optical setups (Two different zmx-files) in Zemax and I want to find the focus. To do this I have one python script where I specify the zmx-file and use pyZDDE to plot the spot in the image plane for different distances of the image plane from the last surface. Everthing works fine with this script: I get nice 2D-plots, can calculate the spot size and find the focus for both optical systems. However, when I want to reproduce the focal spot in Zemax itself, for one zmx-file (one of the optical systems) the spot is the same, for the other one it is completely different and the image plane has to be shifted approximately 50um to see the focal spot.
I have tried different things like to restart zemax and python, saving or not saving before changing between the two cases but the result is always the same.

LucVV commented

Hi @lakodarmstadt,

First of all, apologies for the delayed response.

Could you please give somewhat more insight in the issue. For instance, are you using settingfiles, and with what settings? Also, what is the difference between the optical setups?

Kind regards,

Luc

I've encountered similar problems.
I first used zSetPOPSettings to get the same setting as I would on Zemax GUI. Then I used zGetPOP() to get the propagation result. However I couldn't replicate the POP results on the Zemax GUI.

LucVV commented

Hi @Luochenghuang, which version of zemax are you using? I have little experience with this function, but I can think of several problems. One of the problems is that Zemax is dropping the ZDDE support, so this might be broken. As investigation, we could try the following:

  1. Could you try to save the settings you use in the Zemax GUI and use this file as settingsFile for the PyZDDE zGetPOP(). The save button in the GUI should save it to someting like user\\Zemax\\Configs. If the output differs using this method, the GETTEXTFILE Data Item of zemax might be broken. If so, could you maybe give an indication of the differences, is everything different or only one thing?
  2. If option 1 works, we could try to replace the default config file with the file created by zSetPOPSettings and then load this file using the Load butten in the GUI. This should give you the settings you want in the GUI. If not, the file that is created might be faulty. I think that Zemax uses its own default settings in such a case, which gives different results.

If you have time, could you check out option 1, this would be very beneficial.

Kind regards,

Luc