Skip to main content

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

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



 


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