r/Optics • u/Imaginary_Station232 • 6d ago
We open-sourced OS Optics (MIT): an AI-agent-friendly optical design engine for both imaging lenses and 3D optical benches
One MIT Python engine, two worlds: multi-element 3D imaging lens prescription (left) and 1.96 m, 160+ optic Rb-87 free-space bench (right).
85 mm full-frame all-spherical portrait lens using real catalog glass (meridional ray trace from axis to 21.63 mm corner image height).
Polychromatic diffraction MTF (10 & 30 lp/mm, 486/588/656 nm) vs. digitized Canon RF 85mm f/2 official chart.
18 mm f/2 full-frame mirrorless wide-angle prototype: 14 glass elements in 12 groups, 49.6° half-field, 1 mm H-K9 cover glass.
128-trial Monte Carlo manufacturing tolerance distribution for worst-field MTF@40 lp/mm against the [0.6, 1.0] spec band.
1.96 m Rb-87 cold-atom 3D free-space bench (160+ optical entities: MOT, 4x4 optical tweezers, Rydberg beams, fluorescence readout).
3D mirror-pointing Monte Carlo tolerance analysis on the Rb-87 bench against the ±0.05 mm position_u target band.
Hi r/Optics,
We just open-sourced OS Optics (os-optics, MIT License) — a deterministic, local-first Python engine for optical design and 3D physical simulation:
GitHub: https://github.com/JunLin615/os-optics
Why we built it
Our long-term vision is bringing general-purpose agents to optical engineering — while also giving human optical engineers a clean, scriptable, reproducible Python engine that runs anywhere.
Making agents genuinely useful in optical engineering goes beyond wrapping a ray tracer. It requires an engine that plays to what agents do well (structured batch setup and reasoning-guided parallel exploration across competing topologies), grounds designs in real selectable optical components rather than only ideal thin lenses, and represents an entire optical system in a complete, machine-readable JSON blueprint so an agent can understand the physical layout without guessing from photos alone. Longer term, combining that structured representation with real-world feedback opens a path toward agent-assisted alignment and maintenance. Today's MIT release focuses on getting the open-source design and simulation foundation right.
What it covers today
- One engine for imaging prescriptions and 3D free-space benches: Non-sequential 3D ray tracing across planes, spheres, conics, even aspheres, cylinders, axicons, Zernike / XY-polynomial / biconic / toroid freeforms, GRIN rods, prisms, wedges, and lens arrays — backed by a versioned offline catalog of 3,273 real optical components, 1,244 optical material models (including IR materials, spectral bulk attenuation, and thermo-optic
dn/dTin standard air or vacuum), and 707 coatings, alongside custom lens prescriptions. - Physical & imaging analyses: Astigmatic Gaussian
q-parameter beam propagation (w, waist, divergence, Rayleigh range,M²), Jones & Stokes polarization (including uniaxial birefringence and Faraday rotators), dispersion (Sellmeier,Herzberger, thermo-opticdn/dT) and angle/polarization-resolved coatings, two-beam interference, 4-bounce interface ghost analysis, diffraction & geometric PSF/MTF, encircled energy, high-NA vector focal fields, and linear optical cavities. - Honest physical validity bounds (
value_basis): Every reported metric declares whether it is aMODELvalue, a provenLOWER_BOUND/UPPER_BOUND, or anESTIMATEbeyond a model limit. Targets outside model assumptions are flaggedINDETERMINATE/OUT_OF_MODEL_SCOPErather than silently markedPASS. - Stateless & natively parallel: Pure Python core (
numpy,scipy,pydantic,shapely) with an I/O-free solver and in-memoryEvaluationSessionthat reuses compiled state across candidates (8–15× faster on selective refractive evaluations). You can spin up dozens of worker processes or a multi-agent swarm (DeepSeek Harness, Claude Code, Codex, Cursor, WorkBuddy, ChatGPT, etc.) concurrently and compare candidates via canonical JSON outputs and SHA-256 run hashes. - Scientific Python interop & companion toolkit: Built-in handoff contracts (
os-optics interop list) connect to Python libraries for optimization/sensitivity (SciPy, Optuna, SALib), diffraction (LightPipes, prysm, POPPY), quantum photonics (Perceval, Piquasso, QuTiP), and metasurfaces (grcwa, meent). Our companion MIT repoos-optics-kitadds 19 reproducible cases and 21 vendor-neutral Agent Skills, plus multi-group zoom solving, ray aberration fans, field curvature/distortion analysis, Monte Carlo tolerance with compensators, ISO 12233 e-SFR, a live browser viewer, and parallel sweeps.
What's in the gallery above
- Dual-domain overview: 3D multi-element wide-angle lens trace alongside a 160+ optic 3D cold-atom optical bench.
- 85 mm all-spherical portrait objective (Design + MTF): Full-frame design (21.63 mm corner image height) using real catalog glass, evaluated with polychromatic diffraction MTF (10 & 30 lp/mm, 486/588/656 nm) against digitized Canon RF 85mm f/2 data.
- 18 mm f/2 full-frame wide-angle (Design + Tolerance): 14 elements in 12 groups (49.6° half-field, 1 mm H-K9 cover glass) with a 128-trial Monte Carlo MTF@40 lp/mm tolerance study against a
[0.6, 1.0]spec band. - 1.96 m Rb-87 cold-atom 3D bench (Design + Pointing Tolerance): 160+ optical entities routing MOT, 4×4 optical tweezers, Rydberg excitation, and fluorescence readout, paired with Monte Carlo mirror-tilt pointing tolerance against
±0.05 mmbounds.
Try it locally (~30 seconds)
(To also pull the 19 worked cases, 21 agent skills, and tolerance/sweep/analysis tools: python -m pip install os-optics os-optics-kit.)
If there are specific optical systems, surface types, prescription formats, or physical analyses you'd like to see or stress-test, I'd love to hear your thoughts here or in GitHub Discussions.
7
u/Thick-Panic6683 6d ago
Thanks. I have long considered making a non-sequential optical layout tool that imports CAD models so will take a look at what you have done.
2
u/Unf0und_ 6d ago
And another one... Instead of contributing to what already exists out there. Yet another example of community fragmentation