fullseye

optimize_lens_operands — OPTICS lensmerit op

使い方

オペランド表のメリット関数を LM で最小化する。硝材も変数にできる(table)。

The residual vector is the stack of the table’s rows (:func:merit_evaluate); variables are those of :func:lensopt.optimize_lens ("c<i>" / "R<i>" curvature, "t<i>", "k<i>", "A4_<i>" …; default every finite radius) plus glass variables "g<i>". The continuous steps are lensopt’s: forward-difference Jacobian, (JtJ + lambda diag(JtJ)) delta = -Jt r, a step is kept only if the merit falls (lambda /3, else x4, six tries), stalled after two iterations without an accepted step. min_thickness, max_thickness and min_radius clamp the variables as in optimize_lens (the table’s bound rows are what keep edges, centres and gaps in range). A glass variable moves the glass of surface i over glass_candidates (a list of media: catalogue names, (n_d, V_d) pairs or raytrace.glass dicts; or a dict "g<i>" -> list) by an outer discrete sweep: after the continuous optimisation has converged each candidate is tried once (swapped in, the continuous variables re-optimised for glass_iterations iterations) and the best is kept if it lowers the merit; this repeats up to outer_iterations times with a full continuous re-optimisation between sweeps. A candidate equal to the glass already there is skipped, so a list holding only the current glass gives exactly the continuous result.

Returns {"system", "table_before", "table_after", "merit_initial", "merit_final", "history", "iterations", "rejected_steps", "converged", "status", "variables", "glass", "dominant_after", "violated_after"}; table_before / table_after are :func:merit_evaluate results, rejected_steps counts the trial steps refused, glass lists each glass variable with its initial / final medium and every candidate’s merit.

Example::

r = optimize_lens_operands(lens, ops, ["c0", "c1", "t0", "g0"], glass_candidates=[(1.52, 64.2), (1.62, 36.4)],
                           fields=m["fields"])
r["merit_initial"], r["merit_final"], r["glass"][0]["final"]

ファミリ共通の入力契約(fail-closed)

optics の全 op は入力を検証してから計算する(黙って通さない):

詳しい使い方ガイド

参考(サンプルデータ・文献)

実行できる例(この op を実際に呼ぶ検証済みサンプル)

型が繋がる次の op(table を入力に取れる)

abcd_matrix · wavefront_stats · sfr_from_edge · paraxial_trace · seidel_coefficients · spot_stats · tolerance_analysis · wavefront_from_opd

同カテゴリ(lensmerit)

merit_operands_list · merit_evaluate · merit_default · merit_boundary_operands · merit_contributions


Provenance: lensmerit.py — OPTICS operator registry. この per-op ノートは tools/opdocs.py md が自動生成(手編集しない)。

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.