Skip Content
You are currently on the new version of our website. Access the old version .
Applied SciencesApplied Sciences
  • Article
  • Open Access

13 January 2023

Robust Full-Screen Wavelength Calibration Algorithm

,
,
,
,
,
,
and
1
School of Mathematics and Statistics, Xi’an Jiaotong University, Xi’an 710049, China
2
Optical Metrology Laboratory, Xi’an Institute of Applied Optics, Xi’an 710065, China
3
Optical School of Optics and Photonics, Beijing Institute of Technology, Beijing 100081, China
*
Author to whom correspondence should be addressed.
This article belongs to the Section Optics and Lasers

Abstract

In spectrometer measurement, it is very important to accurately calibrate the wavelength of all target characteristic spectra. Although wavelength calibration methods have long been investigated, no techniques have been designed for the scanning, double-layer, secondary diffraction, linear-array CCD spectrometer, to the best of our knowledge. Based on the grating diffraction equation and experimental results, a mathematical model of wavelength calibration was established for the scanning, double-layer, secondary diffraction, linear-array CCD spectrometer. In this study, a robust, full-screen, wavelength calibration algorithm is proposed, based on the related working principle and the requirements of both accuracy and robustness. The detailed steps are as follows. First, we established a wavelength calibration model at central pixels, following the grating diffraction equation. Then, according to the relationship between the difference in pixels and the feedback values of the grating ruler, a model was established to show the association between these factors. Finally, we combined the two models and built a full-screen wavelength calibration model. We theoretically and experimentally demonstrate that the proposed calibration algorithm is an excellent calibration tool, which can conveniently and accurately calibrate the wavelengths of central and non-central pixels at the same time.

1. Introduction

The spectroscopy applications of spectral analysis methods have been widely used in physics, chemistry, metallurgy, agriculture, environmental protection, building materials, and medicine and health departments. The grating spectrometer is an instrument that uses a beam-splitting element grating to decompose incident composite light into monochromatic light with a narrow spectra [1]. If matched with the corresponding light source and receiving system, the corresponding spectrometer can be formed, which can carry out a spectral analysis of the composite light source. In the meantime, a qualitative and quantitative analysis of transparent substances and solutions can be conducted [2]. The wavelength accuracy refers to the degree of conformity between the wavelength displayed by the instrument and the wavelength of monochromatic light output by the splitting system. The wavelength accuracy is an important metric by which to evaluate the performance of spectrometers. Considering the wavelength accuracy and wavelength repeated-measurement accuracy of the existing near-infrared (NIR) spectrometers, we set the wavelength accuracy of our spectrometer to ±0.05 nm, and the wavelength repeated-measurement accuracy to 0.005 nm. Due to the influence of many factors, such as inherent instrument error and operation mistakes, the wavelength accuracy often cannot meet the applications’ requirements. Therefore, the calibration of grating spectrometers is an indispensable process [3].
Many calibration methods have been developed for the calibration of NIR spectrometers. The polynomial is often used as the fitting curve in the wavelength calibration of central pixels, which can ensure accuracy near the fitting points, but there may be a large gap in the accuracy of the other points [4]. Zhang et al. [5] proposed a simple, laser, wavelength calibration technique based on the second harmonic signals to improve the performance of a quartz-enhanced photoacoustic spectroscopy (QEPAS) gas-sensing system. Sun et al. [6] employed the peak method and gravity method to calibrate the wavelength of the prism-grating imaging spectrometer. This work shows that the difference between the two calibration results is within 0.3 nm. The gravity method was found to be insensitive to spot energy mutations, and can effectively improve the efficiency and accuracy of wavelength calibration. Moreover, some researchers also proposed wavelength calibration algorithms for laser spectral measurements based on cubic spline interpolation and the kernel regression method [7].
Research on robust calibration has also attracted much attention. Mark and Workman [8] proposed a method to calibrate wavelength offset using multiple regression equations, which can make the calibration robust. Swierenga et al. [9] used robust wavelength selection to make the calibration robust to more general forms of between-instrument variation.
At present, wavelength calibration methods are mainly used for the following two kinds of spectrometer.
1.
At present, calibration methods are mostly used for spectrometers with a fixed grating. This type of spectrometer is commonly characterized by the small line-pairs grating and linear-array CCD. Spectrometers with this structure tend to have a lower wavelength calibration accuracy and a lower spectral resolution.
2.
For the grating rotational spectrometer, a single-element detector and large line-pairs grating are usually used.
However, there is no suitable wavelength calibration method for spectrometers using linear-array CCD and rotational grating with large line pairs. To solve the problems with the existing technology, a wavelength calibration method for the scanning, double-layer, secondary-diffraction, linear-array CCD spectrometer is proposed in this study.
In this study, we propose a novel wavelength calibration method for this type of spectrometer. The main contributions of our work are summarized as follows.
1.
At the central pixels, we use the Levenberg–Marquardt algorithm to correct the function relationship between wavelength and feedback value and obtain a sinusoidal function.
2.
We creatively propose converting the feedback values of the non-central pixels into its corresponding feedback values at the central pixels, and then calculate the wavelength using the formula in the previous step. Based on the linear relationship between wavelengths and feedback values, the Huber regression is employed to fit a robust model to better overcome the inherent instrument errors and operation mistakes.
3.
By integrating the formulas obtained in step 1 and step 2, we obtain a wavelength calibration formula that can accurately calibrate all pixels. Experiments show that the novel calibration method has good continuity and high wavelength calibration accuracy.
The rest of this study is organized as follows. Section 2 mainly describes the structure and related principle of the scanning, double-layer, secondary diffraction, linear-array CCD spectrometer. Section 3 describes the detailed calibration algorithm. The performance of the algorithm is verified by some experiments in Section 4. Finally, Section 5 contains the conclusions of the study.

