Paper

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*

, and

Published 28 April 2021 © 2021 © Ecole Polytechnique Federale de Lausanne
, , Citation D Testa et al 2021 Plasma Res. Express 3 025005 DOI 10.1088/2516-1067/abf946

2516-1067/3/2/025005

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.

Export citation and abstract BibTeX RIS

1. Introduction

The problem of detecting frequencies from time series is common in a large number of fields in science, among which astrophysical observations are an important example. On most occasions, the analysis of such time series is the only feasible approach to the study of the stellar environment, such as in the context of astero-seismology, where the oscillation frequencies of stars are used to deduce their interior dynamics and verify proposed models [1, 2]. These time series are usually irregularly sampled—as a result of such constraints as the rotational period of Earth and/or practical limitations (meteorological conditions)—despite being often very large and long-term (time spans of months if not years). As a consequence, classic decomposition tools as the Fourier transform are ineffective and give wrong results. This has led to a remarkable effort in devising specific methods of frequency estimations such as phase-binning techniques [35], Lomb-Scargle periodogram [68], data-compensated discrete Fourier transform [9], and iterative methods based on pre-whitening steps [10, 11], just to mention a few.

Many similarities can be found between the astrophysical detection of temporal frequencies and the detection of the spatial periodicities of magnetic fluctuations (=modes) in a tokamak plasma and this has suggested that a similar approach to the data analysis could be successfully employed in the latter case. Nevertheless, a few important specificities of the plasma problem are to be stressed which complicate this task, namely:

  • the number of detectors in the tokamak is limited and of the order of 10 → 50;
  • the modes are both in the temporal and spatial domains, and their periodicities (=frequencies in the following) have rational values and are continuous in the time domain but have only discrete and integer values in the spatial domain;
  • the input signals can be real-valued (a time series) or complex-valued (a frequency spectrum);
  • there are practical necessities such as requiring that the computation be as fast as possible so as to conduct a real-time (RT) analysis of the modes developing during a run in the tokamak (contrary to the astrophysical application, where the data analysis can and usually does span a long period);
  • finally, there is a different meaning, hence treatment, for the mean signal: in the astrophysical context this is usually discarded being normally the background noise or associated to the Earth's orbital movement, whereas in plasmas this could be associated with the spatial (n, m) =0 mode, thus retaining a physical importance, n and m being the toroidal and poloidal mode numbers, respectively.

