CutPeakInAllSpectra

Declaration: CutPeakInAllSpectra (Layer1, Layer2, DeltaPiv, TimeSlot: integer; FeedBack: boolean): integer;
The function CutPeakInAllSpectra allows you to remove a peak in all spectra of the time slot specified by the parameter TimeSlot replacing it by an interpolated line. The parameters Layer1 and Layer2 specify the endpoints of the interpolation range (these are zero-based indices into the spectrum). The spectral intensities of the endpoints can be averaged by specifying the DeltaPiv parameter which defines the range around the end points. All points in the intervals [Layer1-DeltaPiv, Layer1+DeltaPiv] and [Layer2-DeltaPiv, Layer2+DeltaPiv] are taken to calculate the average y values which are then used as the basis for the interpolated line. DeltaPiv may take values from 0 to 10 (which results in 2*DeltaPiv+1 data points).

Setting Feedback to TRUE activates the progress bar to provide visual feedback of the process. Please note that unless the script progress bar is already visible you have to make it visible before calling CutPeakInAllSpectra, otherwise the feedback will not be displayed. You can activate the script progress bar by calling the function ScriptBar(0).

The following image shows the replacement of a peak by a linear interpolation between the endpoints Layer1 and Layer2. The black dots represent the original data, the red circles indicate the spectral line after calling CutPeakInAllSpectra.

The function returns the following error codes:

 0 ... everything is OK
-1 ... invalid DeltaPiv (valid range: 0..10)
-2 ... either Layer1 or Layer2 is out of range