Solved

Getting the POPD fiber coupling value using ZOS-API via Python

  • 27 May 2021
  • 3 replies
  • 219 views

Hi, 


I try to write a ZOS-API pyhton script that for a parameter change computed the POPD coupling integral. I looked in the API of ZOSAPI.Analysis.PhysicalOptics.IAS_PhysicalOpticsPropagation and could find a function that does it. I tried also to retrieve it via the merit function using the POPD operand value(when Data is set to zero). I found the founction that does that, but each time I change the parameter I need to update the merit function. I tried the ZOSAPI.Editors.MFE.IMeritFunctionEditor.CalculateMeritFunction() command but then I get 'TypeError: not enough arguments' error message. In the API no input arguments are described. 


 


I would appericate if someone can advise me about a proper way to get the POPD fiber coupling value


 


Thanks,


Leonid

icon

Best answer by David.Nguyen 27 May 2021, 18:09

View original

3 replies

Userlevel 7
Badge +2

Hi Leonid,


Getting this value from a Merit Function operand is handy. Provided you are ok to save your settings for the POP analysis feature beforehand (see the Help File about POPD).


You can use GetOperandValue, which returns the value of a Merit Function operand without needing it in the actual Merit Function Editor:



surface = 0 # Saved ending surface
wavelength = 0 # Saved wavelength
field = 0 # Saved field
data = 0 # Total fiber coupling
Total_fiber_coupling = TheSystem.MFE.GetOperandValue(ZOSAPI.Editors.MFE.MeritOperandType.POPD,
surface, wavelength, field, data, 0, 0, 0, 0)
print(Total_fiber_coupling)

Something like the above should work in a Python Interactive Extension, or Standalone Application. Change the data variable to whatever is most relevant to you.


Let me know if this works for you. Or if you need help setting up the whole POP analysis through the ZOS-API.


Take care,


David

Hi David,


Thanks! It works!


Leonid


 

Userlevel 7
Badge +2

Hi Leonid,


No problem, don't hesitate to mark my response as the answer to your question such that other people in the future can refer to it.


Take care,


David

Reply