Skip to main content
Solved

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


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

Best answer by David.Nguyen

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

View original
Did this topic help you find an answer to your question?

3 replies

David.Nguyen
Luminary
Forum|alt.badge.img+2
  • Luminary
  • 1089 replies
  • Answer
  • May 27, 2021

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

 


David.Nguyen
Luminary
Forum|alt.badge.img+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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings