The SparSpec algorithm and the application to the detection of spatial periodicities in tokamaks: error weighting the penalization criterion to improve the performance of the algorithm**[Note: this work is partially based on a 4th year bachelor project by one of the authors (LMP), performed while being a student at the SPC-EPFL under the supervision of the corresponding author (DTA)]. (28th April 2021) - Testa, D; Carfantan, H; Perrone, L M
Abstract: A common problem in many complex physical systems is the determination of pulsation modes from irregularly sampled time-series, and there is a wealth of signal processing techniques that are being applied to post-pulse and real-time data analysis in such complex systems. The aim of this report is studying the problem of detecting discrete spatial periodicities in the spectrum of magnetic fluctuations in tokamaks, for which the optimization of the algorithm performance is essential, particularly when multiple sensors are used with different measurement uncertainties, and some of the processed output signals are then used in real-time for discharge control. The main tool used hereafter will be the SparSpec algorithm, initially devised for astrophysical purposes and already applied to the analysis of magnetic fluctuations in various tokamaks. In its baseline version, dubbed SS-H2, the SparSpec algorithm runs in currently or previously operating tokamaks (JET, TCV and Alcator C-mod), and is foreseen to be deployed for data analysis in tokamak under construction (ITER, DTT). For JET, SS-H2 regularly runs also in real-time on a 1ms clock for detecting Alfvén Eigenmodes using synchronously-measured magnetic perturbations. On JET and TCV, it was noted that often a reduced set of sensors had to be used as the measurement uncertainties were not the same for all available sensors, somewhat deteriorating the overall performance of the algorithm. Hence, as part of a major update of the SparSpec algorithm, specifically intended for accelerating the real-time performance, use of the measurement uncertainties to weight the data, the spectral window and the ensuing penalization criterion was introduced. The behaviour of this new version of the SparSpec algorithm under a variety of simulated circumstances is analysed. It is found that the implementation of SparSpec using such error weighting produces superior results to those obtained with SS-H2, both in terms of the speed and the accuracy of the calculations. A test on actual data from the JET tokamak also shows a clear improvement in the performance of the algorithm.