Posted Mon, 11 Feb 2019 21:28:39 GMT by Alexandra Culler Optical Engineer

How do I know what command to use to run an analysis in the ZOS-API? Once I run my analysis, how can I extract my results in a meaningful way?

Posted Mon, 11 Feb 2019 21:39:42 GMT by Alexandra Culler Optical Engineer

OpticStudio contains extensive help documentation for the ZOS-API which you can find under the Programming tab:

 

 

Within that documentation, all analysis enumerators can be found by navigating to the ZOSAPI.Analysis Namespace Reference:

 

 

Although there are analysis-specific methods available for running certain analyses, the general method New_Analysis() can be used to open any analysis type. This method requires the analysis enumeration as the input. Once the appropriate enumeration type is located, you can run the analysis using an adaptation of the following:

 

my_analysis = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.ANALYSIS_ENUMERATOR_HERE);

 

Once opened, there are in general 2 ways that analysis settings can be adjusted. Firstly, some commonly-used analyses have analysis-specific settings interfaces available. An example is IAS_FftMtf. All the analysis settings interfaces are located in the ZOSAPI.Analysis.Settings Namespace. You can also check if your analysis has a settings interface using the HasAnalysisSpecificSettings property:

 

my_analysis.HasAnalysisSpecificSettings

 

If the command returns “0”, the analysis does not have a fully-implemented settings interface available. This means that the analysis settings cannot be edited via the API but have to be changed through the second option, which is via the IAS_ModifySettings command, which modifies the settings file for the analysis (.cfg file) directly:

 

 

The ModifySettings command works very similarly to the ZPL MODIFYSETTINGS keyword. Once you’ve opened your analysis and adjusted the settings, you need to re-run the analysis and retrieve the results. You can do so with the following commands:

 

my_analysis.ApplyAndWaitForCompletion()

my_analysis.GetResults()

 

You’ll also need a call to LoadFrom() if ModifySettings() was used (see API syntax example file 11 for a full demonstration). As for the object returned by the GetResults() method, an analysis function may have one or more of the following types of results available:

 

 

Using GetResults() will return an object with all of the possible Public Member Functions listed, but only those that correspond to your analysis will be populated. If you’re unsure what data types are available for your analysis and want to know before starting, check out the Knowledgebase article “Generating a list of output data types for each analysis in the ZOS-API”.

For analysis types which support text output, the GetTextFile() command may also be utilized so that the user can save and manually parse through their data.

More information on the API can be found in the Knowledgebase article “ZOS-API.NET: An Overview”.

Posted Wed, 24 Jul 2019 11:03:34 GMT by Sandrine Auriol Optical Engineer

The ZOS-API Syntax Help contains sample files that demonstrate how to perform analysis of a system using the ZOS-API.

For example, the sample codes 11 and 15 modify the settings of an analysis using IAS_ModifySettings.

  • 11 modifies the settings of the Universal Plot.
  • 15 modifies the settings of the Shaded Model.

The sample codes 10 and 24 modify the settings of a fully implemented analysis.

  • 10 and 24 modify the settings of the Detector Viewer.

For more information about the sample codes, see the “Sample code for ZOS-API users” article.

You must be signed in to post in this forum.


Sign up for our blog
Don’t miss out on key insights, best
practices, and news from Zemax.





 
     



Copyright © 2019 ZEMAX LLC. All rights reserved.