Energy calibration via correlation using an adaptive mesh refinement

Energy calibration via correlation has proven to be a powerful calibration method especially in the case of calibration data sets with low counting statistics. This work reports on an evolved version of this approach that uses an adaptive mesh refinement to sample the parameter space which results in the same calibration performance but in a considerably reduced computation time.


I. INTRODUCTION
A precise energy calibration is a critical step for many experiments using X-ray and gamma-ray detectors, like spectrometry in general, X-ray fluorescence analysis, Compton imaging, source identification... Non-linear effects introduced by the detector response as well as non-linear effects within the signal processing chain, like in amplifier ASICs or ADCs, often require to use non-linear models for the energy calibration, i.e. a parameter space with a dimensionality bigger than two. In addition, repetitive re-calibration that is used to correct time-dependent response instabilities, or a strong pixelation of the detector result in low counting statistics per detector channel implying a reduced accuracy of the energy calibration. Section II shortly summarizes the main idea behind the classical energy calibration via correlation (ECC) approach. Section III presents an evolved parameter sampling and optimization method used for ECC, the adaptive mesh refinement (AMR). Section IV gives an outlook for the implementation of an adaptive reduction of dimensionality, a feature foreseen for the next version of ECC. Section V summarizes the results.

II. A FIRST SOLUTION: ECC
A method that uses an Energy Calibration via Correlation approach was presented [1] to address the problems of low counting statistics in the calibration data set. The idea of ECC is not to use a peak fitting approach, which examines only specific line positions, but to use the complete spectral response of the calibration measurement. The procedure of ECC can be summarized as follows: 1) Make a synthetic line spectrum based on prior knowledge of the used calibration source ( Fig. 1 (a)). 2) Modify the line spectrum to a synthetic energy spectrum by applying the detector response model. This model corrects for a non-ideal detector response and includes typically the energy resolution and the quantum efficiency of the detector ( Fig. 1 (b)).
emission line spectrum synthetic energy spectrum synthetic pulse-height spectra resolution efficiency Fig. 1. Concept of ECC: creating synthetic energy spectra (a-b) and transforming them into synthetic pulse-height spectra (c-e) that are correlated with the observed pulse-height spectrum.
3) Discretize the parameter space and calculate for every combination of parameters the corresponding synthetic pulse-height spectrum ( Fig. 1 (c) to (e)). 4) Compute the correlation value of all synthetic pulseheight spectra with the observed pulse-height spectrum. 5) The best calibration parameters are found by searching for the highest correlation (Fig. 2). The correlation value is defined as where i is the binning index of the synthetic pulse-height spectrum S syn and the observed pulse-height spectrum S obs and N is the total number of bins. The higher the correlation value the better is the match between the two spectra. Therefore, the correlation value can be used as a measure of the goodness of the parameter set. Even though the presented examples show a linear calibration, the concept of ECC is not limited to any number of parameters. An example of a non-linear ECC using three parameters can be found in [1].
Compared to a peak fitting approach that is based on finding PHA-energy pairs and fitting these pairs to the proposed calibration model, ECC performs considerably better, especially for calibration sets with a small number of photons. Another benefit of ECC is that it is not restricted to line peaks but can use the full spectral response like Comptonization structures. See reference [1] for more details on ECC and a quantitative comparison between ECC and a Gaussian peak fitting approach.

III. ADAPTIVE MESH REFINEMENT
The equally spaced homogeneous grid that was used for the previous presented implementation of ECC samples each region of the parameter space equally fine. If a high parameter resolution is required and the parameter space is large because of high dimensionality or large pixel-to-pixel variations, the computation time for the calibration becomes an issue. This is especially true for applications which aim for near realtime calibration or re-calibration or applications which have many detection channels, i.e. strong pixelation. Adaptive mesh refinement is a numerical analysis method that samples the parameter space dynamically during the computation time with an increasing resolution for interesting regions. It is frequently used in simulations of turbulent regions of fluid dynamics [2].

A. Adaptive mesh zooming
Compared to the previous, classical ECC procedure described in Sect. II, only the 3 rd step is changing for ECC AMR . The adaptive mesh approach samples the parameter space in two steps. First, an initial homogeneous mesh, similar to the one used in the classical approach but with a much lower parameter resolution, is applied and the corresponding correlation map is calculated. Based on the obtained correlation values cor 0,j , regions are classified as interesting if where f 0 defines a fraction of the best obtained initial correlation value cor * 0 . The initial zooming threshold t 0 triggers a zoom into an interesting region with a three times increased resolution for each parameter; i.e. for two parameters an interesting region is sampled with a sub-resolution of 3 × 3.
The correlation values of each of these 9 sub-regions are calculated and new interesting regions are defined via where i is the iteration index and N z defines the maximal number of iterative zoomings. The zooming-threshold definition via two independent parameters f 0 and f is motivated by the idea to have a less strict selection for the first zooming but an increasing harder selection for the following iterations. Figure 3 shows the described zooming method schematically.