3. The Proposed Calibration Method

As there are high requirements regarding spectrometer accuracy, we have to solve the calibration problem of the scanning, double-layer, secondary diffraction, linear-array CCD spectrometer. The main difficulties that were encounted are as follows. First the spectral wavelength at the central pixels must be accurately determined using the wavelengths obtained from the limited standard light source, and good calibration accuracy must simultaneously be achieved at other wavelengths. Secondly, the wavelength we must be accurately calculated at the non-central pixels, while simultaneously making the algorithm robust. Finally, a continuous algorithm that can simultaneously calibrate all pixels should be generated.
After analyzing the working principles of a spectrometer and the causes of the above-mentioned difficulties, we propose the following calibration algorithm. First, the wavelengths of the center pixels are calibrated. According to Equation (4), we conducted a rough calibration, obtained the data pairs needed for the subsequent accurate calibration, and then corrected them using our algorithm’s sinusoidal function. Then, when the feature peak of the wavelength reached the non-central pixel, the feedback value of the grating ruler (feedback value) of the central pixel was recorded. To convert the feedback value recorded at the central pixel when the wavelength reaches the non-central pixel into the feedback value of the wavelength at the central pixel, the functional relationship between the pixel’s difference and the feedback value is established. Finally, the spectral wavelength calibration algorithm of full-screen pixels was presented by integrating the previous two steps.
It should be noted that the 1200-line grating of this spectrometer has a spectral range from 200 nm to 1000 nm, and the 2400-line grating has a spectral range from 200 nm to 650 nm. Without loss of generality, we use the 2400-line grating as an example in our discussion. The calibration method can be directly applied to the 1200-line grating.

3.1. Spectral Wavelength Calibration Algorithm at Central Pixels

We used the wavelengths of standard light sources (i.e., mercury lamps and lasers) to calibrate the spectrometer. The linear model obtained in Equation (4) was used for the rough calibration of wavelength (please refer to Appendix A.1 for a detailed introduction). We can obtain data pairs for the central pixels that we need using rough calibration. Through experiments, we designed a sinusoidal model, using the Levenberg–Marquardt algorithm (LMA) to correct the wavelength calibration. The new model is better than the model constructed in Equation (4). Through this model, a sinusoidal curve is obtained to predict the relationship between wavelengths other than standard wavelengths, and the corresponding feedback values.

The Levenberg–Marquardt Algorithm to Fit the Sinusoidal Function

To implement accurate calibration, we require more feedback value and wavelength data pairs. With the method described in Appendix A.1, we can obtain data pairs ( x c 1 , λ c 1 ), ⋯, ( x c n , λ c n ) at central pixels.
According to the results of the experiment, the sinusoidal model is more realistic than the linear model. Assume that the relationship can be represented as
λ c = a sin ( b x c + c ) + d ,
where x c ( [ x c 1 , x c 2 , , x c n ] ) and λ c ( [ λ c 1 , λ c 2 , , λ c n ] ) are the feedback value and wavelength at the central pixel, respectively. a , b , c , d are unknown parameters. To simplify discussions, we denote θ = [ a , b , c , d ] .
Suppose the fitting non-linear function to be f ( X θ ) , and the initial value of θ is θ 0 = [ a 0 , b 0 , c 0 , d 0 ] . Therefore, we can find the optimal values for θ by minimizing
F ( θ ) = i = 1 n ( f ( x c i θ ) λ c i ) 2 = f ( θ ) f ( θ ) , f ( x c i θ ) = a sin ( b x c i + c ) + d ,
where f ( θ ) = f ( x c θ ) λ c . As this is a non-linear, least-square problem, the LMA is used to provide a solution.
The LMA is based on the trust region theory because the Taylor expansion in the Gauss–Newton method can only have a good effect near the expansion points. Therefore, to ensure approximation accuracy, we need to set a region with a certain radius as the trust region. In LMA, the size of the trust region is determined by the gain ratio, which is defined as
ρ = f ( θ + Δ θ ) f ( θ ) J ( θ ) Δ θ ,
where J ( θ ) is f ( θ ) .

3.2. Functional Relation at Non-Central Pixels

After obtaining the optimal θ by Algorithm 1, Equation (5) can be established and the wavelengths at central pixels can be considered accurately calibrated. However, for the non-central pixels, further processing is required. Notice that, in the actual operation of the spectrometer, outliers often occur due to inherent instrument error or operation mistakes, which inevitably affect the performance of the calibration algorithm. As a result, it is necessary to make the algorithm robust to outliers while maintaining a high wavelength accuracy. As the Huber regression and Turkey regression are robust to outliers (the detailed argument is presented in Section 3.2.1 and Section 3.2.2), we compare the performance of Huber regression, Tukey regression, and least squares regression methods with the collected experimental data, so that a more suitable approach can be found. We also tried some other robust regression methods, such as RANSAC regression and Theil Sen regression. However, we found that they performed a little worse than Huber regression (the detailed argument is presented in Section 4.1). To simplify this paper, other robust regression algorithms are not listed.
In this part, the data were collected as described in Appendix A.2.1 of the Appendix A. We divide the data into two cases: central pixels ( x c , p c ) and non-central pixels ( x n , p n ). For the standard wavelength λ c , we first performed a preliminary analysis with Δ x = x n x c , Δ p = p n p c . The p n value ranges from 1 to 2048. By exploring the scatter plot of Δ x and Δ p , as shown in Figure 2, a linear relationship between them is demonstrated. According to this fact, we will fit a linear regression model.
Algorithm 1 The Levenberg–Marquardt method used to fit the sinusoidal function at central pixels
Input:n datapoints ( x c 1 , λ c 1 ), ⋯, ( x c n , λ c n ), the initial weight θ 0 , and the initial optimization radius u 0 .
Output: The optimal θ .
  1:
Let k = 1 .
  2:
while k < 50,000 and F ( θ k ) > 1.5 × 10 8 and θ k θ k 1 1 > 1.5 × 10 8  do
  3:
   Use the Gaussian–Newton method and the trust region to solve
    m i n Δ θ k 1 2 f ( θ k ) + J ( θ k ) Δ θ k 2 , s . t . Δ θ k 2 u k
   where u k is the radius of the trust region, J ( θ k ) is the Jacobian matrix of the function.
  4:
   Based on the obtained Δ θ k , calculate ρ according to Equation (7).
   If ρ 3 4 , let u k + 1 = 2 u k .
   If ρ 1 4 , let u k + 1 = 0.5 u k .
   If 1 4 < ρ < 3 4 , u k + 1 = u k .
   If ρ < 0 , θ k + 1 = θ k , u k + 1 = 0.5 u k . However, the     θ k + 1 = θ k + Δ θ k .
  5:
    k = k + 1 .
  6:
end while
  7:
return  θ
Figure 2. The scatter plot of Δ x and Δ p .
Suppose that the model between Δ x and Δ p is
Δ x = e Δ p + f + ε ,
where Δ x and Δ p indicate the response and independent variables, respectively. The symbols e and f are unknown regression parameters, and ε is the random noise term. We denote β = [ e , f ] , f β ( Δ p ) = β [ Δ p , 1 ] .
The core idea of our proposed non-central pixel algorithm is to estimate the feedback value x c when the feature peak λ c is at the non-central pixel p n according to the established Equation (8), given the known values of p c , p n and x n . In other words, x n at p n can be converted to x c at p c by Equation (8). Since the wavelength of the central pixel p c was accurately calibrated by Equation (5), the wavelength of the non-central pixel can be calibrated by the feedback value x c estimated using the above procedure. By this means, we calibrated the wavelengths of the non-central pixels.

3.2.1. Huber Regression

As previous analysis has shown that a linear relationship exists between Δ x and Δ p , we studied the least-square method (LS) method and robust regression methods, including Huber and Turkey regression models.
Some observed data ( Δ x i , Δ p i ) ( i = 1 , 2 , , N ) can be used to denote the residuals by r i = f β ( Δ p i ) Δ x i , in which f β ( Δ p i ) denotes the value fitted by a linear regression model with β .
As the wavelength calibration requires both robustness and accuracy, the Huber regression [12,13] was adopted to fit the model. By defining
ρ ( r i ) = r i 2 / 2 , | r i | η η | r i | η 2 / 2 , | r i | > η
where η is a pre-specified threshold value. The objective is to minimize
β ^ = argmin β L ( β ) , L ( β ) = i = 1 n ρ ( r i ) .
By defining ϕ ( r i ) = ρ ( r i ) , Huber’s influence function is
ϕ ( r i ) = r i , | r i | η sgn ( r i ) η , | r i | > η
According to the definition, the influence function reflects the influence of Δ p i on the gradient. By setting ψ ( r i ) = ϕ ( r i ) / r i , Huber’s weight function can be expressed as
ψ ( r i ) = ϕ ( r i ) r i = 1 , | r i | η η / | r i | , | r i | > η
In other words, when | r i | is larger than the hyperparameter η , the corresponding Δ p i is judged to be an outlier, and its effect is specified as s g n ( r i ) η . When | r i | is less than η , the influence of Δ p i is set as r i . We also note that Huber regression has advantages compared to other methods in Appendix A.2.2 of the Appendix A. In comparison with the mean squared error (MSE), Huber’s loss is less sensitive to outliers because their weights are reduced. In comparison with the mean absolute error(MAE), this can converge faster.
The main steps of using Huber regression to calibrate the wavelengths at non-central pixels are listed in Algorithm 2.
Algorithm 2 Spectral wavelength calibration algorithm at noncentral pixels
Input: The step size l r 0 , the initial weight vector β 0 , the hyperparameter η , the number of iterations E, the initial value of the first-order differential D 0 , the data pairs ( Δ x i , Δ p i ) ( i = 1 , 2 , , N )
Output: The final estimated parametric vector β
1:
for  j = 1 , 2 , , E  do
2:
   for  k = 1 , 2 , , N  do
3:
      Δ x k p r e d = β k [ Δ p k , 1 ]
