SpectraFit-Core: a Rust-cored nonlinear curve-fitting library validated against the NIST Statistical Reference Datasets
- 1Max Planck Institute for Chemical Energy Conversion, Stiftstraße 34–36, Mülheim an der Ruhr, Germany, 45470
Abstract
Nonlinear least-squares fitting of parametric line shapes is routine in the analysis of spectra, and the analyst often knows relationships between the parameters before the fit starts, such as a shared width or a fixed intensity ratio. SpectraFit-Core is an open-source curve-fitting library in which this knowledge is part of the model. A model is a graph of named components, and each relationship is an expression edge on that graph, within one spectrum or across several spectra fitted jointly in one call. On a measured Fe L2,3 energy-loss spectrum, four such relationships leave the fitted values unchanged and make the edge-step amplitude 28 times more precise. Because the model is a description rather than code, the same graph can be fitted by other implementations and their parameters compared name by name. The parameters and standard errors of the library are checked against certified values: on 22 of the 27 nonlinear-regression problems of the NIST Statistical Reference Datasets, the least accurately recovered parameter agrees to more than six significant figures, and the standard errors agree nearly as well except on Lanczos1. Kernels, analytic Jacobians, and solver iteration run in compiled Rust behind a typed Python interface, which also makes the library faster than lmfit, SciPy, and JAX on its benchmark. A companion repository regenerates the results from the published release. SpectraFit-Core is released under the MIT license, distributed on PyPI and archived on Zenodo.
Related
- Single-electron Fluorine Bonding. I. The SEFB-15 and CSFB-14 Benchmark Datasets, Reference Binding Energies and Intermolecular Bond Distances: Assessment of M06-2X density functional
- An Exact Operator Formulation of Statistical Quasiparticle Theory for Nonlinear System-Bath Coupling
- Yield Prediction and Condition Recommendation on High-Throughput Experimentation Datasets: Encoding Effects and Noise Ceilings
- Comparative Analysis of Basic Machine Learning and Rigorous Free-Energy Calculation on Benchmarking Datasets of Protein-Ligand Binding Affinity
- Comprehensive Profiling of Microcystins in Non-Targeted LC-HR-MS Datasets using Mass Spectrometry Query Language (MassQL)
BibTeX
@misc{hahn2026spectrafitcore,
title = {{SpectraFit-Core: a Rust-cored nonlinear curve-fitting library validated against the NIST Statistical Reference Datasets}},
author = {Anselm W. Hahn},
howpublished = {ChemRxiv},
year = {2026},
month = oct,
doi = {10.26434/chemrxiv.15010416/v1},
url = {https://chemrxiv.org/doi/full/10.26434/chemrxiv.15010416/v1},
note = {CC BY},
}
RIS
TY - UNPB
TI - SpectraFit-Core: a Rust-cored nonlinear curve-fitting library validated against the NIST Statistical Reference Datasets
AU - Anselm W. Hahn
PY - 2026
DA - 2026/10/13
PB - ChemRxiv
DO - 10.26434/chemrxiv.15010416/v1
UR - https://chemrxiv.org/doi/full/10.26434/chemrxiv.15010416/v1
AB - Nonlinear least-squares fitting of parametric line shapes is routine in the analysis of spectra, and the analyst often knows relationships between the parameters before the fit starts, such as a shared width or a fixed intensity ratio. SpectraFit-Core is an open-source curve-fitting library in which this knowledge is part of the model. A model is a graph of named components, and each relationship is an expression edge on that graph, within one spectrum or across several spectra fitted jointly in one call. On a measured Fe L2,3 energy-loss spectrum, four such relationships leave the fitted values unchanged and make the edge-step amplitude 28 times more precise. Because the model is a description rather than code, the same graph can be fitted by other implementations and their parameters compared name by name. The parameters and standard errors of the library are checked against certified values: on 22 of the 27 nonlinear-regression problems of the NIST Statistical Reference Datasets, the least accurately recovered parameter agrees to more than six significant figures, and the standard errors agree nearly as well except on Lanczos1. Kernels, analytic Jacobians, and solver iteration run in compiled Rust behind a typed Python interface, which also makes the library faster than lmfit, SciPy, and JAX on its benchmark. A companion repository regenerates the results from the published release. SpectraFit-Core is released under the MIT license, distributed on PyPI and archived on Zenodo.
ER -