Given the above properties pertaining to the detection of plasma modes, a fruitful approach can be found in the theory of the Sparse Representation of Signals (SRS), on which the SparSpec code [12, 13] (see: http://userpages.irap.omp.eu/~hcarfantan/SparSpec1.4/SparSpec_html.html) is based. This is its baseline and simplest version, and its application to the analysis of spatial periodicities in tokamaks has already been presented multiple times [1, 1218]. Therefore only a rather short description is outlined in the next section to simplify the reading of this contribution.

This work aims at presenting a further development of the baseline SparSpec algorithm, dubbed SS-H2, as applied to the detection of spatial frequencies in tokamaks, namely using the measurement uncertainties to weight the data, the spectral window and thus the penalization criterion. This is part of a major update of the SparSpec algorithm, specifically intended to accelerate the RT processing, of which the second part, namely the introduction of a memory with relaxation (MwR) scheme to provide better input constraints for the analysis and thus hopefully speed up the RT calculations, is presented in a separate contribution for clarity. A third development, namely the application to a 2D spatial decomposition problem, is ongoing and will be reported separately at a later date.

Regarding the use of the measurement uncertainties to better constrain a penalization problem, other approaches obviously exist for these analysis, such as those deploying Bayesian inference techniques [19]. These may also be, perhaps even more naturally, suited for the quantification and propagation of the measurement uncertainties, but their discussion is outside the scope of this work.

Regarding the use of the measurement uncertainties within SparSpec, it has been often found in the analysis of JET and TCV magnetic data that not all input signals could be used with SS-H2, as they were characterised by rather different intrinsic errors and thus could not be assembled effectively as a unique input dataset. This partially reduced the accuracy of the algorithm, as we indeed found that sometimes different solutions could be obtained depending on which subset of input signals was used. A clear step forward is to introduce the measurement uncertainties in SparSpec, which has led to the development of the SparSpec-V5 algorithm (which also includes the MwR scheme), of which the SS-V5ν0 4 version (without memory) is considered here.

This paper is organised as follows. Starting from existing literature, in section 2 we briefly review the mathematical foundations of the SRS and of the SparSpec code 5 , and it will become apparent that is quite straightforward to weight the input data with respect to the overall measurement uncertainties, and thus use them as well in the spectral window and penalization criterion. Section 3 then compares the results obtained with SS-H2 and SS-V5ν0 for an extensive number of simulated test cases, this being the most appropriate test as we know what the result should be. The clear improvements brought about by using SS-V5ν0 versus SS-H2 using simulated data have been verified on one test case using actual data from the JET tokamak, as shown in section 4. These performance improvement will have to be more systematically addressed in as many experiments (JET and TCV, and other devices as well) as possible, when we do not know what the results should be; however, this activity is left for future work. Section 5 will then present our summary and conclusions.

2. The sparse representations of signals and the SparSpec code: a brief review

The classic way to deal with signal detection is the well-known spectral decomposition through Fourier analysis, whose aim is to find the series of frequencies fl and the corresponding (possibly complex) coefficients xl such that our periodic signal y(tp) at the time point tp can be written as:

Equation (1)

In equation (1), ε is a possibly time-varying scalar quantity which includes the instrumental and random errors that could affect the measurement; ε generally depends on which sensors are used and on the frequency fl: a more explicit expression for the error will be provided later; LMAX is the total number of spectral components. In equation (1) we have used for simplicity the general conjugated variables time (=t) and frequency (=f) in the time domain, which could also represent conjugated variables in the spatial domain, i.e. toroidal (poloidal) angles and toroidal (poloidal) mode numbers in tokamaks.

Though immediate from a mathematical point of view, this method presents some rather serious drawbacks in its numerical implementation:

  • the total number of frequencies 2LMAX + 1 is not known a priori;
  • the algorithm is non-linear with respect to the frequencies fl.

A common alternative considers the theory of the Sparse Representation, in which a dictionary of frequencies, that in principle could be very large and redundant, is defined by the user according to some physical considerations. The problem, then, is to determine the coefficients xl such that the solution vector [x] 6 is the sparsest possible, i.e. with the fewest non-zero components. In matrix notation, equation (1) then becomes:

Equation (2)

where [[W]] is the spectral window, defined as Wl,p = exp(ifltp), with [Wl] being its l-th column. Here [ ε ] is linked to the similarly-labelled, but scalar, quantity εl,p in equation (1) by [ ε p] = Σl ε l,p. For an evenly-distributed signal the matrix [[W]] satisfies the orthogonal condition [[W]H[[W]] ∝ [[1]] (i.e. not necessarily orthonormal), while in the general case [[W]] is a Toeplitz matrix 7 .

The Sparse Representation approach, despite having a large number of unknowns (the coefficients {x}) offers the great advantage of being completely linear with respect to them, which makes numerical implementation much more efficient. The process of finding the sparsest solution of the under-determined linear system that best fits the data is based on a minimization procedure of a penalization criterion J(x) which, in its most general formulation, is written as follows:

Equation (3a)

and [R(x)] is called the penalization function. Many different [R(x)] have been employed to address the minimization procedure. In principle, the one suitable to our problem is the L0 pseudo-norm ∣∣x∣∣0 = Σi∈I0∣xi0 = Card{I0} where I0 = {i∣xi ≠ 0}, which essentially corresponds to the number of non-zero components in the solution vector. However, since this norm lacks differentiability and convexity, it is computationally very costly to implement. Instead, it has been shown [12, 13] that under some assumptions the L0 norm is equivalent to the L1 norm, which has the advantage of being convex, so allowing only global minimizers. Equation (3a ) then reads:

Equation (3b)

The relaxing parameter λ plays a major role in our discussion since it is related to the freedom that we allow in the criterion to choose how many components to pick: the higher the value of λ, the fewer components we are allowing. Moreover, two important results can be proven:

  • 1.  
    if the parameter λ is larger than a critical value λMAX, then the only solution is the zero vector;
  • 2.  
    if the solution vector [x] has less than (2P + 1)/2 non-zero components, where P is the dimension of [y], then [x] is unique.

The value λMAX can be interpreted as the maximum amplitude of the residuals since, for any given value of it, the minimizer of the criterion given in equation (3b ) satisfies max(∣[[W]]H([y] – [[W]]xMIN)∣) ≤ λ. From the latter point, it immediately follows that we can uniquely specify λMAX = max([[W]]H[y]), such that, therefore, for λλMAX no solution can be obtained.

2.1. Definition of the input signal

To carry out our analysis of the SparSpec algorithm, an adequate signal vector SIN must be built. Its adequacy lies in the fact that the signal should resemble, as accurately as possible, a real outcome of the data acquisition systems for magnetics fluctuations at a tokamak facility. Thus the vector of the measurement is a two-dimensional object (a K1 × K2 matrix) in which each entry represents the complex-valued signal 8 measured by the probe at the coordinate {ϕk1, θk2}, where {ϕ, θ} are the toroidal and poloidal angular coordinates, respectively. The index k1 runs over k1 = {1;2;...;K1} and k2 = {1;2;...;K2}, with {K1, K2} both being of the order of 10 → 50. For simplicity, we will study the simplified case where the probes are placed along one spatial coordinate only (namely the toroidal coordinate ϕ), and thus the signal is a one-dimensional (1D) vector. The extension of the SparSpec algorithm to the joint analysis of a 2D {toroidal, poloidal} system is currently under development and will be presented later in a separate contribution.

If the signal was acquired without any error, it would be simply described by a sum over its Fourier components weighted by the Fourier coefficients, yielding a matrix [y] = [[W]]*[x] similar to that appearing in equation (2). Nevertheless, three sources of errors can be identified and have to be taken into account when building the signal:

  • 1.  
    the instrumental error σk produced by the k-th sensor in making the measurement, which is determined by its precision, and the accuracy with which its position is known; considering also the electronic random noise, σk can be up to 15% of the total signal; note our convention whereby all σ's appearing in this (and its companion paper [20]) represent a relative error, and not a standard deviation as more commonly defined in statistical analyses;
  • 2.  
    the delay δk (i.e. an equivalent phase shift) that the transmission line up to the data storage adds to the measurement made locally by each sensor;
  • 3.  
    the error σl in the determination of the Fourier coefficients: considering the typical measurement accuracy, σl can also be up to 15% of the total signal.

As a result, a final expression for the signal vector at the time point tp can be proposed as follows:

Equation (4a)

Equation (4b)

In equation (4) S0(ϕk) is the nominal input signal, without measurement uncertainties and phase shifts, while SIN(ϕk) is the signal as actually measured, which includes all sources of errors. We can now use this analytical form of SIN(ϕk) to produce numerically a set of realistic input signals with which we can run our simulations.

It is now straightforward to see how SS-H2 can be modified to include the measurement errors: SIN(ϕk) → SIN(ϕk)/σTOT(ϕk), thus Wl,k → Wl,k/σTOT(ϕk), where σTOT(ϕk) = ∣SIN(ϕk)-S0(ϕk)∣/χ is the overall estimated measurement uncertainties from the simulations, i.e. the difference between the nominal and actual signal scaled by a normalization factor χ. This factor χ is needed in our case of simulated data as there is a certain degree of arbitrariness on how we estimate the measurement uncertainties. Setting χ = 1 correspond to using σTOT(ϕk)  =  ∣SIN(ϕk)-S0(ϕk)∣, namely the measurement error is exactly the difference between the nominal and the actually measured signal. Setting a higher value χ > 1 corresponds to reducing this error, while setting a lower value χ < 1 would correspond to increasing this error, which is unphysical 9 , thus this test case is not considered. We keep the same value of χ for all sensors 10 , and scan it as χ∈[1 → 10], as in actual (RT) experiments only good measurements are used, i.e. those for which the σk are the smallest and have similar values. We can then account for this σk in SparSpec by minimizing, instead of the cost function given in equation (3a ), the new cost function JLS(x) = ([y] − [[W]]*[x])T[[Γ]]−1([y]-[[W]]*[x]) + λR([x]), where [[Γ]] is the diagonal matrix containing the σk 2 on its diagonal 11 .

2.2. The main features of the baseline SparSpec algorithm SS-H2

Because of the non-differentiability of the L1 norm at zero, a minimization procedure through the evaluation of gradients cannot be employed. Consequently, SparSpec uses an iterative Block Coordinate Descent (BCD) method that is based on subsequent scalar minimization steps for the complex-valued k-th component of the vector [x]. One of the features of this procedure is the low computational cost of each iterative step, which makes it suitable for applications where fast computations/results are needed. The BCD algorithm can be summarised as follows:

It is possible to prove that the set of [x] minimizing the criterion J is equivalent to the condition:

Equation (5)

Here we have introduced the complex shrinkage function Ψ. In the above definitions, z = ρexp(iζ) is a complex number, [wk ] is the k-th column of the matrix [[W]], and [ek ] = yl≠k[wl ]xl.

In words, the behaviour of the BCD algorithm can be explained as follows: at iteration t, it first computes the difference between the signal y and the Fourier Transform of the spectral components excluding xk - particularly, xl≠k computed at iteration t for l < k, and xl≠k at iteration t-1 for l > k. If the absolute value of the inverse transform of the residual is lower than λREL × λMAX (up to a numerical tolerance), where λREL∈[0 → 1] is an user defined scaling factor for λMAX determining the penalized sensitivity of the solution to an increased number of output components (an higher λREL corresponds to less output components being sought), then xk is set to zero; otherwise, it is shrunk by Ψ and used in the following iteration.

The only changes to be made in the algorithm to modify this new criterion JLS(x) is to substitute [y] with [y/ σ k ] (implying yk/σk), and [[W]] with [[W/ σ k ]] (i.e. Wk,l = Wk,l/σk). Then SS-V5 uses the weighting factor ss2 = Σk1/σTOT(ϕk)2χ2 to obtain the {λMAX, ss2} penalized convergence in the successive iterations of the algorithm, see the shrink function described below. In SS-V5 λMAX,H2 becomes λMAX,V5 = max([[W/ σ TOT ]]H[y/ σ TOT ]), hence λMAX,V5 = O(λMAX,H2/σTOT 2λMAX,H2.

An example of the implementation of the BCD algorithm in MATLAB is given in the following code, the shrinkH2 function (in bold in the following lines of code) being where the penalized convergence is tested.

t = 0;
lambda  =  max(abs(Wnorm' * y)) * lambdaREL;
z0 = zeros([2*Nmax + 1, 1]); z1 = zeros([2*Nmax + 1, 1]); e0 = zeros([K, 2*Nmax + 1]);
for p = 1:(2*Nmax + 1), e0(:,p) = y; end
e_t = zeros([K, 2*Nmax + 1]);
while t < 20
for p = 1:(2*Nmax + 1),
e_t(:,p) = y - lowSum(Wnorm, z1, p, K) - highSum(Wnorm, z0, p, K, Nmax);
z1(p) = shrinkH2(dot(Wnorm(:,p)', e_t(:,p)),lambda);
end
z0 = z1; t = t + 1;
end
function [phi] = shrinkH2(a,lambda);
if abs(a)<lambda, phi = 0; else, phi = (abs(a)-lambda) * exp(i * angle(a)); end
return;
function [a] = lowSum(W, v, k, K);
Slow = zeros([K,1]);
l = 1;
while l < k, Slow = Slow + W(:,l) * v(l); l = l + 1; end
a = Slow;
return;
function [a] = highSum(W, v, k, K, Nmax);
Shigh = zeros([K,1]);
for l = 1:(2 *Nmax+1-k), Shigh = Shigh + W(:,l + k) * v(l + k); end
a = Shigh;
return;

For SparSpec-V5, and in addition to using the error-normalized input quantities SIN(ϕk)/σk, Wl,k/σk and λMAX,V5, the shrinkH2 function is simply modified as shrinkV5 and reads:

function [phi] = shrinkV5(a,lambda,ss2);
if abs(a) < lambda, phi = 0; else, phi = (abs(a)-lambda)/ss2 * exp(i * angle(a)); end
return;

Actually, a modified version of the BCD algorithm is used in the SparSpec code, which combines an Iterative Reweighted Least-Squares (IRLS) method: this ensures that J(x) does not grow over the different iterations, and if a component of the spectrum is zero at time t, it will also remain zero at time t + 1. Nevertheless, the BCD algorithm by itself as described above can be already applied quite successfully to spectral analysis. The BCD algorithm is the core of the SparSpec algorithm.

2.3. A few selected test cases for the SparSpec algorithms SS-H2 versus SS-V5ν0

For clarity of presentation and ease of reading, in this section we present a very limited number of selected test cases in order to illustrate the main features and the success of the SS-H2 and SS-V5ν0 algorithms. A more extensive presentation of the results obtained with SS-H2, both off-line and RT, and in diverse fields of science, can be found in the available literature, particularly [1, 1218].

It is clear that multiple parameters need to be set to determine the accuracy and speed of SS-H2 versus SS-V5ν0. First, the input signal SIN(ϕk) must be generated, and this is determined by:

  • The number = NSIG (labelled K1 above) and the spatial distribution = {random, equi-spaced} of the sensors; as we mostly use SparSpec for the analysis of magnetic fluctuations in JET, TCV and ITER, and the number of magnetic sensors available for any such (toroidal, poloidal) analyses in these devices range from ~10 to ~50, which typically are not solely equi-spaced, for simplicity we set a fixed NSIG = 35 and only use randomly distributed sensors.
  • The number of non-zero input signal components =NCOMP and the value of LMAX; magnetic fluctuations can be spatially analysed starting from a time series, hence multiple components are present, or at individual mode frequencies, hence typically only one component is present; thus we scan NCOMP = 1 → 5; in existing devices coherent fluctuations, for which discrete spatial periodicities (i.e. individual mode numbers) must be determined, usually have max(LMAX) = O(5) for the toroidal and correspondingly max(LMAX) = O(15) for the poloidal analyses, while for ITER we expect max(LMAX) = O(15) and max(LMAX) = O(35) for the toroidal and poloidal analyses, respectively; thus we set LMAX = 35 to also cover the generic (toroidal, poloidal) ITER case; this choice of NSIG = 35 with LMAX = 35 is not at all facilitating the analysis, and is there to test at full the functionalities of SparSpec, as in a Nyquist sense one would want to have NSIG≥2 × LMAX.
  • The randomly chosen values for the frequencies (=the spatial mode numbers) and amplitudes of these non-zero input components, thus determining the input set {x}.
  • The phase shifts δk∈[0 → 1] × π and the errors {σk, σl}, all these being randomly distributed; for practical purposes, we set both {σk, σl}∈[0 → 1]×0.15 in relative units, i.e. with respect to the corresponding values of SIN(ϕk) and xl.
  • The value of χ∈[1 → 10] to scan the sensitivity of SS-H2 (intrinsic, since ss2 does not appear in SS-H2) and SS-V5ν0 versus the overall measurement uncertainties.

Second, we need to define the analysis parameters required by the SparSpec algorithm, in addition to λREL∈[0 → 1]:

  • The numerical set of atoms used to find the solutions: this has to be sparse, and it is practically limited to ≤∣FmaxS∣ only by RAM and CPU resources; previous analyses have indicated that FmaxS = [3θ → 5] × LMAX would be typically sufficient for NCOMP = 5 and NSIG = 35, , but since we do not have a problem with computing resources we set FmaxS = 10 × LMAX.
  • Since the solution set is sparse, it is possible that spurious, very-low amplitude elements are found due to the presence of noise in the input signal, and this can be eliminated using a cut-off value μ below which the amplitude of these spurious solutions is set to =0; this cut-off value is linked to the measurement uncertainties as μ = ss2/ξ, where ξ is user defined and can also be varied, but for simplicity ξ = 10 is always used.
  • In principle nIT = the total number of iterations allowed for the convergence procedure in the BCD algorithm and TRIT = the relative (i.e. with respect to max(∣SIN(ϕk)∣) tolerance threshold for checking the convergence conditions are user defined and can also be varied, but for simplicity nIT = 1000 and TRIT = 1 × 10–5 are always used.
  • Finally, as we randomize at each individual simulation the position of the sensors and the input signal, including the noise, for each value of NCOMP we need to run the analysis a very large number of times =NITER = O(104), and calculate the RMS and STD value of our output results; with such a numerically intensive scheme, we believe that we should be avoiding all possible bias in the analysis of the performance of the SS-H2 versus SS-V5ν0 algorithms.

Our MATLAB routine randomly chooses K locations for the probes, the different spatial frequencies (modes) and their amplitude to avoid any bias in the analysis of the algorithm. The data that will be compared to assess and compare the accuracy and the speed of these two algorithms are the average elapsed time needed to converge, the relative error on the input versus output energy conservation, and the number of errors made in the result (hereafter, we will call them faults 12 ). The rapidity of the computations has been measured through the MATLAB function timeit, which returns the clock time taken by the computer for the calculations. This quantity is then a relative, system-dependent, measure of how long it takes to perform one routine with respect to the other 13 .

Figures 1(a), (b) shows, as an illustrative example, two single test runs, always using NCOMP = 2 and χ = 1, but with λREL = 0.15 in figure 1(a) and λREL = 0.65 in figure 1(b). Note that the input signal (real and imaginary components) and the location of the sensors is different in the two runs presented in figures 1(a), (b), but obviously is the same for SS-H2 and SS-V5ν0 in the same run: the corresponding spectral window is only slightly different for SS-H2 and SS-V5, due to the weighting with respect to the σk.

Figure 1.

Figure 1. (a). A first example of test signal generation and detection using the SS-H2 and SS-V5ν0 algorithms, using two input components with an input relative error level =±0.15 and λ = 0.15 × λMAX. A randomly spaced array with 35 sensors is used, whose position is shown in the bottom frame; the spectral window is only slightly different for SS-H2 and SS-V5, due to weighting with respect to the σk. The two input components are detected with good accuracy by SS-H2 and SS-V5ν0, however SS-H2 needs a ~6.15× longer run-time for the analysis. Finally, there are numerous spurious solutions with SS-V5ν0 and only one with SS-H2. (b). A second example of test signal generation and detection using the SS-H2 and SS-V5ν0 algorithms, now using λ = 0.65 × λMAX. The plotting format is the same as in figure 1(a). The two input components are again detected with good accuracy by SS-H2 and SS-V5ν0, however SS-H2 needs a ~4.61 × longer run-time for the analysis. Finally, SS-V5ν0 has only one spurious solution, while SS-H2 has none. (c). A schematic layout of the distribution of the high-frequency (HF) magnetic sensors in the JET tokamak, i.e. those later used for the analyses reported in this (and its companion [20]) paper, together with a 3D folded view of the inner and the outer vessel structure. Different sets of HF magnetic sensors exist, for toroidal (the T-coils) and poloidal (the PP-coils) analyses, sitting on the inner (just a few, the I-coils) and the outer (most of them) vessel walls. Some of these sensors are positioned very close to each other to form a high-resolution array (the H-coils).

Standard image High-resolution image

In general, the SS-H2 algorithm performs impressively well, and this sets quite a high target for the performance of the SS-V5ν0 algorithm. In both cases the two input components are detected with good accuracy by SS-H2 and SS-V5ν0. However, SS-H2 needs a ~6.15 × and a ~4.61 × longer run-time for the analysis, respectively. With λREL = 0.15 there are numerous spurious solutions with SS-V5ν0 and only one with SS-H2, while SS-V5ν0 has only one and SS-H2 none with λREL = 0.65. Apart from the very clear improvement in the required CPU run-time, it is difficult to choose which algorithm performs best from just these two test cases, as the differences between SS-H2 and SS-V5ν0 could simply be linked to the input signal and the location of the sensors being different. Therefore a statistical analysis is mandatory.

Finally, by inspecting the value of one of the outputs of the algorithms, i.e. the actual number of iterations (=NIT) needed to obtain the solution, we find that in these two runs NIT(SS-V5ν0) = [23 (figure 1(a)), 19 (figure 1(b))], while NIT(SS-H2) = [130 (figure 1(a)), 82 (figure 1(b))]. This then correspondingly gives a ratio NIT(SS-H2)/NIT(SS-V5ν0) = [5.65 (figures 1(a)), 4.31 (figure 1(b))] which is close to the ratio in the required run-time. This result is similarly confirmed in all other analyses (for simulated and real data), and therefore we can state that the gain in computation time by SS-V5ν0 is essentially due to a much faster convergence, requiring significantly less iterations.

For illustrative purposes, figure 1(c) then shows a schematic layout of the distribution of the high-frequency (HF) magnetic probes in the JET tokamak, i.e. those later used for the analyses reported in this and its companion paper [20], together with a 3D folded view of the inner and the outer vessel structure. In the analysis reported here and in the companion paper [20], 11 magnetic sensors, not equi-spaced toroidally, were used with SS-V5 (all versions): these are the [T001, T002, H301(T003), H302, H303, H304, H305 (T004), T006, T007, T008, T009] sensors shown in this figure. Only 7 of these sensors were used in [21] with SS-H2: these were the [T001, H301(T003), H302, H303, H304, T007, T008] sensors. Not all input signals could be used with SS-H2, since they were characterised by somewhat different intrinsic errors and thus could not be assembled effectively as a unique input dataset.

3. Comparison between SS-H2 and SS-V5ν0

When using simulated data, the main difficulty when testing the performance of SS-V5ν0 versus that of SS-H2 is setting the measurement uncertainties, through the value of the parameters {σk, σl, δk, χ}. While for actual experimental measurements these are (or should be ...) well known, in our case of simulated data there is a certain degree of arbitrariness since we could use different estimates of the errors {σk, σl} and phase shifts {δk} with which we construct SIN(ϕk), and then correspondingly of σTOT = ∣SIN(ϕk)-S0(ϕk)∣/χ. This changes the penalization criterion for SS-V5ν0, first by the value of λMAX,V5 = O(λMAX,H2/σTOT 2λMAX,H2, and then by the complex shrinkage function Ψ, which is now scaled by ss2 = Σk1/σTOT(ϕk)2χ2 in SS-V5ν0. The difficulty of this comparison is compounded by the fact the numerous additional quantities can (and should) be varied to generate the input signal, and then to perform the SparSpec analyses. It is however clear that if we fix {σk, σl}∈[0 → 1]×0.15 (in relative units), {δk}∈[0 → 1] × π, NSIG = 35 (randomly spaced sensors), LMAX = 35, NCOMP = 1 → 5, FmaxS = 10 × LMAX, χ = 10, nIT = 1000, TRIT = 1 × 10–5 as constant parameters that will be always used in our simulations, then we only need to scan χ∈[1 → 10] and λREL∈[0 → 1].

Therefore, in our view the best approach is to run a very large number of simulations NITER = 10'000 for each value of NCOMP = 1 → 5 and for each selected combination of {χ, λREL}, so as to remove possible bias due to the different sensors' geometry and input spectrum used in each individual run. For clarity of presentation, in the following we will only show first the results for a fixed χ = 1 scanning λREL = [0.15, 0.35, 0.65], thus progressively penalizing additional output components for the same overall measurement uncertainties, and then for a fixed λREL = 0.35 scanning χ = [1, 3, 10], thus evaluating the correctness of the penalization criterion as function of progressively smaller overall measurement uncertainties.

3.1. Comparison between SS-H2 and SS-V5ν0: λREL scan at fixed χ = 1

The first tuneable quantity for the comparison between SS-H2 and SS-V5ν0 is the value of the λ-parameter used in the penalization criterion, which appears in the shrinkH2 and shrinkV5 functions described above. The λ-parameter, controlled by λREL as λ = λREL×λMAX, keeping a fixed λMAX, directly appears in the L1-norm penalization criterion, see equation (3b ): an higher λREL corresponds to less output components being sought, as the λ-penalization for adding a new solution is higher.

The summary results of this λREL scan at fixed χ = 1 are shown in figures 2(a)–(c) for λREL = [0.15, 0.35, 0.65], respectively. For clarity of representation, the CPU run-time for SS-H2 has been rescaled by a factor /4 in these (and similarly, but by a different factor in some cases, in all the other) figures. The relative number of faults is similarly small for both SS-H2 and SS-V5ν0, always O(0.04) at most even for NCOMP = 5, with a similar scatter, and increase with NCOMP, as should be expected. The error on the input/output energy conservation, which is directly linked to the number of faults, is also similarly small for both SS-H2 and SS-V5ν0, O(0.10) at most even for NCOMP = 5.

Figure 2.

Figure 2. (a). The summary results of the λREL scan at fixed χ = 1, for λREL = 0.15. The x-axis label increasing number of signal components indicates that 10'000 simulations are run for NCOMP = 1, then again 10'000 simulations are run for NCOMP = 2, and so on up to NCOMP = 5. We plot the RMS value of each quantity, the error bar then showing the STD, over all simulations for each value of NCOMP. The most important result is the very significant reduction is the average CPU run-time, typically at least 4 × shorter for SS-V5ν0 than for SS-H2. Furthermore, while for SS-V5ν0 the average CPU run-time remains practically constant and has a small scatter for increasing NCOMP, this increases with a progressively larger scatter for SS-H2. It is therefore clear that SS-V5ν0 out-performs SS-H2 in terms of speed for practically the same overall accuracy. (b). The summary results of the λREL scan at fixed χ = 1, for λREL = 0.35, using the same plotting format as in figure 2(a). The results are very similar to those obtained for λREL = 0.15: the overall accuracy (number of faults and the error on the input/output energy conservation) is marginally better for SS-H2 than for SS-V5ν0. Note that this figure also shows the first dataset for the χ scan at fixed λREL = 0.35, presented in figures 3(a), (b) for χ = 3 and χ = 10. (c). The summary results of the λREL scan at fixed χ = 1, for λREL = 0.65, using the same plotting format as in figure 2(a). The results are very similar to those obtained for λREL = 0.35: the overall accuracy (number of faults and the error on the input/output energy conservation) is marginally better for SS-H2 than for SS-V5ν0.

Standard image High-resolution image

Note however that for λREL = [0.35, 0.65] the overall accuracy (number of faults and the error on the input/output energy conservation) is marginally better for SS-H2 than for SS-V5ν0. The most important result is the very significant reduction in the average CPU run-time, typically at least 4 × shorter for SS-V5ν0 than for SS-H2 for λREL = 0.15 and 2 × shorter for λREL = [0.35, 0.65]. For NCOMP = 1 → 5, SS-V5ν0 typically needs ~1.6 msec for NCOMP = 1 → 5 for λREL = [0.15, 0.35, 0.65]. Furthermore, while the average CPU run-time remains practically constant and has a small scatter for SS-V5ν0 for an increasing value of NCOMP, for SS-H2 it increases with NCOMP and has a progressively larger scatter. It is therefore clear from this λREL-scan at fixed χ = 1 that SS-V5ν0 out-performs SS-H2 in terms of speed for practically the same overall accuracy.

3.2. Comparison between SS-H2 and SS-V5ν0: χ scan at fixed λREL = 0.35

The second tuneable quantity for the SS-V5ν0 algorithm, when using simulated data, is the overall weighting on the input signal, namely the variable ss2 = Σk1/σTOT(ϕk)2χ2. Changing the constant χ means assigning a higher or a lower error to our input signal: this error is directly linked to the dephasing of our sensors, which has two consequences. First, the weighting factor ss2∝χ2 for the SS-V5 normalization changes. Second, by increasing χ we similarly quadratically increase the expected error bounds for accepting a solution. It is difficult to predict a-priori how these two terms will play-out together. Keeping a fixed λREL = 0.35, we now change the arbitrary constant χ to be in the range 1 → 10. Note that ss2 does not appear in any form in the SS-H2 algorithm, which uses unweighted data, an unweighted spectral window, hence an unweighted penalization criterion.

The summary results of the χ scan, for χ = 3 and χ = 10 at fixed λREL = 0.35 are shown in figures 3(a), (b). Note that figure 2(b) shows the first dataset for this χ scan, with χ = 1. The results are very similar to those for the λREL scan at fixed χ = 1, presented in figure 2. Again, there is a very significant reduction is the average CPU run-time, typically at least 2 × shorter for SS-V5ν0 than for SS-H2. The overall accuracy is similarly good for both SS-H2 and SS-V5ν0, and decreases with the increasing χ, corresponding to lower overall measurement uncertainties and a larger weighting factor ss2. It is therefore clear that again SS-V5ν0 out-performs SS-H2 in terms of speed for practically the same overall accuracy also as function of ss2 = Σk1/σTOT(ϕk)2χ2.

4. An actual test case from the JET tokamak

We now consider an actual test case from the JET tokamak, using data acquired with the Alfvén Eigenmodes Active Diagnostic (AEAD) system [22]. This test case is #79215, as extracted from [21], where the results were obtained using the SS-H2 version of the SparSpec algorithm. Looking at figure 3 in this previous work, we notice that in a number of instances toroidal mode numbers ∣n∣≥10 appear to be detected for stable, antenna-driven AEs, as resolved using SS-H2. Since this, and all similar discharges used for that work, are purely ohmic plasmas without sources of fast ions capable of driving (or supporting antenna-driven) such high-∣n∣ modes, and the antenna drive is also very small for these modes, it is rather difficult to believe that these are correct solutions. One good test is therefore to check whether these likely spurious solutions are still present if SS-V5ν0 is applied to the same set of data. However, as previously and repeatedly stated, we want to stress that we do NOT believe this to be the most relevant test for the validity of SS-V5ν0, simply because for actual data we do not know a-priori what the results should be, and our intuition might be erroneous. Only with simulated data, when we know what the results of our calculations must be, we can really be confident of the improvements brought about by any piece of software, in our case by SS-V5ν0 versus SS-H2.

Figure 3.

Figure 3. (a). The summary results of the χ scan at fixed λREL = 0.35, for χ = 3, using the same plotting format as in figure 2. Note that the first figure for the χ scan at fixed λREL = 0.35 is figure 2(b), run with χ = 1. The results are very similar to those presented in figure 2. Again, there is a very significant reduction is the average CPU run-time, typically at least 4 × shorter for SS-V5ν0 than for SS-H2, while the overall accuracy is similarly good for both SS-H2 and SS-V5ν0. (b). The summary results of the χ scan at fixed λREL = 0.35, for χ = 10. The relative number of faults is slightly larger for larger χ, approximately 6% for χ = 10 compared to <5% for χ = 3 and <3% for χ = 1. Reducing the overall measurement uncertainties, thus increasing the penalization weights, implies that there must a closer match between the input and the output, which is more difficult to obtain, thus a slightly longer average CPU run-time and slightly more faults.

Standard image High-resolution image

Figure 4 shows the results of this comparison, where we look at the occurrence of mode numbers associated to each individual frequency resonance for which damping rate measurements can be extracted, comparing the results of figure 3 in [21] obtained with SS-H2, and the results now obtained using SS-V5ν0. Details on how the analysis is performed can be found in [1, 21]. For the errors on the synchronously detected magnetic ∣δBMEAS(ω,t)∣ and antenna current ∣IANT(ω,t)∣ measurements, producing the antenna-driven field ∣δBANT(ω,t)∣, used in SS-V5ν0, we consider those described in [23]. The relative uncertainty on the total normalized signal amplitude ∣δBMEAS(ω,t)/δBANT(ω,t)∣ is due to propagation of the errors on the raw input magnetic signals and the antenna current, and their respective frequency calibration and precision of the synchronous detection, and is estimated to be around ~35%. In the analysis reported here 11 magnetic sensors (refer to figure 1(c): these are the [T001, T002, H301(T003), H302, H303, H304, H305 (T004), T006, T007, T008, T009] HF sensors), not equi-spaced toroidally, were used, but only 7 were used in [21] (again refer to figure 1(c): these were the [T001, H301(T003), H302, H303, H304, T007, T008] HF sensors): not all input signals could be used with SS-H2, since they were characterised by somewhat different intrinsic errors and thus could not be assembled effectively as a unique input dataset.

Figure 4.

Figure 4. The toroidal spectral decomposition of individual, antenna-driven frequency resonances observed with the JET AEAD system for #79215 (see [1, 22] for further details). Comparing the results obtained with SS-H2 versus SS-V5ν0, in both instances using λREL = 0.35, we find that the RMS value over the measurement time window of the CPU run-time needed to perform the toroidal decomposition for each detected frequency resonance is ~346 μs for SS-V5ν0 and ~1.32 msec for SS-H2, i.e. around 4× longer.

Standard image High-resolution image

The typical total antenna current in this experiment was ~15A. Therefore, in principle antenna-driven toroidal mode numbers up to ∣n∣≤30 can be detected (as illustrated by the labels in figure 3 in [21]), i.e. they have a nominal signal-to-noise (S/N) ratio S/N > 5 when considering only the random and bit-noise errors (in the absence of any antenna drive) on the synchronously detected signals. When considering the actual measurement errors, as SS-V5ν0 does, we expect that only modes up to ∣n∣ = 10 with ∣δBMEAS(n)/IANT∣>10–4mG/A can be correctly detected. All other higher-∣n∣ modes and lower mode amplitudes are estimated to be below the S/N > 3 detection threshold when including correctly the measurement uncertainties, as SS-V5ν0 does.

Looking now at the results shown in figure 4, practically all mode numbers ∣n∣>12 and/or for which the resulting amplitude ∣δBMEAS(n)∣ < 10–3mG are removed if the analysis is performed using SS-V5ν0, thus essentially confirming our initial intuition on spurious solutions. These spurious solutions are most evidently found during the large frequency sweep of the antenna (but not solely nor always either, see for instance between t  =  10.5 s and t = 11.2 s), i.e. when the AEAD system has not found a well-defined resonance to be tracked in RT (see [1] for more details on this). When tracking occurs, i.e. when the antenna performs small RT frequency sweep around a well-defined resonance, for instance between t = 2.2 s and t = 3.8 s, and then again between t = 6.2 s and t = 10.0 s, most solutions are found with both SS-H2 and SS-V5ν0. The typical CPU run-time needed to perform the toroidal decomposition for each detected frequency resonance is ~350 μs for SS-V5ν0, and it is around 4 × longer for SS-H2. Although just indicative, since not as powerful in our opinion as the extensive set of tests that can be performed using simulated data, this example on actual data from the JET tokamak, and the additional one reported in [20], confirms the significant improvements in terms of accuracy and speed brought about by SS-V5ν0 versus SS-H2.

5. Summary and conclusions

This work starts from the analysis of the spatial periodicities of magnetic fluctuations in JET and TCV, where it was found that not all input signals could be used with the baseline version of the SparSpec algorithm, SS-H2, as they were characterised by somewhat different intrinsic errors and thus could not be assembled effectively as a unique input dataset. This then partially reduced the accuracy of the SS-H2 algorithm, as we indeed found that sometimes different results were obtained depending on which subset of input signals was used. In this work we have therefore compared, using mostly simulated data because we know what the answer must be, the performance of the SS-H2 versus the SS-V5ν0 algorithms. One test case is also run using actual magnetic data from the JET tokamak, and the results are in line with those obtained using simulated data. The development of SS-V5ν0 represents the first step towards the currently most advanced version of the SparSpec algorithm, SS-V5, which not only accounts for the measurement uncertainties but also uses a memory with relaxation scheme to further speed up the calculations. For clarity of presentation, the full version of the SS-V5 algorithm will be the subject of a separate, companion contribution [20].

When using an extensive set of simulated data, the main result from our work is that there is a significant improvement in the performance from SS-H2 to SS-V5ν0, both in terms of speed and overall accuracy. These improvements mainly come from correctly accounting for the measurement uncertainties. Additional sensors, with significantly different measurement uncertainties, can then be used by SS-V5ν0, and this also intrinsically improves the accuracy of the SparSpec algorithm. On simulated data, typically a factor at least 4× is gained in the average CPU run-time by SS-V5ν0 versus SS-H2 for an even slightly improved overall accuracy. While this is not an un-common result, it really shows the need of correctly introducing error tracking in the SparSpec code when implementing a memory with relaxation scheme. The results obtained on the test case run using actual data for the JET tokamak are in line with the simulations in terms of computational time, and confirms our initial intuition about the presence of spurious solutions in the dataset obtained with SS-H2.

Moreover, in our extensive tests using simulated data, we find that while for SS-V5ν0 the average CPU run-time remains practically constant, in the range from ~[370 ± 10]μs to ~[400 ± 10]μs and has a small scatter for an increasing value of input signal components, for SS-H2 it increases from ~[1.5 ± 0.1]msec for NCOMP = 1 to ~[2.0 ± 0.2]msec for NCOMP = 5, with a progressively larger scatter. The relative number of faults is slightly larger for an increasing error weighting in the penalization criterion, for both SS-V5ν0 and SS-H2. This occurs even if the related ss2 parameter does not appear in any form in SS-H2: SS-V5ν0 correctly weights the input signal, the spectral window and the penalization criterion with respect to the (simulated, in this case) measurement uncertainties, and this proves to be much faster, not only more accurate, than using an unweighted data set and thus a correspondingly unweighted penalization criterion. Finally, we have confirmed that the gain in speed between SS-V5ν0 and SS-H2 is indeed essentially due to a much faster convergence.

Acknowledgments

This work has been carried out within the framework of the EUROfusion Consortium and has received funding from the Euratom research and training programme 2014–2018 and 2019–2020 under grant agreement No 633053. The views and opinions expressed herein do not necessarily reflect those of the European Commission. This work was also partly supported by the Swiss National Science Foundation. Finally, we would like to thank the Reviewer for his/her useful comments and suggestions to the first draft of this article.

Data availability statement

The data generated and/or analysed during the current study are not publicly available for legal/ethical reasons but are available from the corresponding author on reasonable request.

Footnotes

  • [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)].

  • 4  

    The acronym SS-V5ν0 is used here for consistency with the companion work [20] presenting the results of including the MwR scheme in SparSpec: ν is the parameter defining the primary memory scheme, and thus SS-V5ν0 is the version of the SparSpec-V5 algorithm which uses the error weighting but runs without the memory, ν = 0.

  • 5  

    Note that since this is the first of a two-part companion work, in [20] we will not duplicate the general description of the SparSpec algorithm, but simply refer to that given here.

  • 6  

    Note that here we will always use in the text the notation [x] to designate a vector x, the notation [[x]] to designate a matrix x and the notation {x} to designate an ensemble of elements x.

  • 7  

    A Toeplitz matrix satisfies the condition ([[W]H[[W]])l,p = Ω((p-l)fMAX/L), where Ω(f) = (1/L)Σkexp(ifϕk) and L is the total number of k-components. Essentially, Toeplitz matrices are constant diagonal matrices.

  • 8  

    As we consider only the spatial decomposition, our input measured signal corresponds in fact to the temporal Fourier Transform, at any one specified frequency up to the Nyquist value fs = 1/(2τs), of the raw real-valued voltage signal that is actually acquired by the probes at the sampling time τs.

  • 9  

    Naturally, the case χ<1 would correspond to having under-estimated the measurement uncertainties, and therefore it is not unphysical per se: however, for simplicity we start from the hypothesis that we have correctly estimated all relevant σ's, and therefore χ<1 becomes unphysical in such case.

  • 10  

    Refer to equation (4) for the nomenclature: since the instrumental error σk and the phase delay δk are randomized for each sensor, and the error σl in the determination of the Fourier coefficients is also similarly randomized for each signal component, even with an unique value of χ all the σTOT(ϕk) are actually different.

  • 11  

    The webpage http://userpages.irap.omp.eu/~hcarfantan/SparSpec1.4/SparSpec_html.html#SectExample2 contains a more extensive explanation on this with a numerical example.

  • 12  

    We choose to directly relate the accuracy (or lack of) to the number of faults that have been made by the minimization routine, the faults being the number of mismatching components (in both directions) between the true vector and the one resulting from the minimization procedure: clearly, the higher the number of mismatches in the components, the lower the accuracy.

  • 13  

    Note that the CPU run-time for similar analyses can be rather different with respect to the companion paper [20] since a different and more performing laptop was used, with no additional services running, as the overall run-time for the 10'000 simulations was becoming excessive and too constraining on the platform used for [20].

Please wait… references are loading.
10.1088/2516-1067/abf946