Setup

System Explorer, the Lens Data Editor, and the Multi-Configuration Editor. A write accepts the same fields the matching read returns.

System Explorer

System Explorer tools.

get_system_settings(ctx: Context, section: 'units' | 'aperture' | 'fields' | 'wavelengths' | 'environment' | 'polarization' | 'ray_aiming') → dict[str, object] | list[dict[str, object]]

Return one group of System Explorer settings.

Parameters:

section – units, aperture, fields, wavelengths, environment, polarization, or ray_aiming.

Returns:

The selected group. wavelengths is a list of wavelengths in micrometers, including when there is one wavelength. The other groups are dictionaries.

units

  • lens_units – Millimeters, Centimeters, Inches, or Meters.

  • source_unit_prefix – Prefix applied to source units, such as None or Milli.

  • source_units – Watts, Lumens, or Joules.

  • analysis_unit_prefix – Prefix applied to analysis units.

  • analysis_units – Irradiance unit, such as WattsPerMMSq.

  • afocal_mode_units – Angular unit used when afocal image space is enabled, such as Milliradians or Degrees.

  • mtf_units – CyclesPerMillimeter or CyclesPerMilliradian.

aperture

  • aperture_type – EntrancePupilDiameter, ImageSpaceFNum, ObjectSpaceNA, FloatByStopSize, ParaxialWorkingFNum, or ObjectConeAngle.

  • aperture_value – EntrancePupilDiameter is a diameter in lens units. ImageSpaceFNum and ParaxialWorkingFNum are dimensionless. ObjectSpaceNA is dimensionless. ObjectConeAngle is in degrees. FloatByStopSize takes the aperture from the stop surface semi-diameter.

  • apodization_type – Uniform, Gaussian, or CosineCubed.

  • apodization_factor – Apodization factor. Meaningful when apodization_factor_is_used is true.

  • apodization_factor_is_used – True when the apodization factor is used. This member is read-only.

  • semi_diameter_margin – Length added to computed semi-diameters, in lens units.

  • semi_diameter_margin_percent – Percent added to computed semi-diameters.

  • global_coordinate_reference_surface – Surface number used as the global coordinate reference. 0 is the object surface.

  • telecentric_object_space – True when object-space telecentricity is enabled.

  • afocal_image_space – True when afocal image space is enabled.

  • iterate_solves_when_updating – True when solves are iterated while the system updates.

  • fast_semi_diameters – True when fast semi-diameter computation is enabled.

  • check_grin_apertures – True when GRIN apertures are checked.

fields

  • type – Angle, ObjectHeight, ParaxialImageHeight, RealImageHeight, or TheodoliteAngle.

  • normalization – Radial or Rectangular.

  • points – One entry per field. x and y are degrees for Angle and TheodoliteAngle, and lens units for the height types.

  • points[].number – 1-based field number.

  • points[].active – True when the field is active.

  • points[].x – X field coordinate.

  • points[].y – Y field coordinate.

  • points[].weight – Relative field weight.

  • points[].vdx – Vignetting decenter in X, as a fraction of the pupil.

  • points[].vdy – Vignetting decenter in Y, as a fraction of the pupil.

  • points[].vcx – Vignetting compression in X, as a fraction of the pupil.

  • points[].vcy – Vignetting compression in Y, as a fraction of the pupil.

  • points[].van – Vignetting angle, in degrees.

  • points[].tan – Tangential angle, in degrees.

  • points[].comment – Field comment. Empty when the field has no comment.

  • points[].x_solve – Solve type for X, such as Fixed.

  • points[].y_solve – Solve type for Y, such as Fixed.

  • points[].ignore – True when the field is ignored.

wavelengths

  • number – 1-based wavelength number.

  • active – True when the wavelength is active.

  • wavelength – Wavelength in micrometers.

  • weight – Relative wavelength weight.

  • primary – True for the primary wavelength.

