Skip to main content
How do I change settings for an analysis feature by using ZOS-API?


For example, how to change settings for the following analysis windows: 





We can first check if the certain analysis has setting interface by using the HasAnalysisSpecificSettings property:

my_analysis.HasAnalysisSpecificSettings



If settings are available, then settings can be configured directly. 





Or we can search from OpticStudio helpfile to see if the analysis supported by ModifySettings methods, since the use of the method is similar to ZPL keywords, so we can check supported analysis and type code from the following chapter in helpfile:  


The Programming Tab > About the ZPL > KEYWORDS (about the zpl) > MODIFYSETTINGS (keywords)


If settings are supported by MODIFYSETTINGS, the settings can be configured by using ModifySettings method. 


 


If none of the above situations apply for the application, a workaround is provided. 





After compare the three analysis features, we found that: 



























































HasAnalysisSpecificSettings supported by ModifySettings? type code for Modifysettings
Spot Diagram               True         Yes















SPT_RAYS





Extended Diffraction Image Analysis               False         Yes















EXD_FILESIZE





Partially Coherent Image Analysis               False         Yes NA





The following code snippet is written with Python


For Spot Diagram



newSpot = TheApplication.PrimarySystem.Analyses.New_StandardSpot()

print("Spot has analysis specific settings? ", newSpot.HasAnalysisSpecificSettings) # True; no ModifySettings

newSettings = newSpot.GetSettings()

spotSet = CastTo(newSettings, "IAS_Spot") # Cast to IAS_Spot interface; enables access to Spot Diagram properties

spotSet.RayDensity = 15

newSpot.ApplyAndWaitForCompletion()


or 



TheSystem=TheApplication.PrimarySystem

newSpot=TheSystem.Analyses.New_StandardSpot()

print(newSpot.HasAnalysisSpecificSettings)

newSettings=newSpot.GetSettings()

import os

cfgFile=os.environ.get('Temp')+'\\spt.cfg'

newSettings.SaveTo(cfgFile)

newSettings.ModifySettings(cfgFile,'SPT_RAYS',15)

newSettings.LoadFrom(cfgFile)

newSpot.ApplyAndWaitForCompletion()






For Extended Diffraction Image Analysis :



TheSystem=TheApplication.PrimarySystem

newEDIA=TheSystem.Analyses.New_Analysis(constants.AnalysisIDM_ExtendedDiffractionImageAnalysis)

print(newEDIA.HasAnalysisSpecificSettings)

newSettings=newEDIA.GetSettings()

import os

cfgFile=os.environ.get('Temp')+'\\spt.cfg'

newSettings.SaveTo(cfgFile)

newSettings.ModifySettings(cfgFile,'EXD_FILESIZE',0.855)

newSettings.LoadFrom(cfgFile)

newEDIA.ApplyAndWaitForCompletion()



For Partially Coherent Image Analysis:



TheSystem=TheApplication.PrimarySystem

newPCIA=TheSystem.Analyses.New_Analysis(constants.AnalysisIDM_PartiallyCoherentImageAnalysis)

print(newPCIA.HasAnalysisSpecificSettings)



The workaround for Partially Coherent Image Analysis would be:





  1. Open a blank file- LENS.ZMX, open Partially coherent image analysis window and Merit function editor






  • Uncheck Auto apply


  • Configure the analysis window with settings you will use later


  • Add ZPLM(mac#21) into MFE. Click update button in merit function editor (ZPL file being attached, you may change the highlighted part to fit your situation )








  • It will ask you to input the filename, which will be the saved CFG filename








  • These steps can be repeated until setting combinations you are going to use are saved.




2.Once finished, these setting files can be used in other lens files





Please note that ZPLM is not commonly used as this way (Keywords INPUT is not friendly for optimization usage).




Reply