SmoothAllSpectra

Declaration: SmoothAllSpectra (FirstLayer, LastLayer, TimeSlot: integer; Mode: TSpecSmoothMode; WindowSize: integer; SmoothPar1, SmoothPar2: double; Feedback: boolean): integer;
Smoothes all spectra of the cube at a point in time specified by TimeSlot. The spectral range is controlled by the parameters FirstLayer and LastLayer. The parameter Mode specifies the type of smoothing:
spsmMovAvg ... moving average
spsmWgtAvg ... weighted moving average
spsmPolynomial ... Savitzky-Golay polynomial smoothing
spsmMovMed ... moving median
spsmPenSpline ... penalized spline
spsmSincBP ... sinc band-pass (convolved with a Blackman window)
spsmSincBS ... sinc band-stop (convolved with a Blackman window)
spsmSincHP ... sinc highpass (convolved with a Blackman window)
spsmSincLP ... sinc lowpass (convolved with a Blackman window)
spsmChebychevLP ... Chebychev lowpass filter
The parameter WindowSize defines the size of the smoothing window in the case of the moving window algorithms (spsmMovAvg, spsmWgtAvg, spsmPolynomial, spsmMovMed) and must assume an odd value. In the case of the penalized spline the WindowSize is irrelevant and ignored. For Chebychev filters it controls the number of poles and must be even (2..20).

The parameters SmoothPar1 and SmoothPar2 have different meanings for the various filter modes:

Mode SmoothPar1 SmoothPar2
spsmMovAvg,
spsmWgtAvg,
spsmPolynomial,
spsmMovMed
ignored ignored
spsmPenSpline controls the stiffness of the spine
valid range: 0.0 (no penalizing) to 1.0 (full penalizing)
spsmSincBS,
spsmSincBP
cut-off frequency of the lower limit of the band as a fraction of the sampling frequency
valid range: >0.0 to 0.5.
cut-off frequency of the upper limit of the band as a fraction of the sampling frequency
valid range: >0.0 to 0.5.
spsmSincLP,
spsmSincHP
cut-off frequency as a fraction of the sampling frequency
valid range: >0.0 to 0.5.
ignored
spsmChebychevLP cut-off frequency as a fraction of the sampling frequency
valid range: >0.0 to 0.5.
controls the ammount of ripple in the passband
valid range: 0 to 29 percent

 

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 SmoothAllSpectra, 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 ... FirstLayer and/or LastLayer are out of range
-2 ... TimeSlot is out of range
-3 ... invalid Mode
-4 ... WindowSize is out of range
-5 ... Smoothpar1 and/or Smoothpar2 is out of range
-6 ... WindowSize must be odd
-7 ... WindowSize must be less than half of the spectral range
-8 ... WindowSize must be even (Chebychev)
-9 ... Ripple is out of range (Chebychev: 0..29)