Declaration: ExtendDatacubeByDerivative(FirstLayer, LastLayer, Order, WindowSize, Group: integer; FeedBack: boolean): integer;
Extends the data cube by (LastLayer-FirstLayer+1) layers and fills the new layers with the smoothed derivative of the spectrum between FirstLayer and LastLayer. The parameter Order determines the order of the derivative (allowed values are 1 and 2), the parameter WindowSize specifies the size of the window used to smooth the derivative. WindowSize must be defined by an odd number between 5 and 25. The Group parameter controls the spectral group number of the new (derived) spectrum.

The parameter Feedback determines whether a progress bar indicates the progress of the calculations. Please note that unless the script progress bar is already visible you have to make it visible before calling ExtendDatacubeByDerivative, otherwise the feedback will not be displayed. You can activate the script progress bar by calling the function ScriptBar(0).

The function returns the following error codes:

 0 ... everything is OK
-1 ... invalid order
-2 ... WindowSize is out of range
-3 ... WindowSize must be odd
-4 ... WindowSize must be less than half of the spectral range
-5 ... FirstLayer and/or LastLayer are out of range
-6 ... group number is already used
-7 ... invalid group number