environment

  • temperature – Temperature in degrees Celsius.

  • pressure – Pressure in atmospheres.

  • adjust_index_to_environment – True when refractive indices are adjusted to the system temperature and pressure.

polarization

  • method – XAxisMethod, YAxisMethod, or ZAxisMethod.

  • unpolarized – True when the input beam is unpolarized.

  • jx – Jones vector X component.

  • jy – Jones vector Y component.

  • x_phase – X phase, in degrees.

  • y_phase – Y phase, in degrees.

  • convert_thin_film_phase_to_ray_equivalent – True when thin-film phase is converted to a ray-equivalent angle.

ray_aiming

  • setting – Off, Paraxial, or Real.

  • method – Heuristic or Optimize. Used when setting is Real.

  • use_ray_aiming_cache – True when the ray-aiming cache is used.

  • use_robust_ray_aiming – True when robust ray aiming is used.

  • scale_pupil_shift_factors_by_field – True when pupil-shift factors are scaled by field.

  • automatically_calculate_pupil_shifts – True when pupil shifts are calculated automatically.

  • use_enhanced_ray_aiming – True when enhanced ray aiming is used.

  • use_advanced_convergence – True when advanced convergence is used.

  • use_fallback_search_during_cache_setup – True when cache setup falls back to a search.

  • pupil_shift_x – Pupil shift factor in X.

  • pupil_shift_y – Pupil shift factor in Y.

  • pupil_shift_z – Pupil shift factor in Z.

  • pupil_compress_x – Pupil compression factor in X.

  • pupil_compress_y – Pupil compression factor in Y.

  • cache_setup_steps – Number of steps used to build the ray-aiming cache.

Return type:

dict[str, object] | list[dict[str, object]]

Raises:

ValueError – section is not a setting group.

set_system_rows(ctx: Context, section: 'fields' | 'wavelengths', action: 'change' | 'add' | 'remove' | 'make_primary', number: int | None = None, values: dict[str, str | float | bool | int] | None = None) → list[dict[str, object]]

Change, add, or remove one field point or wavelength and return the rows.

Parameters:
  • section – fields or wavelengths.

  • action – change, add, remove, or make_primary.

  • number – 1-based row. Required for change, remove, and make_primary. add appends a row.

  • values –

    Keys to write. The writable fields are the same as those of one row returned by get_system_settings(). Omit read-only fields, including primary. Omit values for remove and make_primary.

    fields

    add requires x, y, and weight. x and y are degrees for Angle and TheodoliteAngle, and lens units for the height types.

    • x – X field coordinate.

    • y – Y field coordinate.

    • weight – Relative field weight.

    • vdx – Vignetting decenter in X, as a fraction of the pupil.

    • vdy – Vignetting decenter in Y, as a fraction of the pupil.

    • vcx – Vignetting compression in X, as a fraction of the pupil.

    • vcy – Vignetting compression in Y, as a fraction of the pupil.

    • van – Vignetting angle, in degrees.

    • tan – Tangential angle, in degrees.

    • comment – Field comment.

    • ignore – True when the field is ignored.

    number, active, x_solve, and y_solve are read-only.

    wavelengths

    add requires wavelength and weight. wavelength is in micrometers.

    • wavelength – Wavelength in micrometers.

    • weight – Relative wavelength weight.

    number, active, and primary are read-only. make_primary selects the primary wavelength.

Returns:

The rows after the change, including when there is one row. For fields, these are the field points.

Return type:

list[dict[str, object]]

Raises:

ValueError – section has no row list, or the action, number, or values cannot be applied.

set_system_settings(ctx: Context, section: 'units' | 'aperture' | 'fields' | 'wavelengths' | 'environment' | 'polarization' | 'ray_aiming', values: dict[str, str | float | bool | int]) → dict[str, object] | list[dict[str, object]]

Change keys in one System Explorer setting group and return the group.

