Optimization

Merit function columns, Optimization Wizard setting names, and the algorithm and cycle names local optimization accepts.

Merit function

Merit Function Editor operands and calculation.

class MeritFunction(attributes: tuple[Attribute, ...])

Merit Function Editor columns copied for every operand.

Data columns depend on the operand type. read() includes the active ones.

Parameters:

attributes (tuple[Attribute, ...]) – Columns read from each operand.

attributes: tuple[Attribute, ...]

Columns read from each operand.

edit(editor, action: str, number: int | None, values: dict[str, object] | None) → None

Change, insert, or remove one operand.

add inserts at number and then writes values. type changes the operand type before the other keys. parameters maps column names such as Param1 to new values.

Parameters:
  • editor – The ZOS-API merit function editor.

  • action (str) – change, add, or remove.

  • number (int | None) – 1-based operand number.

  • values (dict[str, object] | None) – Keys to write. The fields are the same as those returned by read().

Raises:

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

read(editor, operand: int | None = None) → dict[str, object]

Read every operand, or one operand.

Parameters:
  • editor – The ZOS-API merit function editor.

  • operand (int | None) – One 1-based operand number. None reads every operand.

Returns:

operands, or the one requested operand. Each operand includes parameters for the columns its type uses. target, weight, value, and contribution are omitted when the operand does not use them.

Return type:

dict[str, object]

Raises:

ValueError – operand is outside the editor.

MERIT

Columns copied from every Merit Function Editor operand.

Optimization Wizard

Optimization Wizard controls.

SETTING_NAMES: tuple[str, ...] = ('criterion', 'type', 'reference', 'spatial_frequency', 'xs_weight', 'yt_weight', 'pupil_integration', 'rings', 'arms', 'obscuration', 'grid_size', 'delete_vignetted', 'use_glass_boundaries', 'glass_min', 'glass_max', 'glass_edge', 'use_air_boundaries', 'air_min', 'air_max', 'air_edge', 'start_at', 'overall_weight', 'use_all_configurations', 'configuration', 'use_all_fields', 'field', 'assume_axial_symmetry', 'ignore_lateral_color', 'add_favorite_operands', 'optimize_for_best_nominal_performance', 'optimize_for_manufacturing_yield', 'manufacturing_yield_weight', 'use_maximum_distortion', 'maximum_distortion')

Optimization Wizard control names, in dialog order.

Local optimization

Local optimization for the open lens.

ALGORITHMS: tuple[str, ...] = ('DampedLeastSquares', 'OrthogonalDescent')

Algorithms accepted by local optimization, in dialog order.

CYCLES: tuple[str, ...] = ('Automatic', 'Fixed_1_Cycle', 'Fixed_5_Cycles', 'Fixed_10_Cycles', 'Fixed_50_Cycles')

Cycle counts accepted by local optimization. Infinite is omitted because the call waits until the run finishes.