Skip to content

Rust ↔ Python binding audit

Generated by scripts/audit_bindings.py --write from scripts/binding_audit_notes.toml + the grepped PyO3/Solver surface. This file is not read by CI — edit scripts/binding_audit_notes.toml and re-run uv run poe audit_bindings_regen, don't hand-edit this page.

PyO3 entrypoints (crates/spectrafit-core/src/lib.rs)

Entrypoint Description
evaluate Forward model evaluation: graph + params + data -> JSON array of values.
evaluate_components Per-component decomposition of the fitted model -> JSON object keyed by node id.
fit Pydantic-validated FitGraph + MeasurementData + FitOptions -> fit result JSON.
fit_arrays Array fast path for fit(): flat x/y/sigma buffers instead of MeasurementInput.
fit_arrays_numpy Zero-copy numpy variant of fit_arrays for hot loops.
model_type_wire_strings Canonical model-type wire strings generated from the model manifest; pins the Python ModelType enum to the Rust source.

Solver dispatch (crates/spectrafit-solver/src/dispatch.rs)

Solver::Variant Description
Solver::Auto Chooses VarPro or the faer LM family from the graph shape at run time.
Solver::Dogleg Powell's dogleg trust-region method.
Solver::Geodesic Geodesic acceleration on the faer LM core.
Solver::Global Differential Evolution (global search); DE seed pinned at 0.
Solver::Irls Iteratively-reweighted least squares (robust loss); weight fn selectable via 'irls:'.
Solver::Lm Default faer Levenberg-Marquardt.
Solver::LmLegacy nalgebra levenberg-marquardt parity oracle, retained for regression comparison.
Solver::NewtonCg Matrix-free Newton-CG (Steihaug-Toint) trust-region method.
Solver::Trf Trust-Region-Reflective (Coleman-Li bound scaling on the faer LM core).
Solver::Varpro Variable Projection (separable nonlinear least squares).