Parameters:
  • section – units, aperture, fields, wavelengths, environment, polarization, or ray_aiming.

  • values – Keys to change. The fields are the same as those returned by get_system_settings() for section. apodization_factor_is_used is read-only. points and wavelengths are lists of rows; change them with set_system_rows().

Returns:

The setting group after the change.

Return type:

dict[str, object] | list[dict[str, object]]

Raises:

ValueError – section is unknown, values is empty, or a key cannot be changed.

Lens Data Editor

Lens Data Editor tools.

get_lens_data(ctx: Context, surface: int | None = None) → dict[str, object]

Return the Lens Data Editor surfaces for the lens open in the OpticStudio window.

Pass surface to read one surface. Omit it to read every surface.

Parameters:

surface – Surface number. 0 is the object surface. None reads every surface.

Returns:

Without surface, surfaces. With surface, that surface.

  • surfaces – One entry per surface, starting with the object surface at surface 0. Present when surface is omitted.

  • surface_number – Surface number. 0 is the object surface.

  • is_stop – True when the surface is the stop.

  • type – Surface type, such as Standard or EvenAspheric.

  • parameters – Parameter columns used by type. Empty when the type uses none.

  • parameters[].column – Column name, such as Par1.

  • parameters[].header – Column title from the Lens Data Editor. This member is read-only.

  • parameters[].value – Cell value. A number, or a string when the cell stores text.

  • parameters[].solve – Solve on that parameter cell. The same object as radius_solve.

  • comment – Surface comment. Empty when the surface has no comment.

  • radius – Radius of curvature, in lens units. Infinity when the radius is infinite. A radius of 0 is returned as Infinity.

  • radius_solve – Solve on the radius cell. thickness_solve, material_solve, coating_solve, semi_diameter_solve, chip_zone_solve, mechanical_semi_diameter_solve, conic_solve, and tce_solve use the same object.

  • radius_solve.type – Variable, Fixed, SurfacePickup, FNumber, Position, ConfigPickup, or ThermalPickup. A type this cell does not support is rejected.

  • radius_solve.f_number – F-number. Present when type is FNumber.

  • radius_solve.from_surface – Surface the position is measured from. Present when type is Position. 0 is the object surface.

  • radius_solve.length – Distance from from_surface, in lens units.

  • radius_solve.surface – Surface a pickup reads. Present when type is SurfacePickup.

  • radius_solve.scale – Pickup scale. Present when that pickup uses a scale.

  • radius_solve.offset – Pickup offset. Present when that pickup uses an offset.

  • radius_solve.column – Lens Data column a surface pickup reads, such as Thickness or Par1. Omitted when the pickup uses the same column.

  • radius_solve.operand – Operand a configuration pickup reads. Present when type is ConfigPickup.

  • radius_solve.configuration – Configuration a pickup reads. Present for ConfigPickup and ThermalPickup.

  • thickness – Thickness to the next surface, in lens units. Infinity when the thickness is infinite. A thickness of 0 is zero. Omitted on the image surface, along with thickness_solve.

  • material – Glass name. Empty when the surface is air.

  • coating – Coating name. Empty when the surface has no coating.

  • semi_diameter – Clear semi-diameter, in lens units.

  • chip_zone – Chip zone, in lens units.

  • mechanical_semi_diameter – Mechanical semi-diameter, in lens units.

  • conic – Conic constant.

  • tce – Thermal coefficient of expansion stored for the surface, in 1e-6/K. Omitted, along with tce_solve, when the surface does not use the TCE column. A catalog glass takes thermal expansion from the glass catalog.

Return type:

dict[str, object]

Raises:

ValueError – surface is outside the editor.

set_lens_rows(ctx: Context, action: 'change' | 'add' | 'remove', number: int, values: dict[str, str | float | bool | int | dict[str, str | float | int | dict[str, str | float | int | dict[str, str | float | int]]]] | None = None) → dict[str, object]

