fullseye

lens_file_write — OPTICS lensfile op

使い方

処方を、:func:lens_file_read と設計ソフトが読める .zmx のテキストに書く(table)。

prescription is the dict from :func:lens_file_read (None: the bundled example). system — optional — is an edited raytrace.lens_system (for example the output of lensopt.optimize_lens): its radii, thicknesses, conics, aspheric terms and media replace the prescription’s surfaces while the fields, wavelengths, aperture type, comments and still-valid solves are kept (a solve whose value was edited is dropped from the output and listed in dropped_solves). The stop size is written as the system aperture: an entrance-pupil diameter (ENPD) recomputed from system when the prescription used ENPD or FNUM.

path (optional) writes the file; encoding "ascii" (default, plain text that diffs well) or "utf-16" (with byte-order mark, what current design programs save). Media: an (n_d, V_d) pair or a plain index becomes a model glass, a catalogue name or .agf record its name with n_d / V_d on the line; a custom Sellmeier medium without a catalogue name is refused (a reader could not resolve it). system may also be a raytrace3d.noncoaxial_system (the prescription is then optional): its break and return elements become COORDBRK surfaces (order flag 0 / 1 for the tracer’s “xyz” / “zyx” breaks), an entrance-pupil diameter is recomputed from the stop radius. Refused: a beamsplitter surface, a per-surface decenter / tilt (put a break around it), a tilted image or object plane, a return across an odd number of reflections or one that would need a negative thickness. A coaxial raytrace.lens_system with tilted / decentred surfaces is still refused.

A system (or a prescription’s system) that carries configurations is written as a multi- configuration file: configuration 1 as the surface blocks, then MNUM and one row per varying thickness / curvature / glass / aspheric parameter and configuration (see the module help for what is refused); the result then also has n_configurations and rows (row counts per operand).

Returns {"text", "path", "n_surfaces", "encoding", "dropped_solves"}.

Example::

p = lens_file_read("triplet.zmx")
best = lensopt.optimize_lens(p["system"])["system"]
lens_file_write(p, system=best, path="triplet_reoptimised.zmx")

ファミリ共通の入力契約(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

同カテゴリ(lensfile)

lens_file_read · lens_file_system · lens_file_report


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

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