Problems of Selecting the Wavelet Transform Parameters in the Aspect of Surface Texture Analysis

: This paper discusses one of the most important problems related to analysis of surface texture using wavelet analysis - the problem of selection of mother wavelet and decomposition level. The literature related to wavelet transform does not explicitly determine which mother wavelet is most suitable for surface profile analysis and at which level of decomposition this analysis should be performed. The paper describes the criteria of selection of the mother wavelet from the aspect of analysis of two- dimensional surface texture. Details of the algorithms are also included. The calculations were performed on the 3D roughness profiles. The evaluation was based on five selection criteria: autocorrelation test, Pearson correlation, evaluation of 3D roughness parameters, Hotelling test and entropy-based method. The calculations were performed in authorial computer procedures coded in MATLAB software.


INTRODUCTION
The real surface of the machine parts created during the machining process is not the same as the ideal theoretical surface. Some deviations can be observed on it. They are a combination of periodic and non-periodic irregularities that have been created as a result of numerous machining errors. These irregularities can be divided into three groups: form errors, waviness and surface roughness. Form errors are caused by the lack of stiffness of the machine, vibrations of the machine with low frequencies or by thermal expansion of elements manufactured both conventionally and unconventionally. The waviness is mainly created as a result of vibrations at higher frequencies than in the case of form errors, while the surface roughness is defined as periodic or non-periodic irregularities caused by vibrations at the highest possible frequencies. Furthermore, the surface roughness depends on the machining parameters, the type of material, the cutting fluid, the shape of the cutting insert or the built up edge [1][2][3][4].
There are many methods of filtration of the surface texture e.g. using probe with specified tip radius, using analog or digital filters, or analyzing distance between irregularities. However, the most commonly used is electrical filtration based on the Gaussian filter. For this analysis, filters with a specific cut-off length are used. During the analysis, the profile is filtered using two filters: the high pass filter and the low pass filter. The high-pass filter suppresses components of form and waviness of the surface. Thus, the obtained signal is surface roughness. The low-pass filter plays a similar role. It suppresses the components related to the roughness and it separates the low-frequency components.
The development of science and technology caused that the new methods of surface texture filtration were proposed [5][6][7]. The wavelet analysis which was developed at the end of the 20th century fits on these realities. Similarly as in Gaussian filtration, the idea of signal analysis using a two-dimensional wavelet transform is based on the using two filters: high-pass and low-pass, in the x and y directions. The process of signal analysis using a two-dimensional discrete wavelet transform leads, at each decomposition level, to its division into four other signals -an approximated signal and signals of horizontal, vertical and diagonal details. The approximated signal refers to low-frequency information, while the details describe high-frequency information. An undoubted advantage of using a wavelet transform to the surface texture filtration is the fact that application of the wavelet filter allows to obtain better filtration results due to sharper transmission characteristic of the filter, when comparing it to the Gaussian filter [8].
Wavelet transform is more and more often used to analyze 3D surface texture. Many researchers use wavelet analysis to diagnose the surface [9][10][11][12][13], characterize it [14][15][16][17], or divide 2D and 3D profiles into constituents [18,19]. However, it is problematic to determine the parameters of the wavelet transformation. Analyzing the current state-ofart it can be noted that there is no unambiguous recommendation of which mother wavelet should be used to analyze the surface texture and to which level of decomposition this analysis should be carried out. However, there are some statistical tests related to this issue in the aspect of using wavelet functions in the filtration of 2D profiles [20]. In this paper authors propose statistical tests which refer to filtration of 3D surface texture. The second chapter of the paper presents the methodology for applying these statistical tests, i.e. spatial autocorrelation, Pearson correlation, entropy-based method, analysis of the surface roughness parameters and Hotelling T 2 test. The research results are discussed in chapter three and the conclusions are presented in chapter four.

