The function PeakFinder searches the spectrum at the location defined by the parameters PosX, PosY and TimeSlot for spectral peaks. The spectrum to be checked is given by its spectral group number (parameter Group). The form of the spectral peaks has to be defined by filling in the array PeakTemplate. The values of this array should reflect the approximate form of the expected peaks, the width of the peak template (in data samples) should approximately match the width of the peaks to be searched for. However, in most cases a triangular peak form is sufficient. The width of the peak template should always be odd in order to avoid shifts of recogized peak centers.
The peak positions are determined by calculating the correlations between the template peak and a shifted copy of the spectral signal. The maximum local correlation determines the position of the peak. The parameter Sensitivity is the threshold value the correlation has to exceed in order to be reconized as peak. Typical values for the Sensitivity are 0.6 to 0.9. The MinPeakAmpl specifies the minimum required amplitude of a peak in order to be recognized. The MinPeakAmpl is given in counts.
The found peaks are returned in form of the dynamic integer array PeakList, which holds the layer indices of the peak maxima.
The function returns the following error codes:
>=0 ... everything is OK, the function returns the number of found peaks
1 ... PosX and/or PosY is out of range
2 ... TimeSlot is out of range
3 ... specified spectral group is not available
4 ... PeakTemplate is undefined or too small/large (requires 3 to 100 values)
