Magnetically confined plasma experiments generate a wealth of spectroscopic data. The first step toward extracting physical parameters is to fit a spectral model to the often complex spectra. The CXSFIT (Charge eXchange Spectroscopy FITting) spectral fitting code was originally developed for fitting charge exchange spectra on JET from the late 1980s onward and has been further developed over decades to keep up with the needs of the users. The primary use is to efficiently fit a large number of spectra with many constrained Gaussian spectral lines of which the physical parameters can be coupled in a user-friendly manner. More recent additions to the code include time-dependent couplings between parameters, flexible background subtraction, and a non-linear coupling scheme between fit parameters. The latter was a pre-requisite for implementing Zeeman and motional Stark effect multiplets in the library of spectral features. The ability to save and replay "fit recipes," even when multiple iterations are required, has ensured the traceability of the results and is one of the keys to the longevity and success of the code. The code is also in use on other tokamaks (AUG, ST-40) and to fit data from other spectroscopic diagnostics on JET. In this paper, we document the current capabilities and philosophy behind the structure of the code, including some of the algorithms used to calculate spectral features numerically efficiently. We also provide an outline of how CXSFIT could be transferred into a framework that would be able to meet the spectral fitting requirements of future devices, such as ITER.
Read full abstract