Declaration: DeriveAllSpectra(FirstLayer, LastLayer, TimeSlot, Order, WindowSize: integer; Feedback: boolean): integer;
Calculates the (smoothed) first and second derivative of all spectra of the cube at the TimeSlot. The spectral range is controlled by the parameters FirstLayer and LastLayer. The original spectra are replaced by the derived ones. The parameter Order specifies the type of derivative (Order may assume 1 or 2). The parameter WindowSize defines the size of the processing window.

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 DeriveAllSpectra, 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 ... wrong Order parameter (only 1 and 2 are allowed)
-2 ... WindowSize out of range (valid range: 5 to 25)
-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 ... TimeSlot is out of range