Martino Ferrari ef57ec81e4 Rewrite ModalFitter.fit around the CameraModel tolerance mechanism
The optimizer's parameter vector is now built dynamically: LG
coefficients, per-plane center, and both pointing angles stay always
free; each CameraModel field and each plane's z join the fit (bounded to
its +/- tolerance) only when its paired tolerance is nonzero, and are
otherwise substituted as fixed constants.

Also seeds the first mode's coefficient with a small imaginary offset
(1.0 + 0.05j instead of 1.0 + 0j) rather than exactly on the real axis:
for a single mode, intensity depends only on |c| (phase is unobservable),
so Im=0 sits exactly on that flat/degenerate valley, aligned with a
coordinate axis, giving a zero-gradient Jacobian column that destabilized
trf's trust-region step and prevented pointing-angle recovery from a
default (0, 0) initial guess.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-03 12:04:47 +02:00

he11lib

Mode purity reconstruction of a free-space-propagating gyrotron RF beam from a set of thermal (flux) images taken at different distances from the output window.

Decomposes the beam into Laguerre-Gauss (LG) modes referenced to a known waist size/location/wavelength, accounting for camera geometry, sensor noise, target thermal-diffusion blur, and unknown beam centering/pointing.

See docs/api.md for the full API reference and examples/full_pipeline_example.py for a runnable end-to-end demonstration, and docs/superpowers/specs/2026-07-02-gyrotron-mode-purity-design.md for the full design.

Install (editable, for development)

pip install -e ".[dev]"

Run tests

pytest

License

GPL-3.0-or-later. See LICENSE.

AI-assisted development disclosure

The initial implementation of this library (design, code, tests, and documentation) was produced with AI assistance:

  • Model: Claude Sonnet 5 (claude-sonnet-5)
  • Agent/harness: Claude Code CLI, version 2.1.92

All output was reviewed and directed by a human collaborator throughout development.

S
Description
HE11 mode reconstruction library
Readme GPL-3.0 194 KiB
Languages
Python 100%