METHODOLOGY FOR SELECTION OF MOTHER WAVELETS
Wavelet transform uses a wide range of mother wavelets. Each group of wavelets has different properties and the appropriate wavelet choice is important for further signal analysis. Various mother wavelets can be successfully used for surface texture analysis. However, the results obtained for a particular mother wavelet at subsequent levels of decomposition are significantly different from each other. The selection of the mother wavelet, which should be used in the analysis of the signal, can be made based on the statistical tests. Inappropriate selection will cause that the approximated signal will be dominated by the properties of the mother wavelet itself, losing its character [21]. Therefore, an important issue is the analysis of input data, i.e. mother wavelet, level of decomposition, signal properties such as horizontal sampling density [22], as well as properties of wavelets such as the edge effect which is created as a result of the analysis [22].
The samples were made of C45 steel. The face milling process was carried out with the specified cutting parameters on the vertical machining center AVIA VMC800. The machining parameters of the face milling process were: cutting depth a p = 0.1; 0.5; 1; 2 mm, feed per tooth f z = 0.1; 0.14; 0.18; 0.22 mm/tooth and cutting speed v c = 200; 250; 300; 350 m/min. As a result the sixty-four samples were obtained. The 3D surface texture measurement was carried out using a Talysurf CCI.
The paper presents research results for one selected sample in detail (sample No. 8). For this sample cutting process was carried out with the parameters a p = 2 mm, f z = 0.14 mm/tooth, v c = 200 m/min. The isometric view of the surface is shown in Fig. 1. In addition, the results of the analysis for all sixty-four samples were presented at the ends of sub-chapters.

Spatial Autocorrelation
This test allows us to determine whether the details contain any significant information on the analyzed signal or whether the details should be treated as a sequence of independent variables, i.e. white noise. The application possibilities of particular mother wavelet in the analysis can be verified using Moran's statistics. If it is found that there is spatial autocorrelation between the values it should be stated that the mother wavelet used in the analysis is not suitable for analyzing this particular 3D profile.
To perform a statistical analysis of spatial autocorrelation of surface deviations, it is advisable to create a weight matrix Eq. (1) of the intensity of interaction between measurement points, calculated on the basis of distance between particular points Eq. (2) [23]. where: x i , y i -i-th point coordinates, x j , y j -j-th point coordinates, k -factor (k ≥ 1), assuming for d ij = 0 the value w ij = 0.
The spatial autocorrelation coefficient value is calculated using Eq. (3) [21]: where: n -the number of measuring points, z i , z j -deviation at the measurement point -i, j, z -arithmetic mean of geometric deviations.
To determine whether there is spatial correlation between the values, at the assumed significance level, the null hypothesis of no spatial autocorrelation should be verified. For this purpose the statistic Z Eq. (5) is calculated, taking into account the expected value Eq. (6) and variances Eq. (7). If Z < Zα there is no reason to reject the null hypothesis [23].

Pearson Correlation
The application of the Pearson correlation test is based on the assumption that the value of the correlation coefficient of two 3D profiles (primary and approximated), at the particular level of decomposition, will reach higher value in case of better coincidence between the mother wavelet and the profile irregularities.
To assess the correlation the classification according to J. Guilford was used.

Entropy-Based Method
The entropy-based method is used in the case of signal analysis using wavelet packet transform. Two-dimensional wavelet analysis is based on the assumption that only approximated signal is decomposed. The application of wavelet packages in analysis means that at each level of analysis, not only the approximated signal but also horizontal, vertical and diagonal details are decomposed.
To determine the maximum level of decomposition, the Shannon entropy indicator for a two-dimensional signal was calculated based on the Eq. (10), where ln(0) = 0: where: z ij -deviation at the measurement point (i, j).
In addition, to determine the mother wavelet which is the most suitable for analysis, it is advisable to verify whether the decomposition tree is different from the optimal tree in which only the approximated signals are decomposed. It should be assumed that the optimal tree will be created only for wavelets, which should be used in the analysis, because relevant information is only in approximated signals.

