visisipy.opticstudio.analysis.raytrace#

Ray trace analysis for OpticStudio.

Functions#

raytrace() → tuple[pandas.DataFrame, ...)

Perform a ray trace analysis using the given parameters.

Module Contents#

visisipy.opticstudio.analysis.raytrace.raytrace(backend: visisipy.opticstudio.backend.OpticStudioBackend, coordinates: collections.abc.Sequence[visisipy.types.FieldCoordinate] | None = None, wavelengths: collections.abc.Sequence[float] | None = None, field_type: visisipy.types.FieldType = 'angle', pupil: tuple[float, float] = (0, 0)) tuple[pandas.DataFrame, list[zospy.analyses.raysandspots.single_ray_trace.SingleRayTraceResult]]#

Perform a ray trace analysis using the given parameters.

The ray trace is performed for each wavelength and field in the system, using the Single Ray Trace analysis in OpticStudio.

The analysis returns a Dataframe with the following columns:

  • field: The field coordinates for the ray trace.

  • wavelength: The wavelength used in the ray trace.

  • surface: The surface number in the system.

  • comment: The comment for the surface.

  • x: The X-coordinate of the ray trace.

  • y: The Y-coordinate of the ray trace.

  • z: The Z-coordinate of the ray trace.

Parameters:
backendOpticStudioBackend

Reference to the OpticStudio backend.

coordinatesSequence[tuple[float, float]], optional

A sequence of tuples representing the coordinates for the ray trace. If field_type is “angle”, the coordinates should be the angles along the (X, Y) axes in degrees. If field_type is “object_height”, the coordinates should be the object heights along the (X, Y) axes in mm. Defaults to None, which uses the fields defined in the backend.

wavelengthsSequence[float], optional

A sequence of wavelengths to be used in the ray trace. Defaults to None, which uses the wavelengths defined in the backend.

field_typeLiteral[“angle”, “object_height”], optional

The type of field to be used in the ray trace. Can be either “angle” or “object_height”. Defaults to “angle”.

pupiltuple[float, float], optional

A tuple representing the pupil coordinates for the ray trace. Defaults to (0, 0).

Returns:
DataFrame

A pandas DataFrame containing the results of the ray trace analysis.

list[SingleRayTraceResult]

A list of the raw analysis results from the backend for each field and wavelength combination.

Raises:
ValueError

If the pupil coordinates are not between -1 and 1, or if the ray trace analysis fails for any field and wavelength combination.