ScaleSpectrum

Declaration: ScaleSpectrum (PosX, PosY, FirstLayer, LastLayer, TSlot: integer; SclType: TSclType; var Par1, Par2: double): integer;
Performs a scaling operation on the spectrum at the pixel position [PosX,PosY] of the timeslot TSlot. The spectrum is processed in the range between the layers FirstLayer and LastLayer. The type of scaling operation is controlled by the parameter SclType (see also: scaling the data for a detailed explanation). The variable parameters Par1 and Par2 contain the required scaling parameters on input and characteristics of the data before the scaling operation on return:

SclType Scaling Operation Par1 Par2
sctMeanCenter The selected data items (layers, spectra, or all data) are scaled in such a way that the mean of each item becomes zero. in: ignored
out: mean
in: ignored
out: 0
sctStandardize The selected data items are scaled to a zero mean and a standard deviation of 1.0. in: ignored
out: mean
in: ignored
out: std.dev
sctConstSum The selected items are scaled to a constant sum defined by the parameter Par1. in: intended sum
out: actual sum before the scaling
in: ignored
out: 0
sctConstSquaredSum The selected items are scaled to a constant sum of squared values. The sum is defined by the parameter Par1. in: intended sum
out: actual sum before the scaling
in: ignored
out: 0
sctMaxAbs The selected items are scaled in such a way that the maximum absolute value of each item becomes Par1 in: intended maximum
out: actual maximum of the absolute values of the minimum and maximum before the scaling
in: ignored
out: 0
sctRange The selected data values are scaled to cover a range between Par1 and Par2 in: intended lower value
out: actual lowest value before the scaling
in: intended upper value
out: actual highest value before the scaling
sctSquash The data values are compressed by a sigmoid function ("squashing function") to the interval [-1,+1]. The parameter Par1 specifies the origin of the squashing function, the parameter Par2 defines the slope of the function. in: origin of the squashing function
out: same as in
in: slope of the squashing function
out: same as in
sctQNormalize The selected data range is scaled to zero median and a difference between the median and the q-percentile of 1.0, with q (in %) given by the parameter Par1. in: probability q (>50 and <100)
out: median
in: ignored
out: difference of the quantile and the median before the scaling

The function returns the following error codes:

 0 ... everything is OK
-1 ... position is out of range
-2 ... time slot is out of range
-3 ... layers is out of range
-4 ... layers do not belong to the same group
-5 ... variance of spectrum is zero
-6 ... sum of spectrum is zero
-7 ... spectrum has a zero range
-8 ... maximum intensity is zero
-9 ... probability of quantile must be greater than 50 and less than 100