Surface Roughness Parameters
In the approximation process, at each subsequent level of analysis, the primary signal is increasingly smooth. Therefore, the values of parameters are also changed. The analysis was carried out to determine the maximum level of decomposition until which the primary signal and the approximated signal do not significantly differ. For this purpose, the dependence of the relative change of the values of selected surface roughness parameters was used Eq. (11). It was selected eight parameters of 3D roughness: where: Δx -the absolute value of the difference between the primary value and the value obtained at selected level of decomposition, calculated for each parameter, x -value calculated for the primary signal.

Hotelling T 2 Test
The last of the statistical tests which can be used to select the mother wavelet for the 3D profile analysis is Hotelling's T 2 test. This test is a generalization of t-student statistic for the multidimensional space. In order to perform a comparative analysis the assumptions about independence, multidimensional normality of the distributions populations and the homogeneity of the covariance matrix should be taken into account.
For the analysis of the covariance matrix, the Bartlett test can be used. The value of the L statistic Eq. (12) is compared to the critical value of the distribution χ 2 at the assumed level of significance α. The covariance matrix is not homogeneous when the dependency (15) is satisfied [24,25].
As a result of measurement of the surface texture was obtained a set of points distributed over the surface in the form of a regular grid of points (n 1 × p). An analogous matrix was obtained at subsequent levels of analysis (n 2 × p). The covariance matrix was created according to the dependence (16): If it is determined that the covariances of both matrices are homogeneous, the Hotelling's test is calculated using Eq. (17), taking into account dependence (18). Otherwise, it should be modified using dependence (19) [24,25].
Hotelling statistics must be converted to Snedecor distribution using the Eq. (20). The obtained value was compared with the critical value. When the calculated value is higher than the critical value at the significance level, it should be noted that 3D surfaces are significantly different from each other, Eq. (21) [24,25]:

EXPERIMENTAL RESULTS
In order to carry out the research, authorial computer procedures coded in MATLAB software were developed to simplify the selection of the mother wavelet and to determine the level of decomposition at which analysis can be carried out without significant loss of character of the surface texture.
For each surface texture a decomposition process was carried out using discrete two-dimensional wavelet transform. Signal analysis was carried out to the sixth level of decomposition. There were used six mother wavelets: db10, db15, db20, coif5, sym10, bior6. 8  Analyzing the results presented in Tab. 1, it can be concluded that at each subsequent stage of wavelet decomposition, the signal coefficients are getting less and less correlated. The maximum level of decomposition, to which an almost full correlation exists between signals, varies depending on the mother wavelet (from the second to the fifth level). However, analyzing the research results globally (for all mother wavelets) it should be noted that the Pearson correlation coefficient obtained at the third level reached the satisfactory values.
The analysis performed for sixty-four samples showed that the Pearson correlation coefficient value, at the subsequent decomposition level, is slightly different depending on the sample. The almost full correlation is reached only until the third level of decomposition for 73.44% of samples and for 26.56% of samples until the fourth level of wavelet decomposition. In addition, it should be noted that for the mother wavelets bior6.8 and db10 the highest values of the Pearson correlation coefficient were reached.
The comparative analysis was also carried out using the Hotelling statistical test. In Tab. 2 are presented the calculations results of the Snedecor distribution which were calculated using Hotelling statistics and the Eq. Based on the obtained results, it can be concluded that the surfaces are not significantly different from each other until the third level of decomposition. The values of the Hotelling T 2 test for the surface texture and approximated signals for all mother wavelets reached values lower than the critical value at this level. At the subsequent levels of decomposition, the value of the Hotelling test coefficient reached increasingly high values. This undoubtedly shows that the surface texture, during the process of two-dimensional wavelet decomposition, was increasingly changed in character.
The analysis of the research results of all sixty-four samples using the Hotelling T 2 test allows to state that in 48.44% of cases the maximum level of decomposition was determined at the second or third level, while for 3.12% samples at the fourth level. However, in the case of samples for which the maximum level of decomposition was defined at the second level, the values of the Hotelling coefficient at the third level of the analysis were only marginally higher than the critical value.
An important issue during the wavelet filtration process is to determine whether the detail signals do not contain relevant information about the primary signal. For 3D signals Moran's statistics can be successfully used (spatial autocorrelation) as well as the procedure based on the entropy. The entropy indicator was calculated for subsequent nodes during wavelet packet decomposition.
Statistical analysis of spatial autocorrelation of the coefficients of the detail signals was verified in the aspect whether these signals can be treated as a sequence of independent variables. The tests were carried out at the significance level α = 0.01, assuming k = 3 Eq. (1). The critical value was equal to Z α = 2.34. The results showed that for all samples the obtained value of the Z statistic allows to state that in the detail signals (vertical, horizontal and diagonal) there is no relevant information about the analyzed surface texture and particular mother wavelet can be used in the process of two-dimensional wavelet decomposition.
Another test used for the selection of the mother wavelet was the test based on Shannon entropy value. The worked out computer procedures coded in MATLAB software allowed performing two-dimensional packet wavelet transform and determining the value of the Shannon entropy indicator in subsequent decomposition nodes. The program carried out the analysis process until the decomposition level at which the sum of entropy values in decomposed nodes was higher than the entropy value in the node which was decomposed. The program also checked whether the resulting tree can be considered as the optimal decomposition tree. Tab. 4 presents the results of calculations of the maximum level of wavelet decomposition based on the values of Shannon entropy. Table 4 The maximum level of decomposition -entropy-based method mother wavelet db10 db15 db20 level of decomposition 4 3 3 mother wavelet coif5 sym10 bior6.8 level of decomposition 3 3 4 After analyzing the obtained results, it should be stated that for most mother wavelets, the third level of decomposition was determined as the maximum. In addition, it should be noted that the highest test values were obtained for mother wavelets db10 and bior6.8.
The last statistical test refers to the evaluation of the variability of selected 3D surface roughness parameters at subsequent level of decomposition. Signal analysis was carried out to the fifth level of decomposition. For each approximated signal, the values of selected surface roughness parameters were calculated. Then, the relative difference between this value and the value determined for the primary surface was calculated. It was assumed that the signal does not differ significantly from the surface roughness signal in the case when the relative difference of the surface roughness parameters does not exceed 10%. Tabs. 5 to 12 present the results of the analysis carried out for the selected height parameters.  After analyzing the data presented in the above tables, it should be noted that at subsequent levels of wavelet decomposition, the values of individual parameters are getting lower values. Both for the parameter defining the mean arithmetic height of deviations and the root mean square height of the surface deviation, it has been noted that their values change slightly at the first four levels of decomposition. The fact of smoothing the surface during the decomposition process was also verified by the S ku parameter, which defines the kurtosis. At subsequent level of analysis, the number of sharp, high peaks and valleys decrease, so the character of surface texture also changes. For a surface for which the height distribution is normal (sharp portions and indented portions co-exist) the parameter value is equal to three. If the value is lower than three the eighth distribution is skewed above the mean plane; if the values are higher the height distribution is spiked. The last parameter from the group of height parameters was the parameter defining the maximum height of the surface (S z ).
The obtained values change in an ambiguous manner depending on the mother wavelet. At the subsequent levels of decomposition, the roughness parameter value (S ku ) increases and decreases. It can therefore be assumed that up to the fifth level, both signals do not differ significantly.
In Tabs. 13 to 16, the results of the calculations for the two spatial parameters are presented. For both spatial parameters, analogous values of δ coefficient were obtained. On the first four levels of analysis, both the parameter defining the auto-correlation length and the parameter defining the texture aspect ratio reach values slightly different from the value calculated for the primary surface. On the fifth level of the analysis, a sudden change in the parameter value was noted. Indicator δ reached a value higher than 30%.
The next group of parameters were hybrid parameters. The parameter S dq (root mean square gradient) was selected. The results shown in Tab. 18 show that the parameter value at subsequent levels of analysis changes significantly. The assumed critical value was exceeded at the second level of decomposition.
The last parameter was V mc parameter from the group of functional volume parameters. The V mc defines the core material volume. Tab. 19 and Tab. 20 present the results obtained for this parameter. The obtained values allow to state that the parameter value decreases at each subsequent stage of the analysis. The relative change in the parameter value does not exceed the adopted critical value for at least fourth decomposition level.
Based on the research results for sample No. 8, it should be stated that only for the hybrid parameter S dq , there is a significant change in the parameter value, on the initial levels of the two-dimensional wavelet decomposition. For the other selected parameters, it can be assumed that the fourth level is the maximum level to which surface analysis can be performed without significant change of the parameters.
After analyzing the results obtained for all sixty-four samples, it can be noticed that the relative change in the parameter value depends on the machining process parameters only marginally. Similar results were obtained for all samples. When analyzing the results, the key issue is the wide view of the obtained values. It is necessary to analyze not only the value of the δ indicator, but also to analyze whether the character of the signal is significantly different. To describe the surface texture parameters are used for which in a certain range, despite the values being quantitatively different, it cannot be concluded that the character of the signal is significantly different. An example of such a parameter is, among others, the parameter S tr (texture aspect ratio). S tr has a range from 0 to 1, and normally S tr > 0.5 indicates strong isotropy, while S tr < 0.3 indicates strong anisotropy. Therefore it is important to analyze research results in a quantitative and qualitative way. Analysis of variability of surface roughness parameters showed that the maximum level can be determined as the third for 9.38% of samples or fourth for 90.62% of the samples.
The research results showed that it is possible to apply many statistical methods to evaluate the variability of signals during the wavelet decomposition process. The analysis of all sixty-four samples showed that for individual mother wavelets different results were obtained depending on the statistical test. However, often the results obtained are similar to each other. The results obtained for all the statistical tests are summarized in Tab. 21. The table  contains values which define the percentage of samples which satisfied the criterion.