4:
     if  Δ x k Δ x k p r e d η  then
5:
         ψ k = 1
6:
     else
7:
         ψ k = η Δ x k Δ x k p r e d
8:
     end if
9:
      D k = D k 1 ψ k [ Δ p k , 1 ] Δ x k Δ x k p r e d
10:
   end for
11:
    β j = β j 1 l r 0 D k
12:
end for
13:
return  β

3.2.2. Tukey Regression

Although the influence of outliers is weakened in Huber regression, some extreme outliers still have harmful influences on the final result. To overcome this shortcoming, Turkey [14] proposed defining the function ρ ( r i ) as
ρ ( r i ) = ( 1 [ 1 r i 2 / η 2 ] 3 ) η 2 / 6 , | r i | η η 2 / 6 , | r i | > η
Evidently, Turkey’s loss function L ( β ) is not a convex function; that is, several local optima may exist. In practice, the following weight function is commonly employed, i.e.,
ψ ( r i ) = ( 1 r i 2 / η 2 ) 2 , | r i | η 0 , | r i | > η
Equation (14) shows that outliers no longer have any effect on the estimated β . The main steps used to fit a regression model with Turkey’s loss function are similar to those shown in Algorithm 2, except that the weight function ψ ( r i ) is replaced with Equation (14).

3.3. Full-Screen Spectral Wavelength Calibration Algorithm

In summary, the relationship between the wavelength λ c , the feedback value x( x c or x n ), and the pixel positions p c and p n can be formulated as
λ c = a sin ( b ( x ( e ( p n p c ) + f ) ) + c ) + d ,
where a , b , c , d , e and f are unknown parameters. Note that x can serve as the feedback value x c for the standard wavelength λ c at the central pixel, and x n for the standard wavelength λ c at the non-central pixel. In other words, Equation (15) can calibrate the wavelengths at central and non-central pixels. It is notable that the difference between Equations (15) and (5) is small when p n is equal to p c . The difference between the two functions is the initial phase b f . This may result in a loss of calibration accuracy at the central pixels. However, since the magnitude of x in our actual experiment was ten thousand, and the calculated parameters b and f are single digits, the error caused by the initial phase is negligible after verification; therefore, we still used Equation (15) for the continuity of full-screen calibration (without breaking point).
The main steps of full-screen spectral wavelength calibration algorithm are listed in Algorithm 3.
Algorithm 3 Full-screen spectral wavelength calibration algorithm
Input: ( λ c , x c , x n i , p c , p n i ) , ( i = 1 , 2 , , N ) , the initial weight θ 0 = [ a 0 , b 0 , c 0 , d 0 ] , β 0 = [ e 0 , f 0 ] , the step size l r 0 , the hyperparameter η , the number of iterations E, the initial value of first-order differential D 0 .
Output: All parameters of Equation (15)
1:
According to x c and the central wavelength λ c , θ is calculated by Algorithm 1, where θ = [ a , b , c , d ] .
2:
According to ( x c , x n i , p c , p n i ) , i = 1 , 2 , , N , Algorithm 2 is used to calculate β , where β = [ e , f ] .
3:
Obtain all parameters in Equation (15).

4. Experimental Studies

The proposed method was used to calibrate the wavelength of three scanning, double-layer, secondary diffraction, linear-array CCD spectrometers. The 2400-line grating of grating group 1 and the 2400-line grating of grating group 2 were used when the spectrometer diffracted. The linear-array CCD was a linear-array CCD with a pixel number of 2048 × 1, and the spectral range was 200–650 nm.

4.1. Simulated Experiments

