## 8 Spectral Data Preprocessing Steps  
The noise sources described above can be mitigated to varying degrees by various data preprocessing. Preprocessing options depend on the measurement protocol, such as whether multiple detector positions are used, whether a check-source calibration is available for each background and source measurement, etc.  
The first preprocessing step is to obtain a background spectrum, preferably using the same detector as for the source plus background measurement. Archived background measurements or calculated background measurements [24] could also be used. Then, either the net counts calculated by background subtraction can be analyzed, or the background and source plus background can be separately analyzed. If a mixture of a few common background isotopes such as \({}^{232}\)Th and \({}^{226}\)Ra fit the measured background well, then a constrained fit to the source plus background spectrum could force the background fit into the final fit, avoiding the need to subtract the background and perhaps more naturally leading to a non-negativity constraint on the source plus background fit.  
A second preprocessing step that can be applied before each measurement or much less frequently is the energy calibration. Calibration is required to map the measured test spectrum to the reference spectra. Typically the energy \(E\) in keV for a given channel is calibrated to voltage bin \(x\) using a simple relatively low-order polynomial such as \(E=a_{0}+a_{1}\,x\,+a_{2}\,x^{2}+a_{3}\,x^{3}+\) error [5]. Other functional forms have also been applied.  
Recall that Figure 5 shows an example of peak centroid drifting between two measurements of \({}^{239}\)Pu from two models of the same GR135 detector. This can be regarded as a shift or drift in the calibration constants. Counts from a very small \({}^{137}\)Cs check-source are also evident due to the peak near 662 keV. Notice that the drift in peak centroid locations is not consistently in the same direction. If instead two repeated measurements of the same source were made using the same detector and model, we expect peak centroid locations shifts to be in the same direction. One option to align such shifted spectra requires making multiple measurements of the source, each from a different detector location to map the effect of high count rate (for small source-detector distances) on calibration- shift-related peak centroid shifting [16].  
An intriguing possible preprocessing step attempts to mimic higher resolution spectra from NaI spectra by using highly accurate estimates of the detector response function (DRF), which specifies the probability density function for detected \(\gamma\) energies for any incident \(\gamma\) energy [25] This is sometimes called spectrum unfolding. Because estimation errors in the DRF are amplified during the unfolding process of matrix inversion, the estimated DRFs must have negligible error for using unfolded NaI spectra rather than the NaI spectra in the context of RIID algorithms. This DRF-inversion method is relatively untested although the peak recovery reported in [25] is promising.  
Other possible preprocessing steps include spectral smoothing [20, 21], and peak area and centroid estimation [7]. To locate peaks, sometimes a second derivative method first attempts to locate the centroid of each peak, by finding the location where the spectrum is most concave down (as defined by the spectrum's second derivative). Typically, a rolling window smooths the spectrum and isolates the second derivative calculation within each window [5].