Skip to content
Status: beta (0.1.0)

High-performance numerical curve fitting — a Rust kernel with analytical Jacobians, Pydantic-typed schemas, and a self-auditing benchmark that audits its own credibility against independent oracles (lmfit, JAX, scipy) and NIST StRD certified values.

Gate: PASS 13.18× geomean vs. lmfit 0 regressions Full benchmark → 160 cases · run 2026-09-28_run_001 · 2026-09-28

SpectraFit-Core

What is this?

spectrafit-core fits spectroscopic and general nonlinear models with a Rust Levenberg–Marquardt / trust-region core, exposed to Python through a PyO3 wheel and a Pydantic schema mirror. Its distinguishing feature is a trustworthy benchmark: rather than asking you to take its speed/accuracy claims on faith, it ships a dashboard that verifies its own numbers (independent parity oracle, timing-isolation guards, render-truth provenance, NIST StRD validation) and visibly discloses what it has not verified. See Why spectrafit-core for the full case for a new implementation over wrapping lmfit/scipy, and Limitations for disclosed gaps.

The library reads no files. There is no reader for any instrument or exchange format, and none is planned: a fit takes in-memory arrays as MeasurementData(x, y, sigma=None), and getting your measurement into those arrays is your code's job. That boundary is deliberate rather than an omission — supplying the I/O, project handling and interactive layer is the role SpectraFit is intended to play. Note that SpectraFit today is built on lmfit; adopting spectrafit-core as its engine is planned for a future version, not something already shipped.

Citing

If you use spectrafit-core in academic work, please cite it via CITATION.cff (GitHub's "Cite this repository" button reads the same file).

Acknowledgements

The measured spectrum used by the misspecified-model gallery page comes from the EELS Database, contributed by Qiang Xu and redistributed here under the Open Data Commons Open Database License. Credit is due to the EELS Data Base and its contributors; the database itself is described in Ewels et al. (2016), doi:10.1017/S1431927616000179. Provenance, licence notice and checksum: reproducibility/spectra/eelsdb-fe2o3-l23/.

License

MIT © Anselm Hahn — for the code. Third-party measured data vendored under reproducibility/spectra/ carries its own licence, recorded per asset in reproducibility/assets.toml and in each directory's README.md; the MIT notice does not extend to it.

See also the Contributor Guide, Code of Conduct, and Security.