CONCLUSIONS
The research results have shown that there are many statistical methods which can be used to select mother wavelet and to determine maximum level of decomposition to which two-dimensional wavelet analysis can be performed without a significant change of character of the primary surface. Surface texture of samples was characterized by varying degrees of irregularity; therefore some tests were less sensitive to change surface texture during the decomposition process. It was estimated that the maximum level of decomposition ranges from the second to the fourth.
The analysis of spatial autocorrelation carried out in order to estimate whether the filtration process does not remove relevant information from the signal showed that such information does not occur; the signals should be treated as white noise. An analogous assessment was also carried out using the entropy-based method. Such analysis allowed identifying mother wavelets db10 and bior6.8 as wavelets which give the best results.
The Pearson correlation coefficient for individual samples and mother wavelets changes its value with different intensity. Nevertheless, for the majority of cases, similar values were obtained.
The variability of the values of 3D surface roughness parameters during wavelet decomposition was assessed in the paper. Analyzing the obtained results, it should be stated that the decomposition process, at the initial levels, does not cause a significant change in all parameters values. The exception is the parameter S dq (root mean square gradient), for which sudden changes of values have been obtained. NOMENCLATURE a p cutting depth bior6.8 mother wavelet Biorthogonal -order 6.8 coif5 mother wavelet Coiflet-order 5 db10 mother wavelet Daubechies -order 10 db15 mother wavelet Daubechies -order 15 db20 mother wavelet Daubechies -order 20 E Shannon entropy E(I) expected value F Snedecor test f z feed per tooth I Moran statistics k factor n the number of measuring points S a arithmetical mean height S al auto-correlation length S dq root mean square gradient S ku kurtosis S tr texture aspect ratio S q root mean square height sym10 mother wavelet Symlet -order 10 S z maximum height T 2 Hotelling's T 2 test v c cutting speed V mc core material volume w ij weight matrix var(I) variance Δx the absolute value of the difference between the primary value and the value obtained at selected level of decomposition, calculated for each parameter, x value calculated for the primary signal x i , y i i-th point coordinates, z i , z j deviation at the measurement point -i, j z arithmetic mean of geometric deviations α significance level δ relative error χ 2 chi-squared test Σ covariance matrix