### 3.1 Spectral energy, spectral peak, and TF entropy

The spectra of valid and faulty electrodes are given by the discrete Fourier transform of the signal *x*_{n}[*p*], being the resistance fluctuations of one Corkscrew electrode’s tip, *n*=1:1:*N*, with parameters reported in Section 2. Figure 2a and b show the energy spectral densities of the resistance fluctuations of the Corkscrew electrodes provided by the measurement setup presented previously. It can be seen that no significant difference between the energy spectral densities of valid and faulty electrodes can be observed. Thus, an alternative approach has been considered, based on the analysis of the electrodes response to an intentionally added low-energy stationary component.

It has been observed that stationary components in the resistance fluctuations can occur as results of non-filtered network harmonics. Figure 2c shows the spectral response of one valid, while Fig.2d of one faulty electrode. The addition of a stationary component is manifested as a prominent peak around 250 Hz in the signal energy spectral density. The addition of a stationary signal component evokes the possibility of considering an approach aimed to detect the presence of a deterministic signal in a noisy environment by means of the signal’s energy [8–11]. In cited work the presence or absence of a deterministic signal in a noisy environment assessment is based on the energy of the observed signal: relying on a certain threshold [8–11] on the signal energy, the presence of a deterministic signal is confirmed or denied. Figure 3a shows the energies of signals with stationary component of the valid and faulty electrodes (each set consists of *N*=7 measured electrodes labelled by the manufacturer as either faulty or valid, determined by the appearance of cold solder). It can be noticed that for both sets very similar results are obtained, showing the unsuitability of energy detection for classification purposes for the presented process. Figure 3b reports the maximal values, at the stationary component’s frequency, of the energy spectral density for valid and faulty electrodes, indicating that valid electrodes tend to better preserve the component peak. However, cases when opposite responses are obtained are not rare, which motivated the search for a more reliable discrimination criterion. Figure 3c shows global entropy values for measured electrodes.

This research suggests that classic spectral analysis is not adequate for the distinction of valid from faulty electrode’s signals. An alternative representation of the measured signals is provided by the time-frequency (TF) signal representation. Time-frequency signal representations represent a versatile tool for signal analysis and, in the past few decades, has been applied to a wide range of engineering applications [12–18]. The discrete Quadratic time-frequency distribution (TFD) of an analytic signal *z*[*p*] can be written as [19]:

$$\begin{array}{@{}rcl@{}} \rho[p,m]=\underset{l \rightarrow m}{\text{DFT}}\{G[p,l]\underset{n}{*}(z[p+l]z^{*}[p-l])\};l\in \langle L \rangle \end{array} $$

(1)

where *G*[*p*,*l*] represents the time-lag kernel. One of the most routinely used time-frequency distributions is the spectrogram, obtained as the squared magnitude of the Fourier transform over a short analyzing window *w*(*p*) [19–21]. The spectrogram is thus characterized by the time-lag kernel [19]

$$\begin{array}{@{}rcl@{}} G[p,l]=w[p+l]w[p-l]. \end{array} $$

(2)

Due to its realness, strict positivity, and absence of interferences in the case of non-overlapping components, the spectrogram provides a simple and reliable interpretation of the signal structure in the joint TF domain. Spectrograms of the measured signals, obtained using Hamming window of duration T/10, where T is the number of signal samples, are shown in Figs. 4a and 5a. In an attempt to find a suitable criterion for the development of an expert system for assessment of electrodes’ validity, the spectrogram complexity has been estimated by the spectrogram’s Rényi entropy. The generalized Rényi entropy reads [22]

$$\begin{array}{@{}rcl@{}} H_{\alpha}(\rho[p,m]):=\frac{1}{1-\alpha}\log_{2} \sum\displaylimits_{P}\sum\displaylimits_{M}\bigg(\frac{\rho[p,m]}{\sum\displaylimits_{P}\sum\displaylimits_{M}\rho[p,m]} \bigg)^{\alpha} \end{array} $$

(3)

where *α* is the order of the Rényi entropy (in this paper the value of *α*=3 has been adopted [23, 24]). Since the TF Rényi entropy is an estimator of the TFD complexity, disorder, and information content, intuitively it can be expected that signals with lower SNRs will generally present larger entropy values [25, 26], which can be exploited as a discrimination criterion for validity electrodes’ assessment [27]. However, the obtained results show tendency of valid electrode to preserve a more concentrated TF structure, and thus smaller entropy values, even if this appears to be quite an unstable indicator, Fig. 3c.