We used wavelength standards 1 and 2 to record the standard wavelength ( x 01 , x 02 ) and its reading head number ( λ 01 , λ 02 ) at the central pixels. Using ( x 01 , λ 01 ) and ( x 02 , λ 02 ), we can fit Equation (4) using rough calibration, as described in Appendix A.1.
According to Equation (4), the feedback values x 10 , x 20 , x 30 , x 40 , x 50 , x 60 , x 70 , x 80 of the grating ruler were calculated when the characteristic wavelengths of the mercury lamp were 253.65 nm, 312.57 nm, 365.02 nm, 404.66 nm, 435.84 nm, 546.07 nm, 576.96 nm, and 570.07 nm, respectively. Using the above data pairs, the scanning motor pulse was set so that each feature spectrum scanned to the central pixel of the linear-array CCD. In this way, accurate test results x 11 , x 21 , x 31 , x 41 , x 51 , x 61 , x 71 , x 81 could be obtained from the feedback values of the grating ruler. With ( x 11 , 253.65 ) , ( x 21 , 312.57 ) , ( x 31 , 365.02 ) , ( x 41 , 404.66 ) , ( x 51 , 435.84 ) , ( x 61 , 546.07 ) , ( x 71 , 576.96 ) , ( x 81 , 570.07 ) , we conducted experiments to verify the performance of the central pixel wavelength calibration algorithm (i.e., Algorithm 1).
Specifically, the nonlinear least square method under LMA was used for calculation, and its parameters were initialized, as shown in Table 1, where λ c is the characteristic wavelength of the mercury lamp and f r e q is a given frequency. The reasons the initial values were set in this way, such as the limited space, are explained in Appendix A.3.
Table 1. The initial values of the parameters in Equation (5).
Figure 3 shows the sinusoidal curve fitted by Algorithm 1; the fitted parameters are shown in Table 2. In Figure 3, the horizontal axis indicates the wavelength and the vertical axis is the feedback value. The fitting performance is good, as the known wavelengths and feedback values are fitted very well. By calculation, the maximum difference between the original data and the fitted sinusoidal function was shown to be 0.03365 nm.
Figure 3. Sinusoidal fitting results of the central pixels.
Table 2. The fitting parameters of Algorithm 1.
Next, we simulated some experimental data to validate the performance of the calibration algorithm at non-central pixels. We turned on the mercury lamp and let the light from the mercury lamp that was vertically incident on the light inlet of the spectrometer. The scanning motor was started to rotate the raster scanning machine to 0 nm, and then the raster scanning machine was started. According to the pixel number of linear-array CCD (take 2048 × 1 linear-array CCD as an example), the average value x 1 , x 256 , x 512 , x 768 , x 1280 , x 1536 , x 1792 , x 2048 (denoted as X) of the feedback value of the grating ruler corresponding to the feature peak at p 1 (the first pixel), p 256 , p 512 , p 768 , p 1280 , p 1536 , p 1792 , and p 2048 (denoted as P) of a certain feature peak were recorded. In a similar way, we also recorded the feedback values X that correspond to the characteristic peaks in the mercury lamp 253.65 nm, 312.57 nm, 365.02 nm, 404.66 nm, 435.84 nm, 546.07 nm, 576.96 nm, 570.07 nm. Based on these data, we used Algorithm 2 to test its performance.
According to Algorithm 2, We selected the initial step size l r 0 , the initial weight β 0 , the hyperparameter η , and the E values within a certain range. The initial step size l r 0 and the hyperparameter η were selected from { 0.01 , 0.001 , 0.0001 } . The selection range of the initial weight β 0 was one of the intervals from { ( 0.1 , 0.1 ) , ( 0 , 0 ) , ( 0.1 , 0.1 ) } . The candidate values of the epoch number E were set as { 100 , 150 , 200 } . The final hyperparameter configuration, obtained after conducting some preliminary analyses with different combinations of these hyperparameters, is shown in Table 3.
Table 3. Selected hyperparameters for three fitting methods.
With data pairs Δ x and Δ p , we fitted the linear regression model using the LS method, Huber regression, and Turkey regression. The left subplot of Figure 4 shows the fitting results of Huber regression, LS regression, and Tukey regression. The horizontal and vertical axes represent Δ p and Δ x , respectively. The blue points are the observed data and the lines are the linear models fitted by the three methods. To facilitate comparison, we enlarged the contents of the red box; it is shown in the right subplot. These results reveal that Huber regression performs better than the other methods in resisting outliers. The fitted parameters, obtained according to Huber regression, are shown in Table 4.
Figure 4. Comparison of the three fitting methods. Note: The blue points are the observed data. The blue, red, and green lines are the Huber, LS, and Tukey regression predictions, respectively. The image on the right is a partial enlargement in the red box on the left.
Table 4. The fitting parameters of Algorithm 2.
To further demonstrate the advantages of Huber regression, we conducted a quantitative analysis of the fitting results. Since Figure 4 shows that Turkey regression works the worst, only LS and Huber regression were taken into account. First, we removed the nine farthest outliers from the linear function obtained using the LS method according to the absolute value of the residuals. Then, the LS RANSAC, Theil Sen, and Huber regression were compared on the remaining points. We computed the mean squared error ( MSE ), the maximum residual ( RES ) and the mean absolute error ( MAE ). Figure 5 demonstrates the obtained results, in which columns 1, 2, and 3 correspond to the MSE, RES, and MAE, respectively. Different colors represent different regression algorithms.
Figure 5. Qualitative comparison between Huber and LS.
Figure 5 shows that Huber regression performs better than LS, RANSAC, and Theil Sen regression in terms of the evaluation indices MSE , MAE and RES . In industrial practice, the maximum residual error is often chosen as the criterion by which to judge the quality of the algorithm. Therefore, the smaller the RES , the better the algorithm. Based on this fact, we chose the β ^ estimated by the Huber method.

4.2. Validation on the Instrument

