Solved

How to use ZPL to retrieve an analysis window value?

  • 6 December 2021
  • 2 replies
  • 237 views

Hello,

 

Many Zemax operands are designed for the Image plane, but the intermediate surfaces are of an interest.  For example, the wavefront in the collimated space could affect the spot size in an imaging system.  The wavefront operands work on the image plane, so for an intermediate surface we could open a Wavefront Map analysis window for the surface of interest.  This works only for one instance, but for design and tolerance analysis is there a method in ZPL?

 

Seems like there are ZPL commands to change the analysis window settings, save the data, open the data, and retrieve a specific text string, but is there a more direct way to retrieve an analysis window value? 

 

Maybe I just missed the few key ZPL commands, if there was a way.  This would be useful for other operands specifically designed for the Image plane.

 

Regards,

Nathan

 

icon

Best answer by Jeff.Wilde 6 December 2021, 22:16

View original

2 replies

Userlevel 7
Badge +3

Looks like the ZPL has limited ability to change the surface number for the Wavefront Map analysis function.  It doesn’t appear to be supported using the MODIFYSETTINGS keyword:

 

However, the ZOS-API provides much more functionality.  I prefer using Matlab for the interface.  For example, for the Wavefront  Map, here are the available settings (including Surface number):

Say you want to change the surface number (to 9) and the sampling (to 256 x 256), then re-run the analysis -- you simply type:

The raw data, as well as header data, can be easily extracted.

In general, the ZOS-API is much more powerful.  It’s object oriented and takes a bit of time to learn, but the benefits are significant if you need maximum flexibility with programmatic control.

Userlevel 7
Badge +2

Hi Nathan,

 

I completely agree with @Jeff.Wilde. I would only use a macro if the task is trivial but repetitive. Something simple to execute, but needs to be done repeatedly. As soon as it requires more complexity, the ZOS-API will provide better functionality. Also, I have a feeling the ZOS-API recieves more attention in terms of development time at the moment.

I had previously made a snippet for the Wavefront Map analysis in Python if that is relevant for you, although very similar to MATLAB. You can find it here.

Take care,

 

David

Reply