DataLab is a compact statistics package aiming at exploratory data analysis. Please visit the DataLab Web site for more information....


EstimateBaselineOfSignal

Declaration: EstimateBaselineOfSignal (Data: TDoubleArray; FirstIx, Lastix: integer; CorrType: TBLCorrType; Stiffness, Asymmetry: double; NbHood, PolyOrder, NIter, Smoothing: integer; NegPeaks: boolean; Pivots: TIntArray; var BaseLine: TDoubleArray): integer;
Estimates the baseline of the signal contained in the array Data in the range from FirstIx to LastIx (valid range: 0 ... length(Data)-1). In order to process the entire signal both FirstIx and LastIx can be set to zero as a shortcut. The parameter CorrectionType determines the type of the baseline correction (valid values: bcPolynomial, bcPenSplines, bcLieber, bcEilers). The estimated baseline is returned in the variable array BaseLine. BaseLine is automatically adjusted to the length of the Data array. Values outside the interval [FirstIx,LastIx] are set to zero.

Depending on the CorrectionType various additional parameters are required, all unnecessary parameters are ignored:

type of correction parameters
bcPolynomial
  • The dynamic array Pivots specifies the wavelengths of the pivot points to be used for the correction.
  • The parameter NbHood defines the number of data points around the pivot points to be averaged for determining the intensity of the pivots.
  • The POrder parameter controls the order of the polynomial used as a baseline.
bcPenSplines
  • The dynamic array Pivots specifies the wavelengths of the pivot points to be used for the correction.
  • The parameter NbHood defines the number of data points around the pivot points to be averaged for determining the intensity of the pivots.
  • The Stiffness parameter controls the stiffness of the spline.
bcLieber
  • The Iterations parameter specifies the number of iterations used by the Lieber algorithm. Typically the Iterations parameter should be set to values between 10 und 30.
  • The POrder parameter controls the order of the polynomial used as a baseline.
bcEilers
  • The Iterations parameter specifies the number of iterations used by the Eilers algorithm. Please note that the number of iterations should not exceed a value of 8 (higher values slow down the calculations without improving the results).
  • The Smoothness parameter determines the flexibility of the calculated baseline. The lower the Smoothness parameter the more the baseline adapts to the data. The optimum value of this parameter depends on the data, typical value vary between 100 and 100000.
  • The Asymmetry parameter determines the weighting of the low and the high data values. The lower the Asymmetry value the more the baseline is shifted towards the lowest intensities.
  • Set the NegPeaks parameter to true if the peaks of the spectrum are negative.
The function returns the following error codes:

 0 ... everything is OK
-1 ... FirstIx or LastIx is out of range
-2 ... no. of pivots is too low for the selected polynomial order
-3 ... pivots are not within group range
-6 ... selected range of data points is too small (spectrum must contain at least 5 data points)