xs2arr

An Arrhenius coefficients calculator from provided cross section data

Published: Oct 1, 2025 by Ava Dean

Project info

licence MIT

xs2arr is a Python package that calculates Arrhenius coefficients from provided cross section data in the LXCat file format. The user can define an electron energy distribution, range of temperatures, and the choice of standard or logarithmic interpolation.

The code supplied to us for this project was a Jupyter notebook and was well structured and commented. It used a range of maths and plotting functions from the numpy and matplotlib libraries. We started by creating the standard files needed for a package, namely the pyproject.toml and a uv.lock to establish the version of dependencies we identified. A large portion of the time was spent modulising the code into smaller functions and classes. We had to bear in mind that the package would be intended to be used not only as a plugin for other software, but also as a pedagogical tool. A test suite was made, along with appropriate continuous integration workflows, as well as documentation using Sphinx. Lots of for loops were replaced with numpy arrays to improve performance.

An LXCat file processor already existed, but had a bug relating to the use of pandas version 1.5. This arose due to the lack of outlined dependencies and versions in the original repository. This code was forked and the bug fixed. A merge request was made to the original repository, and the original xs2arr package was made to point towards the forked repository in the mean time.

The use of logarithmic interpolation in the calculation of the Arrhenius coefficients was investigated. Due to the linear nature of this equation, which contrasts the original exponential equation, the interpolation process showed to typically require fewer iterations to converge. It also seemed to return more sensible values for the Arrhenius coefficients. The code was modified to allow the user to choose between the standard and logarithmic interpolation.

Along with the package itself, a new pedagogical Jupyter notebook was created. This version was more concise, and used conveniently designed functions and classes from the xs2arr package. It also nicely printed the source code of these functions using the getsource, pygments and IPython libraries. It also now uses markdown to nicely present text and mathematical equations.

python cross-section arrhenius rate-coefficients boltzmann-distribution lxcat

Share