zospy.analyses.raysandspots.single_ray_trace#
- zospy.analyses.raysandspots.single_ray_trace(oss: OpticStudioSystem, hx: float = 0, hy: float = 0, px: float = 0, py: float = 1, wavelength: str | int = 1, field: str | int = 0, raytrace_type: constants.Analysis.Settings.Aberrations.RayTraceType | str = 'DirectionCosines', global_coordinates: bool = False, oncomplete: OnComplete | str = OnComplete.Close, txtoutfile: str | None = None) AnalysisResult #
Wrapper around the OpticStudio Single Ray Trace Analysis.
Due to limitations in the ZOS-API, the output is obtained by writing the OpticStudio results to a file and subsequently reading in this file
- Parameters:
- oss: zospy.zpcore.OpticStudioSystem
A ZOSPy OpticStudioSystem instance. Should be sequential.
- hx: float
Normalized X Field Coord. Defaults to 0.
- hy: float
Normalized Y Field Coord. Defaults to 0.
- px: float
Normalized X Pupil Coord. Defaults to 0.
- py: float
Normalized Y Pupil Coord. Defaults to 1.
- raytrace_type: zospy.api.constants.Analysis.Settings.Aberrations.RayTraceType
The Ray Trace type (e.g. ‘DirectionCosines’) that is calculated. Defaults to ‘DirectionCosines’.
- wavelength: int
The wavelength number that is to be used. Must be an integer specifying the wavelength number. Defaults to 1.
- field: int
The field number that is to be used. Must be an integer specifying the field number. “Arbitrary” is 0. Defaults to 0.
- global_coordinates: bool
Defines if global coordinates are used. Defaults to False.
- oncomplete: OnComplete | str
Defines behaviour upon completion of the analysis. Should be one of [‘Close’, ‘Release’, ‘Sustain’]. If ‘Close’, the analysis will be closed after completion. If ‘Release’, the analysis will remain open in OpticStudio, but the link with python will be destroyed. If ‘Sustain’ the analysis will be kept open in OpticStudio and the link with python will be sustained. To enable interaction when oncomplete == ‘Sustain’, the OpticStudio Analysis instance will be available in the returned AnalysisResult through AnalysisResult.Analysis. Defaults to ‘Close’.
- txtoutfile: str | None
The textfile to which the OpticStudio output is saved. If None, a temporary file will be created and deleted. If string, it should be a full system path with ‘.txt’ as extension, after which the file will be saved in that location. Defaults to None.
- Returns:
- AnalysisResult
A Single Ray Trace result. Next to the standard data, the raw text return obtained from the analysis will be present under ‘RawTextData’, and the txtoutfile under ‘TxtOutFile’.