CheckSpectrum

Declaration: CheckSpectrum(ix, iy, FirstLayer, LastLayer, TimeSlot: integer; var CorrMean, CorrMin, CorrMax, StdDev, Noiseless, WaWoP: double): integer;
Calculates various spectral characteristics which can be used to check the quality of a spectrum. The parameters ix and iy specify the coordinates of the pixel, the parameters FirstLayer and LastLayer indicate the range of the spectrum to be checked. The TimeSlot parameter specifies the index of the time slot.

The function calculates the following characteristics (see also the section on suspicious pixels for a more detailed explanation):

CorrMean: 1.0 minus the squared correlation coefficient of the specified spectrum and the mean of the 8 surrounding spectra
CorrMin: the minimum of all squared correlations between the spectrum and the 8 surrounding spectra
CorrMax: the maximum of all squared correlations between the spectrum and the 8 surrounding spectra
StdDev: the standard deviation of the spectrum
Noiseless: the percentage of noiseless spectral regions
WaWoP: the p value of the Wald-Wolfowitz runs test

The function returns the following error codes:

 0 ... everything is OK
-1 ... invalid ix or iy
-2 ... invalid TimeSlot
-3 ... invalid FirstLayer or LastLayer
-4 ... FirstLayer and LastLayer do not belong to the same spectrum