Analyze

First-order values and the Single Ray Trace table.

First order

Analyze results that are not their own window.

get_first_order(ctx: Context) → dict[str, float | str | None]

Return first-order values for the lens open in the OpticStudio window.

The system is updated before the values are read. working_f_number is on axis at the primary wavelength. A number is None when OpticStudio does not return a finite value.

Returns:

  • effective_focal_length – Effective focal length, in lens units.

  • entrance_pupil_diameter – Entrance pupil diameter, in lens units.

  • image_space_f_number – Paraxial image-space F-number.

  • working_f_number – Working F-number on axis at the primary wavelength.

  • total_length – Thickness from surface 1 to the image surface, in lens units.

  • status – Text reported while updating the system. Empty when the update reports nothing.

Return type:

dict[str, float | str | None]

Single Ray Trace

Single Ray Trace tool.

get_single_ray_trace(ctx: Context, wavelength: int = 1, hx: float = 0, hy: float = 0, px: float = 0, py: float = 0, trace_type: 'DirectionCosines' | 'TangentAngle' | 'YmUmYcUc' = 'DirectionCosines') → dict[str, object]

Return the Single Ray Trace table for one ray in the open lens.

hx and hy are the normalized field coordinates. px and py are the normalized pupil coordinates. trace_type selects Direction Cosines, Tangential Angle, or Ym, Um, Yc, Uc.

Parameters:
  • wavelength – 1-based wavelength number.

  • hx – Normalized field coordinate X.

  • hy – Normalized field coordinate Y.

  • px – Normalized pupil coordinate X.

  • py – Normalized pupil coordinate Y.

  • trace_type – DirectionCosines, TangentAngle, or YmUmYcUc.

Returns:

  • wavelength – Wavelength number used for the ray.

  • hx – Normalized field coordinate X.

  • hy – Normalized field coordinate Y.

  • px – Normalized pupil coordinate X.

  • py – Normalized pupil coordinate Y.

  • type – Table format.

  • columns – Headings of the Single Ray Trace table, after the surface column.

  • surfaces – One entry per surface, in the order shown in the window.

  • surfaces[].surface – Surface label from the table, such as OBJ, a surface number, or IMA.

  • surfaces[].values – One number per heading. None where the table has no finite number.

  • message – Error line under the table. Empty when the table has none.

Return type:

dict[str, object]

Raises:

ValueError – The ray settings or the table cannot be used.