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, orray_aiming.- Returns:
The selected group.
wavelengthsis 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
NoneorMilli.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
MilliradiansorDegrees.mtf_units –
CyclesPerMillimeterorCyclesPerMilliradian.
aperture
aperture_type –
EntrancePupilDiameter,ImageSpaceFNum,ObjectSpaceNA,FloatByStopSize,ParaxialWorkingFNum, orObjectConeAngle.aperture_value –
EntrancePupilDiameteris a diameter in lens units.ImageSpaceFNumandParaxialWorkingFNumare dimensionless.ObjectSpaceNAis dimensionless.ObjectConeAngleis in degrees.FloatByStopSizetakes the aperture from the stop surface semi-diameter.apodization_type –
Uniform,Gaussian, orCosineCubed.apodization_factor – Apodization factor. Meaningful when
apodization_factor_is_usedis 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, orTheodoliteAngle.normalization –
RadialorRectangular.points – One entry per field.
xandyare degrees forAngleandTheodoliteAngle, 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, orZAxisMethod.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, orReal.method –
HeuristicorOptimize. Used whensettingisReal.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:
- Raises:
ValueError –
sectionis 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 –
fieldsorwavelengths.action –
change,add,remove, ormake_primary.number – 1-based row. Required for
change,remove, andmake_primary.addappends 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, includingprimary. Omitvaluesforremoveandmake_primary.fields
addrequiresx,y, andweight.xandyare degrees forAngleandTheodoliteAngle, 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, andy_solveare read-only.wavelengths
addrequireswavelengthandweight.wavelengthis in micrometers.wavelength – Wavelength in micrometers.
weight – Relative wavelength weight.
number,active, andprimaryare read-only.make_primaryselects the primary wavelength.
- Returns:
The rows after the change, including when there is one row. For
fields, these are the field points.- Return type:
- Raises:
ValueError –
sectionhas 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, orray_aiming.values – Keys to change. The fields are the same as those returned by
get_system_settings()forsection.apodization_factor_is_usedis read-only.pointsandwavelengthsare lists of rows; change them withset_system_rows().
- Returns:
The setting group after the change.
- Return type:
- Raises:
ValueError –
sectionis unknown,valuesis 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
surfaceto read one surface. Omit it to read every surface.- Parameters:
surface – Surface number. 0 is the object surface.
Nonereads every surface.- Returns:
Without
surface,surfaces. Withsurface, that surface.surfaces – One entry per surface, starting with the object surface at surface 0. Present when
surfaceis omitted.surface_number – Surface number. 0 is the object surface.
is_stop – True when the surface is the stop.
type – Surface type, such as
StandardorEvenAspheric.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.
Infinitywhen the radius is infinite. A radius of 0 is returned asInfinity.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, andtce_solveuse the same object.radius_solve.type –
Variable,Fixed,SurfacePickup,FNumber,Position,ConfigPickup, orThermalPickup. A type this cell does not support is rejected.radius_solve.f_number – F-number. Present when
typeisFNumber.radius_solve.from_surface – Surface the position is measured from. Present when
typeisPosition. 0 is the object surface.radius_solve.length – Distance from
from_surface, in lens units.radius_solve.surface – Surface a pickup reads. Present when
typeisSurfacePickup.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
ThicknessorPar1. Omitted when the pickup uses the same column.radius_solve.operand – Operand a configuration pickup reads. Present when
typeisConfigPickup.radius_solve.configuration – Configuration a pickup reads. Present for
ConfigPickupandThermalPickup.thickness – Thickness to the next surface, in lens units.
Infinitywhen the thickness is infinite. A thickness of 0 is zero. Omitted on the image surface, along withthickness_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:
- Raises:
ValueError –
surfaceis 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, orremove.number – Surface number. 0 is the object surface.
addinserts at this number, and following surfaces move up. The inserted surface isStandarduntilvaluessetstype.values – Keys to write. The fields are the same as those of one surface returned by
get_lens_data(). Omitvaluesto insert a default surface or to remove a surface.surface_numberis read-only.radiusandthicknessacceptInfinityfor an infinite length. A radius of 0 is returned asInfinity. A thickness of 0 is zero.thicknessandthickness_solveare rejected on the image surface.tceandtce_solveare rejected when the surface does not use the TCE column.typeis a surface type name, such asEvenAspheric.parametersmaps column names such asPar1to a number, a string, or an object withvalueandsolve.headeris read-only.typeis applied beforeparameters.radius_solveand the other cell solves set that cell’s solve;Fixedclears it. Omitcolumnon a surface pickup to use the same column. Settingis_stopto true makes that surface the stop. The object and image surfaces cannot be removed.
- Returns:
The surfaces after the change.
- Return type:
- 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
operandto 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.
Nonereads the whole editor.- Returns:
Without
operand,current,configurations, andoperands. Withoperand, that operand.current – Configuration shown in the Lens Data Editor. Present when
operandis omitted.configurations – One entry per configuration column, in editor order. Present when
operandis omitted.configurations[].number – 1-based configuration number.
operands – One entry per operand, in editor order. Present when
operandis 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
THICorGLSS.parameters – Parameter columns used by
type. Empty when the type uses none.parameters[].column –
Param1,Param2, orParam3.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_solvereturned byget_lens_data().
- Return type:
- Raises:
ValueError –
operandis 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 –
operandorconfiguration.action –
change,add,remove, ormake_current.make_currentselects the configuration shown in the Lens Data Editor.number – 1-based operand or configuration number.
addinserts at this number, and following rows or columns move up. Passnumberone 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(). Omitvaluesto insert a default operand or configuration, or to remove one.numberandactiveare read-only.typeis an operand type name, such asTHIC.parametersmapsParam1,Param2, orParam3to an integer.cellsmaps a configuration number, such as"1", to a number, a string, or an object withvalueandsolve.typeis applied beforeparametersandcells. A configuration has no fields to change.addfor a configuration acceptscopy: true copies the current configuration’s cells. The last configuration cannot be removed.
- Returns:
current,configurations, andoperandsafter the change.- Return type:
- Raises:
ValueError – The section, action, number, or values cannot be applied.