zospy.analyses.base.Analysis#
- class zospy.analyses.base.Analysis#
Bases:
objectOpticStudio analysis.
This class wraps ZOSAPI analysis objects to provide direct access to its settings and results. All properties and methods of the ZOSAPI analysis object are available through this class.
- Attributes:
ResultsAnalysis results.
SettingsAnalysis-specific settings.
header_dataObtain the header data from an OpticStudio analysis.
messagesObtain the messages from the analysis.
metadataObtain the metadata from the analysis.
Methods
Get the field value from the analysis settings.
get_text_output(txtoutfile, encoding)Get the text output of the analysis.
Get the wavelength value from the analysis settings.
set_field(value)Set the field value in the analysis settings.
set_surface(value)Set the surface value in the analysis settings.
set_wavelength(value)Set the wavelength value in the analysis settings.
- property Results: ZOSAPI.Analysis.Data.IAR_#
Analysis results.
- property Settings: ZOSAPI.Analysis.Settings.IAS_#
Analysis-specific settings.
- __init__(analysis: ZOSAPI.Analysis.IA_)#
Zemax OpticStudio Analysis with full access to its Settings and Results attributes.
- Parameters:
- analysisZOSAPI.Analysis.IA_
analysis object
- get_field() int | Literal['All']#
Get the field value from the analysis settings.
- Returns:
- int | Literal[“All”]
Either the field number, or ‘All’ if field was set to ‘All’.
- get_text_output(txtoutfile: str, encoding: str)#
Get the text output of the analysis.
- Parameters:
- txtoutfilestr
Path to the text output file. The file will be created if it does not exist.
- encodingstr
The encoding of the text file. The encoding used by OpticStudio can be obtained with zospy.ZOS.get_txtfile_encoding.
- get_wavelength() int | Literal['All']#
Get the wavelength value from the analysis settings.
- Returns:
- int | Literal[“All”]
Either the wavelength number, or ‘All’ if wavelength was set to ‘All’.
- property header_data: list[str]#
Obtain the header data from an OpticStudio analysis.
- Returns:
- list
The header data.
- property messages: list[AnalysisMessage]#
Obtain the messages from the analysis.
- Returns:
- list[AnalysisMessage]
A list of messages. Each item is a NamedTuple with names (ErrorCode, Message).
- property metadata: AnalysisMetadata#
Obtain the metadata from the analysis.
- Returns:
- AnalysisMetadata
A named tuple containing the MetaData including ‘DateTime’, ‘FeatureDescription’, ‘LensFile’ and ‘LensTitle’.
- set_field(value: int | Literal['All'])#
Set the field value in the analysis settings.
- Parameters:
- valueint | Literal[“All”]
The value to which the field should be set. Either int or str. Accepts only ‘All’ as string.
- Returns:
- None
- Raises:
- ValueError
When ‘value’ is not integer or string. When it is a string, it also raises an error when the string does not equal ‘All’. When ‘value’ is not accepted by the analysis as field specification.
Warning
The ZOS-API handles invalid integer values without warning about this:
If selecting all fields is not possible, a value of 0 will instead select the first field;
If the value is greater than the number of fields, the last field will be selected.
- set_surface(value: int | Literal['Image', 'Objective'])#
Set the surface value in the analysis settings.
- Parameters:
- valueint | Literal[“Image”, “Objective”]
The value to which the surface should be set. Either int or str. Accepts only ‘Image’ or ‘Objective’ as string.
- Returns:
- None
- Raises:
- ValueError
When ‘value’ is not integer or string. When it is a string, it also raises an error when the string does not equal ‘Image’ or ‘Objective’. When ‘value’ is not accepted by the analysis as surface specification.
Warning
The ZOS-API handles invalid integer values without warning about this:
If the supplied value is 0, OpticStudio will base it selection based on the analysis. In some, it will select surface 0. In others, it will select a special surface (e.g. ‘Image’). If neither is available, it selects the first available surface;
If the value is greater than the number of surfaces, the last surface will be selected.
- set_wavelength(value: int | Literal['All'])#
Set the wavelength value in the analysis settings.
- Parameters:
- valueint | Literal[“All”]
The value to which the wavelength should be set. Either int or str. Accepts only ‘All’ as string.
- Returns:
- None
- Raises:
- ValueError
When ‘value’ is not integer or string. When it is a string, it also raises an error when the string does not equal ‘All’. When ‘value’ is not accepted by the analysis as wavelength specification.
Warning
The ZOS-API handles invalid integer values without warning about this:
If selecting all wavelengths is not possible, a value of 0 will instead select the first wavelength;
If the value is greater than the number of wavelengths, the last wavelength will be selected.