Modernising a thermonuclear burst simulation code for neutron star constraints

BEANSp is a software tool developed to simulate Bayesian Estimation of Accreting Neutron Star parameters. It helps astronomers to understand behaviour of binary systems consisting of a neutron star with weak magnetic field that is accreting matter from it’s low-mass companion star, which are observed as transient X-ray sources, that exhibit coherent X-ray pulsations as well as periodic Type-I thermonuclear X-ray bursts. BEANSp runs a simulation of the process happening in the parameterised binary star system, attempting to match the observation and determine correct parameters of the specific event. This fitting is achieved by use of a Markov Chain Monte Carlo approach to match observations of an accreting neutron star in outburst with a simple ignition model to constrain parameters including the neutron star mass, radius, surface gravity, distance and system inclination, and accreted fuel composition.

The BEANS code is written in Python 3, except for the module settle which is a C/C++ code with a python wrapper. The original code was developed within last ~10 years, although some of the C/C++ code was a bit more rusty, dating a couple of decades back. It was difficult to maintain, failed to build with current versions of compilers and unreliable to use for the astronomers, which was slowing down their progress with research.

The role of the ADACS support in this project was to analyse the code and suggest and implement improvements. The ADACS team not only refactored the old C/C++ code and fixed a bunch of bugs, but also significantly improved the software development processes within the research team, enabling them to keep the code base maintainable. A single git repository was divided into two (beans and pysettle), automated testing was added, and both software tools were wrapped into python packages and published on PyPI. On top of the actual help with specific software problem, it is a general knowledge transfer that made this project a great success. The whole process of making changes in the software through testing to generating a new package release was adopted by the research team, setting a new long-term maintainability standard.

The ADACS support benefits people beyond just the research team – as a result, both of the software packages are publicly available in a form that is easy to install and ready to use just by single command pip install beansp. Pysettle gets automatically installed as dependency, while it can still be used individually when installed as pip install pysettle.