Change, insert, or remove one Lens Data Editor surface and return the editor.

Parameters:
  • action – change, add, or remove.

  • number – Surface number. 0 is the object surface. add inserts at this number, and following surfaces move up. The inserted surface is Standard until values sets type.

  • values – Keys to write. The fields are the same as those of one surface returned by get_lens_data(). Omit values to insert a default surface or to remove a surface. surface_number is read-only. radius and thickness accept Infinity for an infinite length. A radius of 0 is returned as Infinity. A thickness of 0 is zero. thickness and thickness_solve are rejected on the image surface. tce and tce_solve are rejected when the surface does not use the TCE column. type is a surface type name, such as EvenAspheric. parameters maps column names such as Par1 to a number, a string, or an object with value and solve. header is read-only. type is applied before parameters. radius_solve and the other cell solves set that cell’s solve; Fixed clears it. Omit column on a surface pickup to use the same column. Setting is_stop to true makes that surface the stop. The object and image surfaces cannot be removed.

Returns:

The surfaces after the change.

Return type:

dict[str, object]

Raises:

ValueError – The action, number, or values cannot be applied.

Multi-Configuration Editor

Multi-Configuration Editor tools.

get_multi_configuration(ctx: Context, operand: int | None = None) → dict[str, object]

Return the Multi-Configuration Editor for the lens open in the OpticStudio window.

Pass operand to read one operand. Omit it to read the current configuration, every configuration column, and every operand.

Parameters:

operand – Operand number. The first operand is 1. None reads the whole editor.

Returns:

Without operand, current, configurations, and operands. With operand, that operand.

  • current – Configuration shown in the Lens Data Editor. Present when operand is omitted.

  • configurations – One entry per configuration column, in editor order. Present when operand is omitted.

  • configurations[].number – 1-based configuration number.

  • operands – One entry per operand, in editor order. Present when operand is omitted.

  • number – Operand number. The first operand is 1. This member is read-only.

  • active – True when the operand is active. This member is read-only.

  • type – Operand type, such as THIC or GLSS.

  • parameters – Parameter columns used by type. Empty when the type uses none.

  • parameters[].column – Param1, Param2, or Param3.

  • parameters[].value – Integer stored in that column, such as a surface number.

  • cells – One entry per configuration column.

  • cells[].configuration – Configuration number.

  • cells[].value – Cell value. A number, or a string when the cell stores text, such as a glass name.

  • cells[].solve – Solve on that configuration cell. The same object as radius_solve returned by get_lens_data().

Return type:

dict[str, object]

Raises:

ValueError – operand is outside the editor.

set_multi_configuration_rows(ctx: Context, section: 'operand' | 'configuration', action: 'change' | 'add' | 'remove' | 'make_current', number: int, values: dict[str, str | float | bool | int | dict[str, str | float | int | dict[str, str | float | int | dict[str, str | float | int]]]] | None = None) → dict[str, object]

Change one Multi-Configuration Editor operand or configuration and return the editor.

Parameters:
  • section – operand or configuration.

  • action – change, add, remove, or make_current. make_current selects the configuration shown in the Lens Data Editor.

  • number – 1-based operand or configuration number. add inserts at this number, and following rows or columns move up. Pass number one past the last entry to append.

  • values – Keys to write. For an operand, the fields are the same as those of one operand returned by get_multi_configuration(). Omit values to insert a default operand or configuration, or to remove one. number and active are read-only. type is an operand type name, such as THIC. parameters maps Param1, Param2, or Param3 to an integer. cells maps a configuration number, such as "1", to a number, a string, or an object with value and solve. type is applied before parameters and cells. A configuration has no fields to change. add for a configuration accepts copy: true copies the current configuration’s cells. The last configuration cannot be removed.

Returns:

current, configurations, and operands after the change.

Return type:

dict[str, object]

Raises:

ValueError – The section, action, number, or values cannot be applied.