Geometric image analysis ZPL API incomplete

  • 28 June 2023
  • 4 replies
  • 121 views

Hello! A feature request -- could you please complete the ZPL API for geometric image analysis? It would be handy to be able to modify parameters available in the GUI that aren’t included in the API yet like the “use polarization” check box & the reference dropdown menu. 

Thanks!

Liz 


4 replies

Userlevel 7
Badge +2

Hi Liz,

 

Just so people don’t get confused, I think you are refering to the ZPL macro langage. Because this setting is available in the ZOS-API. Here is a Python example that demonsrates how to set the polarization flag:

# Open a new Geometric Image Analysis
geo_imag_analysis = TheSystem.Analyses.New_GeometricImageAnalysis()

# Retrieve the settings of this analysis
geo_imag_settings = geo_imag_analysis.GetSettings()

# Toggle the polarization flag
geo_imag_settings.UsePolarization = True

# Apply settings and run the analysis
geo_imag_analysis.ApplyAndWaitForCompletion()

Take care,

 

David

Hi David, 

Is there a way to extract the percent efficiency using the zos api?

# get results
geo_imag_results = geo_imag_analysis.GetResults()

# extract percent efficiency

The output I’m looking for would be the same as what I can calculate with IMAE in the merit function. 

In this post, @MichaelH discusses saving and then parsing a .txt file with this information. Do you know if there is a quicker/more streamlined way to do this? 

Thanks!

Liz 

Userlevel 7
Badge +2

Hi @liz_strong,

 

The results of geometric image analysis aren’t fully implemented as I can tell. So, parsing the text file seems the way to go as @MichaelH suggested.

I’m not sure if that’s what you want, but you can also evaluate a single Merit Function operand, such as IMAE, with the GetOperandValue method from the Merit Function Editor interface.

In Python, you’d do something like so:

from ZOSAPI.Editors.MFE import MeritOperandType

efficiency = TheSystem.MFE.GetOperandValue(MeritOperandType.IMAE, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)

print("Efficiency: " + str(efficiency * 100) + "%")

The ouptut looks like so:

Efficiency: 100.0%

Does that help?

Take care,


David

Yep, thanks David! 

Reply