In this subsection, we qualitatively analyze the calibration algorithm. This is shown in Figure 6, where the horizontal axis indicates the wavelength. On the vertical axis, the left part denotes the signal energy collected by CCD, while the right part denotes the signal voltage value. In Figure 6, the full width at half-maximum (FWHM) reflects the spectral resolution, W represents the wavelength value calibrated by the algorithm, P represents the pixel position, C means the signal energy value collected by the CCD, and V represents the signal voltage value. The units of these values in Figure 6 are nm, nm, pixel, count, and V.
Figure 6. Qualitative analysis of the calibration algorithm. Note: The left vertical axis represents the signal energy value, the right represents the signal voltage value, and the horizontal axis represents the wavelength value calibrated by the algorithm. The center of the red cross in the picture is the wavelength we are measuring, and we usually know the exact value of it. FWHM reflects the spectral resolution, W represents the wavelength value calibrated by the algorithm, P represents the pixel position, C means the signal energy value collected by the CCD, and V represents the signal voltage value.
The left subplot of Figure 6 shows the calibration accuracy of the fitting wavelengths. At the characteristic peak of 404.65 nm, the wavelength after calibration is 404.696 nm. The calibration accuracy at this pixel is 0.046 nm, and the spectral resolution is 0.016 nm. This shows that the calibration algorithm can achieve better calibration results on the fitting wavelengths. Moreover, we rotated the feature peak to the 1006th pixel and other ones, and the calibration result remained unchanged. This reveals that the wavelengths at non-central pixels can be calibrated to meet the practical requirements.
At the same time, to qualitatively study the calibration accuracy of the calibration algorithm beyond the fitting points, we used a variety of pulsed lasers to perform pulse verification on the spectrometer. The real wavelength was 532 nm and a 1–10 Hz pulsed laser was used. The wavelength after calibration was 532.045 nm, and the calibration accuracy of the test wavelength was 0.045 nm. The spectral resolution was 0.020 nm. The results are shown in the right subplot of Figure 6. This shows that the calibration algorithm can achieve better calibration results, even on the non-fitting points.
For the full-screen calibration algorithm (i.e., Algorithm 3), we employed the parameters estimated above and wrote the calibration algorithm into the signal processing module of the spectrometer. After experimental verification, the calibration results are shown in Table 5.
Table 5. Test results of the calibration algorithm on three spectrometers.
We carried out experiments with three spectrometers with the same structure; the obtained results are reported in Table 5. The second column is the standard value λ s of the wavelength standards. Considering the given standard wavelength value λ s , six measurements λ i ( i = 1 , , 6 ) were implemented to check the stability of the calibration algorithm. The third column of Table 5 lists the mean measured wavelengths λ ¯ n . In the fourth column, the wavelength accuracy Δ λ n is reported, and Δ λ n = λ ¯ n λ s . The fifth column represents the repeated-measurement accuracy Δ . Here, Δ is computed as Δ = m i n , | m a x | < | m i n | m a x , | m a x | > | m i n | ± | m a x | , | m a x | = | m i n | , where m i n = m i n i = 1 6 ( λ ¯ n λ i ) and m a x = m a x i = 1 6 ( λ ¯ n λ i ) . It is noteworthy that the wavelength accuracy Δ λ n reflects the calibration accuracy of the algorithm, and the wavelength repeated-measurement accuracy reflects the stability of the algorithm.
Table 5 shows that the wavelength accuracy was within ±0.05 nm and the accuracy of the wavelength repeated measurements was within ±0.005 nm when measuring the characteristic spectra of the mercury lamp. Through the experiments conducted on the three spectrometers, the spectral wavelength errors obtained at the central pixel of the 2400-line grating were all within 0.05 nm. We met the design requirements of the NIR spectrometer. The 1200-line grating reached similar conclusions; the results are omitted here due to the limited space in this paper. In view of the above-mentioned results, it can be concluded that the proposed wavelength calibration algorithm is effective. This algorithm is not limited to enumerating the above embodiments but is also suitable for the wavelength calibration of spectrometers with a sinusoidal machine for raster scanning and linear-array CCD for spectral signal acquisition.

5. Conclusions

In this paper, the structure and some basic principles of a scanning, double-layer, secondary diffraction, linear-array CCD spectrometer are introduced. Then, a robust, full-screen, calibration algorithm is proposed. The parameters of the calibration formula were obtained by LMA and Huber regression algorithm.
Focusinng on the theory and applications of the scanning, double-layer, secondary diffraction, linear-array CCD spectrometer, we verified that the wavelengths can be calibrated by the robust spectral calibration algorithm. Compared with other methods, we found that the robust spectral calibration algorithm has the following advantages. First, we can correct the error caused by the sine mechanism and improve the calibration accuracy of the center pixels. We also found a way to convert the non-central pixels’ feedback values to the central pixels’ feedback values. Finally, we can calibrate the wavelength of the central pixels and the non-central pixels with high accuracy, instead of only focusing on calibrating the wavelength of the central pixels, as in other calibration algorithms. In other words, when the wave peak is not at the central pixels, we can accurately calibrate its wavelength, or, when there are multiple wave peaks in a screen, we can calibrate the wavelengths of these peaks at the same time. During the experiment, we tested the calibration accuracy of the algorithm for the wavelength outside the fitting points and showed that it has a good calibration accuracy, while polynomial fitting can not guarantee the calibration accuracy of points outside the fitting point. Finally, the fitted formula is relatively convenient and can be used to calibrate the wavelength at any pixel.
In future work, we plan to introduce the automatic step-size algorithm into the non-central pixels’ function fitting method. We are also interested in quickly calibrating the spectrometer’s wavelength after the vibration test. As the area-array CCD also has non-central pixel positions, similar studies will be conducted on the area-array CCD to verify the validity of the model. To verify the influence of light quality on the model, we will also test our model on stable lasers characterized by a narrow line width.

Author Contributions

Conceptualization, B.J. and C.Z.; methodology, B.J.; software, B.J. and N.Z.; validation, B.J., L.W. and J.C.; formal analysis, L.Y. and B.J.; investigation, J.C.; resources, H.L. and J.C.; data curation, B.J. and J.C.; writing—original draft preparation, B.J. and C.Z.; writing—review and editing, B.J., C.Z. and H.B.; visualization, B.J.; supervision, C.Z. and H.L.; project administration, C.Z. and H.L.; funding acquisition, C.Z. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Data Availability Statement

