zospy.analyses.systemviewers.cross_section

Contents

zospy.analyses.systemviewers.cross_section#

zospy.analyses.systemviewers.cross_section(oss: OpticStudioSystem, start_surface: int = 1, end_surface: int = -1, number_of_rays: int = 3, y_stretch: float = 1.0, fletch_rays: bool = False, wavelength: int | str = 'all', field: int | str = 'all', color_rays_by: constants.Tools.Layouts.ColorRaysByCrossSectionOptions | str = 'Fields', upper_pupil: float = 1, lower_pupil: float = -1, delete_vignetted: bool = False, marginal_and_chief_only: bool = False, image_size: tuple[int, int] = (800, 600), line_thickness: constants.Tools.Layouts.LineThicknessOptions | str = 'Standard', imgoutfile: PathLike | str | None = None, oncomplete: OnComplete | str = OnComplete.Release) AnalysisResult#

Wrapper around the OpticStudio Cross-Section viewer.

Parameters:
oss: zospy.zpcore.OpticStudioSystem

A ZOSPy OpticStudioSystem instance. Should be sequential.

start_surfaceint, optional

The starting surface index for the cross-section analysis. Defaults to 1.

end_surfaceint, optional

The ending surface index for the cross-section analysis. A value of -1 indicates the last surface. Defaults to -1.

number_of_raysint, optional

The number of rays to be used in the analysis. Defaults to 3.

y_stretchfloat, optional

The stretch factor in the Y-axis for the analysis visualization. Defaults to 1.0.

fletch_raysbool, optional

Flag indicating whether to fletch rays. Defaults to False.

wavelengthint | str, optional

The wavelength index to be used. Can be an integer or “all” for all wavelengths. Defaults to “all”.

fieldint | str, optional

The field index to be used. Can be an integer or “all” for all fields. Defaults to “all”.

color_rays_byconstants.Tools.Layouts.ColorRaysByCrossSectionOptions | str, optional

The criterion for coloring rays in the analysis. Defaults to “Fields”.

upper_pupilfloat, optional

The upper pupil limit for the analysis. Defaults to 1.

lower_pupilfloat, optional

The lower pupil limit for the analysis. Defaults to -1.

delete_vignettedbool, optional

Flag indicating whether to delete vignetted rays. Defaults to False.

marginal_and_chief_onlybool, optional

Flag indicating whether to include only marginal and chief rays in the analysis. Defaults to False.

image_sizetuple[int, int], optional

The size of the output image in pixels (width, height). Defaults to (800, 600).

line_thicknessconstants.Tools.Layouts.LineThicknessOptions | str, optional

The thickness of the lines in the output visualization. Defaults to “Standard”.

imgoutfilePathLike | str | None, optional

The path to save the output image file. If None, no image is saved. Defaults to None.

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 ‘Release’.

Returns:
AnalysisResult

A Cross-Section analysis result. If imgoutfile is None, the result will contain the image data as a numpy array. If imgoutfile is not None, the results Data attribute will be empty.