### 3.2 The criterion based on deterministic signal’s continuity

Since it is known that signal components, as opposed to the noise, are continuous energy regions in the TF plane [28, 29], we have proceeded in the search for a robust and reliable method for automatic electrodes’ validity assessment by focusing on observation of the components continuity in TF domain, by assuming that lower SNR will cause oscillations in the component amplitude, degrading its continuity. Thus, the proposed method for distinction of faulty from valid electrodes, which can be generally applied to problems of assessing small differences in SNR in as set of measurements, estimates the continuity of the signal component in the TF plane.

The first step of the proposed method consists of denoising the spectrogram *ρ*_{n}(*p*,*m*) of each signal *z*_{n}(*p*) using a K-means-based algorithm as described in sequel [27, 30, 31]. The denoising procedure relies on the fact that an amplitude discrimination of data in a TFD can be performed by the K-means algorithm [30]. Considering the set of observations *C*_{n}={*ρ*_{n}(*p*,*m*)| *p*=1,...,*P*, *m*=1,...,*M*}, the K-means algorithm partitions these *P* × *M* observations into *K* subsets

$$\begin{array}{@{}rcl@{}} C_{n}=\{C_{n,k} | k \in \mathbb{N}, \hspace{0.1 cm} 1\leq k \leq K\}, \end{array} $$

(4)

in order to minimize the within-cluster sum of squares, with the minimal sum:

$$\begin{array}{@{}rcl@{}} \underset{C_{n}} {\text{argmin}} ~{\sum_{k=1}^{K} \sum_{\rho_{n}(p,m) \in C_{n,k}}^{}\| \rho_{n}(p,m)-\mu_{n,k} \|^{2}}, \end{array} $$

(5)

where *μ*_{n,k} is the mean of each set *C*_{n,k}.

Thus, *K* classes \(\rho _{n,k}(p,m), k \in \mathbb {N}, \hspace {0.1 cm} 1\leq k \leq K\), derived from the TFD *ρ*_{n}(*p*,*m*), are obtained as

$$\begin{array}{@{}rcl@{}} \rho_{n,k}(p,m)=\left\{ \begin{array}{cc} \rho_{n} (p,m), & \text{if} \hspace{0.1 cm}\rho_{n} (p,m) \in C_{n,k} \\ 0, & \text{elsewhere}. \end{array}\right. \end{array} $$

(6)

Results presented in this paper are obtained by the pre-processing K-means algorithm computed using the parameter *K*=5.

Classes containing mainly noise will present significantly larger time-frequency supports and smaller coefficients, when compared to classes containing useful information (since noise is flat in the TF plane while components are prominent ridges) [32]. Thus, it is reasonable to expect that data originated from the signal component will be predominant in the classes marked by higher values of the parameter *k*, while smaller values of *k* will mark classes containing mainly noise-originated data. In the light of the above, the denoising procedure is performed by discarding all classes but the one marked by the largest value of the parameter *k* (*k*=*K*). Data contained in *ρ*_{n,K}[ *p*,*m*] are assumed to be output of a strict denoising procedure, simplifying the assessment of the component’s continuity.

Next, a narrow frequency bandwidth of the TF plane of *ρ*_{n,K}[*p*,*m*], around the stationary components’ frequency, is analyzed to determine the component’s continuity by connected components labeling in a binary image (2D). Connected-component labeling or region extraction is an algorithmic application of graph theory, where subsets of a given data set are uniquely labeled based on predefined conditions [33]. The algorithm returns a matrix of the same size as the input matrix *ρ*_{n,K}[*p*,*m*], containing labels for the connected components which are then used to extract relevant information from the input *ρ*_{n,K}[*p*,*m*]. Each individual separated set of data in the TFD is given a unique label, in a form of a matrix mask, which enables the component extraction procedure. The continuity is quantified through the size (length) of the clusters the stationary component is composed of, where the longest cluster is considered as a measure of the electrodes’ validity. After a narrow frequency band around the stationary component has been designated, the cluster length *L*_{max}(*n*) is determined as the maximal number of consequent (neighboring) non-zero coefficients scanning in the time axis direction.

In Figs. 4b and 5b it can be seen that the component is preserved better in the case of higher SNR (valid electrode), presenting a continuous energy ridge in the TF plane, unlike in the case of lower SNR (faulty electrode), where the component energy appears broken and uneven inside its bandwidth.