B. Adaptive mesh expansion
Because the center of a parameter region is used to calculate the correlation value for this region, the region might appear as not interesting even if the optimal parameter set is positioned within the region but close to the edge of the region. In this case, the rough sampling prevents from finding the optimal parameter set.
To minimize this problem, a mesh expansion method is developed that allows to step backwards iteratively and zoom into a region that was initially classified as uninteresting if the difference of the iteration index i between neighboring regions is bigger than two. For an element with index i e and its neighboring elements with index i e,k , the expansion condition becomes |i e − i e,k | > 2 for all e and k.
In order to keep the number of neighbors low, only neighbors to the edges of a region are considered. This is especially important for a high dimensional parameter space. Given the dimensionality of the parameter space as d, the number of edge neighbors that differ only in one parameter value is 2 · d while it is maximally 3 d − 1 for all possible neighbors. After the expansion, the zooming criterion is applied for the new region according to the saved thresholds t i . Finally the expansion condition is checked for the new region. Due to this method, the algorithm expands into interesting parameter regions even if they seemed to be uninteresting within the previous iterations. In this way, the expansion method works as a local gradient ascent optimizer. Figure 4 shows schematically the described expansion method followed by a re-zoom. After the zooming iteration i = 2 ends, the zooming-threshold t 2 is calculated. The region indicated in red exceeds this threshold and a zoom will be conducted for i = 3. This would violate the condition of Eq. (6) so that an expansion is conducted before iteration 3 begins. After the neighboring region is expanded to i = 1, it is re-zoomed according to threshold t 1 . Finally, the expanding condition is checked again and another expansion might occur. If no more expansion is to be done, iteration i = 3 starts.  Fig. 4. Schematic expansion into an interesting region followed by a re-zoom.
After the re-zoom, another expansion to the bottom region (not shown) might occur or the next iteration i = 3 starts. Figure 5 shows a correlation map for the calibration of a camera system [3] that is based on a CdTe Caliste-HD detector [4]. The calibration uses an Am-241 source and calculates the best calibration parameters via classical ECC which was conducted by using ECC AMR with no iteration (i = 0) and with a fine resolved initial mesh of ∆o = 5 ADU and ∆g = 0.25 ADU/keV. The parameter space is equally sampled with 1000 × 720 sampling points and the calculation of the 7.2 · 10 5 correlations takes approximately 100 seconds on an ordinary computer with single core use. This realistic data set shows that the optimization problem is not convex but has multiple local maxima. Furthermore, due to absorption of low energy photons in the camera housing (0.5 mm Al), the source spectrum is dominated by the emission line around 60 keV. Consequently, all parameter combinations that match the synthetic 60 keV line with the observed line result in a large correlation which can be seen by the yellow line in Fig. 5. Nevertheless, the obtained parameter set for the best correlation fits the measurement well, see Fig. 6. Figure 7 shows for the same calibration measurement the result of ECC AMR after 5 iterations. The initial grid was chosen to ∆o = 500 ADU and ∆g = 10 ADU/keV, leading to 400 initial correlations and a final resolution of ∆o ≈ 2 ADU and ∆g ≈ 0.05 ADU/keV. The threshold parameters were set to f 0 = 0.6 and f = 0.7. The numbers of computed correlations for each iteration are shown in Fig. 8. In total, 1602 correlations are calculated which is 450 times less compared to classical ECC. The number of correlations directly measures the computation time within ECC. The total computation time is about 2 seconds, which is, compared to classical ECC, a reduction by a factor of 50, including also reading the input data, binning the spectra, and writing the results.  Figure 9 shows the correlation map for the same dataset but using ECC AMR with disabled adaptive mesh expansion. The global maximum cannot be found in this case because the initial grid shows near the global maximum a relatively low correlation value of cor ≈ 3.2 which is only 44 % of the maximal initial correlation value. A finer initial grid or a lower threshold factor f 0 could resolve this problem but only at the expense of an increased computation time. IV. OUTLOOK In the current version, the resolution of each parameter is increased by a factor of 3 for each iteration. If the required resolutions of the parameters are considerably different, it would be beneficial if the zooming factor could change during the computation for each parameter individually. In particular, an implementation is foreseen where the zooming of a parameter stops if a given resolution is obtained. This would result in an adaptive reduction of the dimensionality of the parameter space -a consistent further development in the sense of an adaptive mesh. Figure 10 shows this idea schematically for the case of two parameters. The stopping criterion, which is in the current version defined by the number of iterations, would be reached if all required parameter resolutions are obtained. 0 outlook Fig. 10. After iteration i = 1, the zooming is reduced from 3 × 3 (current version) to 1 × 3 (next version), i.e. only 3 and not 9 zooms are calculated for each interesting region. The stopping condition is reached when the resolution requirements of all parameters are achieved and no more zooming is required.

V. CONCLUSIONS
ECC is compatible with an adaptive mesh refinement that reduces the computation time dramatically: in the given example, the computation time is reduced by a factor of ∼ 450 for an even slightly better parameter resolution compared to the classical ECC approach. Both methods, classical ECC and ECC AMR , result in a maximal calibration error of ∆E = 275 eV for the shown example of an Am-241 calibration.
The application of AMR requires to use an adaptive expansion method in order to explore regions that are interesting but that seemed to be uninteresting during previous iterations. The expansion works recursively at the end of each iteration, so that the algorithm always looks for the best correlation value for a given parameter resolution.
Even though the algorithm is shown for only two parameters and for the example of energy calibration, it can be applied for any multi-dimensional optimization problem. Like ECC, ECC AMR is highly parallelizable with a total memory usage of less than 100 MB for the given examples.