Solved

Getting POP Output Data with Python ZOS API

  • 31 May 2023
  • 5 replies
  • 251 views

Hello. I am currently trying to extract the POP output beam data with the ZOS API with not much luck. I would like to pull the data from the POP itself rather than the mfe since i have noticed that the mfe will not update POPD operand values with the input POP settings from an astigmatic gaussian POP. It seems that in the articles I have looked that the the GetResults() from POP will give you the header value and the datagrid pixel value. Since I am trying to get the Raleigh Range, Waist Location, and Waist size data of my beam at the out put place I thought that maybe pulling the data from HeaderData.Lines[7] would work since the beam data is in the line after the irradiance data (line 6t), but when I try this I get an error saying that 7 is past the limit of lines, so I am not sure where to pull this data? I am also noticing that there is a slight bug in the POP data where if propagating X and Y separately, like in my case, it will only output pilot beam data for just x vs for x and y. See screenshot below with the data I am speaking of. Help is appreciated thank you so much for your time!

 

icon

Best answer by Jeff.Wilde 4 June 2023, 21:15

View original

5 replies

Userlevel 7
Badge +2

Hi Armand,

 

I had the same issue when trying to read the HeaderData. However, I had better luck with the method GetTextFile of the POP result interface. GetTextFile recreated a copy of the POP text tab, and it contains the information you need. You could then parse that text file to get your data. Can you elaborate on the problem with POPD? I think it might be more straightforward to use POPD but I didn’t get the complete picture from your description of the problem.

I’m not sure about the pilot beam issue you are reporting, it is likely that a single pilot beam is used if you don’t separate X and Y. The pilot beam isn’t the beam you’ve setup in the POP settings, its a beam that is propagated through your system before your actual beam to determine what algorithms should be used for the propagation of your beam. If you search the Help File for the Separation of X and Y Propagation section, you’ll find the line:

If the propagation in X and Y is separated, then there will be two pilot beams; one each for the X and Y direction

If your beam has different X/Y parameters, it might be better to separate X and Y (it might be slower, but will be more accurate).

Take care,

 

David

Hi David,

 

Thanks for the response. I was afraid that the text file thing might be the way to go. I was trying to avoid that since in my program I am trying to run a large batch script and want to avoid saving and processing a gazillion text files. As far as the POPD thing goes, I think that may just be that in my program I am wanting to open a new POP window each time (mostly since i was unable to find a good way of editing the settings in my existing original POP window in the zosapi) and I noticed that it seems that the POPD beam definition info isn’t being pulled from the actual original POP window but that its assuming a symmetric gaussian beam with diameter defined by the aperture value in the aperture window. Maybe I am doing something wrong here to get the mfe POPD to optimize via a POP window settings? I’ll have to look into this more. Also to answer your comments towards the end of your post, x and y are separate in my POP settings since both have different values and my mfe is optimizing for both axis separate of each other accordingly. If there is a good way to update the existing POP window such that I can use the defined astigmatic POP beam for the POPD parameters to update properly as the mfe is updated, that would be a better way to get the data I want in my python script using the ZOSAPI. Thanks for your help David!

 

-Armand

Userlevel 7
Badge +3

Hi Armand,

To use POPD properly, you should define the POP settings the way you want in the GUI, then hit the SAVE button:

 

Then when you update the MFE you should get the results you expect.  Otherwise, POP will use previously saved settings.

Also, if you want to use POPD in an API script, then you should consider the GetOperandValue function.  This allows you to run POPD (or any optimization operand) outside of the MFE.  Or you can just use the GetOperandAt function to pull values from the MFE after updating it. 

As David mentioned, the Waist, Position & Rayleigh values reported in the POP header only apply to the pilot beam, not to the propagating beam defined within POP (Astigmatic Gaussian in your case), unless the pilot beam just happens to be identical to the propagating beam.  The propagating beam can incur aberrations, while the pilot beam retains its Gaussian character.

The propagating beam properties can be pulled from POPD.  Alternatively, if you have a simple astigmatic Gaussian beam propagating in a system with negligible aberration, then the Skew Gaussian Beam analysis will provide the waist, location, and Rayleigh range data for your beam.

Regards,

Jeff

Hi David,

The save button seemed to have done the trick! I know that in the API there is the ApplyAndWaitForCompletion() command to apply the settings to a window, but is there a command for the Save button as well so my script can update the POP global settings so mfe can update property before the data is pulled into my script? Thanks!

Userlevel 7
Badge +3

Hi Armand,

Yes, you can change the POP settings, save them, then run POPD.  Here’s a Matlab example:

There should be a similar construct using Python.  If you have any problems, David is well-versed in Python, so he can probably assist.  This recent link may also help:

Regards,

Jeff

Reply