The data presented in this study are available on request from the corresponding author. The data are not publicly available due to experimental data involved confidential items.

Acknowledgments

The authors would like to thank the editors and the anonymous reviewers for their comments and suggestions.

Conflicts of Interest

The authors declare no conflict of interest.

Appendix A

This supplemental document provides the rough calibration method, the strategy to collect feedback value and wavelength pairs, the detailed introduction of two loss functions of the linear regression as well as the initial parameter setting of the sinusoidal model.

Appendix A.1. A Rough Calibration

Given the feedback value specified by the lower computer, the scanning motor is rotated until it reaches to the feedback value. At this time, we observe the spectral signal of the linear array CCD in the upper computer. If the spectral signal appears at the central pixel, we can record the wavelength and the corresponding feedback value. Unfortunately, we do not know what the feedback value of the central pixel is for the spectral signal we want to observe. If manually specify the feedback value of the lower computer and then find the spectral signal by rotating the motor, the data-collecting process will be very time-consuming. Due to this fact, we employ a rough calibration strategy first. After obtaining the approximate value near the feedback value for the given wavelength by the rough calibration, the exact feedback value can be easily found manually. In comparison to the former procedure, this data-collecting method saves a large amount of time and labor.
A set of gratings with the same line pairs were selected for double-layer secondary diffraction. The wavelength standard 1 used for calibration is a 253.65 nm laser with a calibrated wavelength, and the wavelength standard 2 is a 632.81 nm laser with a calibrated wavelength. In the experimental process, we first start the scanning motor to slide the slider in the raster scanning machine to the mechanical zero position. At this time, we open calibrated wavelength standard 1. The light emitted by it will be vertically incident to the optical inlet of the spectrometer. Then, the grating scanning machine begins to scan until the upper machine display that the spectral signal of the line array detector appears at the central pixel. At present, we register the reading head number x 01 , the wavelength λ 01 , and close the wavelength standard 1. Next, we turn on the wavelength standard 2 and repeat the same process to obtain another data pair ( x 02 , λ 02 ). With ( x 01 , λ 01 ) and ( x 02 , λ 02 ), we can find a linear equation
λ 0 = k 0 x + a 0 ,
where k 0 and a 0 are the slope and intercept of the straight line. The role of Equation (A1) is to rough calibrate the spectrometer so that the scanning motor could be used to turn to the vicinity of the grating diffraction wavelength which needs to be calibrated. Based on this equation, more data pairs of the feedback value and grating diffraction wavelength can be easily obtained to facilitate the later precise calibration.
To implement accurate calibration, we need more feedback value and wavelength data pairs which can be obtained with the following method. First, two wavelength standards are used to perform the coarse labeling of Equation (A1). Then Equation (A1) is used to find the approximation of the feedback value corresponding to the standard wavelength given the other wavelength standards. Finally, the lower computer is used to rotate the scanning motor until the upper computer shows that the standard wavelength signal of the linear array CCD appears at the central pixel. We will record such a data pair ( x c , λ c ). Suppose that we totally obtain n data pairs ( x c 1 , λ c 1 ), ⋯, ( x c n , λ c n ) here.

Appendix A.2. Functional Relation at Non-Central Pixels

Appendix A.2.1. Acquisition of Calibration Data of Non-Central Pixels

We add Algorithm 1 to the control software. The mercury lamp is turned on, and the light emitted by the mercury lamp is perpendicular to the light inlet of the spectrometer. Start the scanning motor to rotate the raster scanning machine to 0 nm, and start the raster scanning machine to scan. According to Algorithm 1, the reverse algorithm can be obtained. If we input the standard wavelength λ c to the reverse algorithm formula, the feedback value x c can be obtained. By feeding x c to the raster scanning machine, the scanning is run until some spectral signal appears on the linear array CCD. At this time, we record the pixel position p and the feedback value x. We divide the data into two cases: central pixels ( x c , p c ) and non-central pixels ( x n , p n ). Here, x c and x n are the feedback values of the grating ruler when the feature peak of λ c is transferred to the central pixel p c ( 1024 ) and a non-central pixel p n , respectively.

Appendix A.2.2. Two Loss Functions of Linear Regression

Linear regression is a widely used model to explore the linear relationship between multiple variables, and its regression parameters are usually obtained by the least square method (LS). However, the LS method is sensitive to outliers. In the situation of the observed data involving outliers, a robust estimation can reduce their influence on the estimated parameters. Because previous analysis has shown that there exists a linear relationship between Δ x and Δ p , we will study the LS method and robust regression methods including Huber and Turkey regression models.
In conjunction with the model we need to solve, let’s take the linear parametric model as an example
f β ( x ) = j = 1 m β j x j = β x ,
where x is the predictor variable, m is the dimension of x and is set to 2 in Equation (A2), y is the response variable, β is the unknown regression vector of the function.
Provided some observed data ( x i , y i ) ( i = 1 , 2 , , n ) , denote the residuals by r i = f β ( x i ) y i in which f β ( x i ) denotes the value fitted by a linear regression model with fixed β . In the LS regression algorithm, we use the loss of mean squared error ( MSE ) to ensure that we get a suitable result.
β ^ = argmin β L ( β ) , L ( β ) = 1 2 i = 1 n r i 2 .
We note that the gradient of MSE is i = 1 n r i x i . The advantage of MSE is that as the error decreases, the gradient also decreases, which is conducive to the convergence of the loss. If some outliers exist in the observed data, they will make MSE unsurprisingly large. As a result, the attained function will greatly deviate from the true function. We define the influence function as ϕ ( r i ) = r i , which reflects the influence of the observed data x i on the gradient. The weight function is defined as ψ ( r i ) = ϕ ( r i ) r i . Notice that the weight function reflects the importance of each x i to the loss function. In LS method, ψ ( r i ) = 1 which means that each x i ( i = 1 , 2 , , n ) are treated equally when minimizing MSE .
From the point of view of pursuing robustness, it is always better to use mean absolute error( MAE ) as the primary criterion.
β ^ = argmin β L ( β ) , L ( β ) = i = 1 n | r i | .
Obviously, MAE is less sensitive to outliers than MSE . Nevertheless, it achieves robustness to outliers by losing some accuracy. We also note that the gradient of MAE is i = 1 n s g n ( r i ) x i in which sgn ( · ) is the sign function. However, the influence scale of x i is always 1 when their residuals r i are small, which is not helpful to the convergence of the model.

Appendix A.3. Parameter Setting

Since the amplitude a can be regarded as the maximum distance from the equilibrium position when the sinusoidal function vibrates, we initialize a as the difference between the maximum and minimum values of λ c . In the sinusoidal function, b is the angular frequency. In theory, it is the product of 2 π and the frequency of the vibration. By applying the discrete Fourier transform to λ c we can obtain multiple complex numbers, each of which contains information about the amplitude at a particular frequency. If using index to denote the index of the position of the maximum amplitude and the length of x c to represent the number of sampling points, the difference between the first two values of x c is actually the sampling interval. The actual frequency that corresponds to the complex value can be calculated as f s . By setting f r e q equal to the value corresponding to the i n d e x of f s , we can obtain the frequency value of maximum amplitude, which is an estimate of the frequency f of vibration. Meanwhile, we set the initial value of c as 0. To maintain the consistency of ordinate magnitude, the initial value of d is set as the mean value of λ c .

References

  1. Sun, S.; Sun, B.; Gu, Y. Research on the Embedded Control System of Automatic Grating Concolorous Apparatus. China Instrum. 2005, 11, 45–49. [Google Scholar] [CrossRef]
  2. Huang, J.Q. Research on a Quick and High Accuracy Wavelength Setting Method for Grating Spectrometer. Ph.D. Thesis, Shanghai Jiao Tong University, Shanghai, China, 2010. [Google Scholar]
  3. Chen, S.; Ke, F.; Le, Y. Calibration of grating spectrometer. Phys. Exp. 2012, 32, 44–46. [Google Scholar] [CrossRef]
  4. XU, Z.; Yu, B. Wavelength calibration for PC2000-PC/104spectrometer. Phys. Exp. 2004, 12, 11–14. [Google Scholar] [CrossRef]
  5. Zhang, Q.; Chang, J.; Wang, F.; Wang, Z.; Xie, Y.; Gong, W. Improvement in QEPAS system utilizing a second harmonic based wavelength calibration technique. Opt. Commun. 2018, 415, 25–30. [Google Scholar] [CrossRef]
  6. Sun, C.; Wang, M.; Cui, J.; Yao, X.; Chen, J. Comparison and analysis of wavelength calibration methods for prism–Grating imaging spectrometer. Results Phys. 2019, 12, 143–146. [Google Scholar] [CrossRef]
  7. Yuan, L.; Qiu, L. Wavelength calibration methods in laser wavelength measurement. Appl. Opt. 2021, 60, 4315–4324. [Google Scholar] [CrossRef] [PubMed]
  8. Mark, H.; Workman, J. A new approach to generating transferable calibrations for quantitative near-infrared spectroscopy. Spectroscopy 1988, 3, 28–36. [Google Scholar]
  9. Swierenga, H.; de Groot, P.; de Weijer, A.; Derksen, M.; Buydens, L. Improvement of PLS model transferability by robust wavelength selection. Chemom. Intell. Lab. Syst. 1998, 41, 237–248. [Google Scholar] [CrossRef]
  10. Qiao, D.; Gu, Y.; Xu, X. Wavelength Calibration Algorithm in Grating Spectrometer. Acta Photonica Sin. 2009, 38, 2283–2287. [Google Scholar]
  11. Wu, K.; Xue, S.; Lu, Q.; Peng, Z. Simulation analysis and measurement of rotation angle repeatability for grating sine mechanism of SX-700 monochromator. Opt. Precis. Eng. 2010, 18, 46–49. [Google Scholar]
  12. Baselga, S. Global optimization solution of robust estimation. J. Surv. Eng. 2007, 133, 123–128. [Google Scholar] [CrossRef]
  13. Zhu, B.; Chang, L.; Xu, J.; Zha, F.; Li, J. Huber-Based Adaptive Unscented Kalman Filter with Non-Gaussian Measurement Noise. Circuits Syst. Signal Process. 2018, 37, 3842–3861. [Google Scholar] [CrossRef]
  14. Pennacchi, P. Robust estimation of excitations in mechanical systems using M-estimators—Experimental applications. J. Sound Vib. 2009, 319, 140–162. [Google Scholar] [CrossRef]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.