Application hints for Savitzky-Golay digital smoothing filters - American

Fachbereich Naturwissenschaften I, Angewandte Physik, Universitát Paderborn, Warburger Strasse 100, D-4790 Paderborn, West Germany. The processing of...
2 downloads 0 Views 457KB Size
Anal. Chem. 1981, 53, 1583-1586

1583

Application Hints for Savitzky-Golay Digital Smoothing Filters Manfred U. A. Bromba and Horst Zlegler” Fachbereich Naturwissenschaeen I, Angewandte Physik, Universitat Paderborn, Warburger Strasse 100, 0-4790 Paderborn, West Germany

The processing of spectra is often complicated by the presence of noise. The applicatlon of dlgltal smoothlng fllters Is a posslblllty for improving the accuracy of data extraction from those spectra. In lthls paper the fundamental properties of least-squares dlgltal polynomial smoothlng filters, popularIred by Savitzky and Golay, are summarized. On the bask of these properties the irange and the boundaries of applicatlon of these fllters are discussed. They are seen to be approximately optimal In the range of low slgnal deformation.

Much has been written about least-squares digital polynomial smoothing filters (Savitzky-Golay smoothing filters in short), e.g. (1-16). They are probably the most frequently used digital smoothing filters in spectromletry. Nevertheless, there seems to be still some vagueness about their properties. Also, the question “In what cases are these fiiters superior over other types of digital smoothing filters?” has not yet been answered in a satisfactory manner. This paper lists some of the most significant properties of Savitzky-Golay smoothing filters in view of their appropriate applications. Using the notation introduced in (11))a digital filter operator A is defined by m

but does not show maximal noise reduction for a given filter width. (2) If the moments pm of a signal f are defined by pm(n =

2 f[klkm

(6)

k=-m

it can be shown (8) that for every m with 0 5 m 5 2M

+1

(7) That is, a Savitzky-Golay smoothing filter of degree 2M exactly conserves every existing moment up to m = 2M + 1. For practical requirements it may be sometimes reasonable to define “truncated” moments with the summation in eq 6 going over a finite interval lkl 5 K where K depends on the fwhm of the line. The effect of smoothing on area which is defined in such a way (‘% 2a area”) has been studied by Tominaga et al. (12). Enke and Niemann (6) empirically stated an increase in area (jio(Dfi> ,ii&) The ).property of polynomial conservation (eq 4) appears to be completely equivalent to the conservation of moments (eq 7). So a Savitzky-Golay smoothing filter for a fiied width N is the moment conserving filter with most noise reduction. Note that for eq 7 to hold it is necessary and sufficient that the sum of all coefficients a2M[n]is one and all higher moments up to m = 2M + 1 are zero pm(D2Mf)

= h(f)

PO(~~= M )1

where f is the original spectrum with values f [ k ] ,Iz = 0 , f l , f 2 , ...,and a is the filter function. The brackets refer to the discrete character of thie functidns. For a Savitzky-Golay smoothing filter of degree 2M we may write

prn(am) = 0 (8) The (2M -+ 2)th moment of the filter function aW is seen to be (8)

N

D z ~ f [ k=:]

n=-N

a z ~ [ n l f [--kn1

(2)

since a 2 ~ [ n=]0 if In1 > N. The filter functions ao, u2, and a4 will be found, e.g., in 1‘4,211. a6 is derived with aid of the general formula given in1 (18) a6[4= P

( +~(y2n2 ~ + (y4n4i- (ysn6)

(3) where cyo = 3 5 P + 105N5- 280N4 - 735N3+ 4 9 7 P -+ 882N - 180, (112 = -(315N4 + 6 3 0 P - 189OW - 2205N + 2121))a4 = 6 9 3 P + 693N - 2310, ~ y g= -429, and fi = 35/(4(2N - 5)(2N - 3)(2N - 1)(2N + 1)(2N + 3)(2N + 5)(2N + 7)).

PROPERTIES The properties of Savitzky-Golay smootliing filters may be summarized as follows: (1) Let p ~ be +an arbitrary ~ polynomial of degree 2M 1 or less, then DZMi?2td+1 = P2M+1 (4) That is, a Savitzky-Golay smoothing filter of degree 2M conserves every polynomial signal of degree up to 2M + 1. Among all filters with filter width N (2N $. 1 points) having this property, Savitzky-Golay smoothing filters perform maximal noise reduction for stationary white noise. Note that multiple filtering D& also has the property ( 4 )

+

D2MmiD2M+1

= P2M+1

(5)

0003-2700/81/0353-1583$01.25/0

or, if N is large enough

The (2M + 2)th moment allows an approximate calculation of the systematicerror caused by smoothing, for further details see (15). (3) Another description of digital filtering is obtained by Fourier transform (3, 13, 14) 10

f(w) =

C f [ n ]exp(-iwn) n=-m

101

5

?r

(11)

realizing that filtering in frequency domain is equivalent to pointwise multiplicatio; of the “frequency response” 6 with the Fourier transform f of the signal

(Afi ( 0 ) = E(w)f(w) (12) Since the moments of the filter function are simply related to the frequency response and its derivatives a t w = 0, eq 8 are equivalent to 6(0 ,) =1 LW(0) = 0 (13) where 6(m)denotes the mth derivative of 8. In Figure 1 the frequency responses for the filters Do, D2, D4, and D6 are plotted (N = 10). Obviously Savitzky-Golaysmoothing fiters have a low-pass characteristic with flat passband. 0 1981 American Chemical Society

1584

ANALYTICAL CHEMISTRY, VOL. 53, NO. 11, SEPTEMBER 1981 "g'w'

Table I. Maximum Normalized S/N Enhancement for Some Smoothing Filters and Gaussian Peaks max optimizing nurnialized filter width S/N ( N resp RC) filter enhancement to fwhm ratio matched 1 1 Do D,

0.943 0.947 0.946 0.945 0.998 0.895

D4 D6

Do RC

0.59 1.15

1.72 2.31 0.47 0.88

density function of the noise. The deviation for uniform distribution, empirically obtained by Enke and Niemann (6) may be due to averaging too few samples. RANGE OF APPLICATION We have seen that a Savitzky-Golay smoothing filter acts as a low-pass that is optimal for polynomial signals. But in spectrometry we generally have nonpolynomial signals such as Gaussian or Lorentzian lines. The question may arise if or in which cases Savitzky-Golay smoothing is superior over other filtering techniques. This question can be answered by consideration of the statements of the last section. Evidently, polynomial filtering becomes approximately optimal, if the spectrometric signal becomes approximately polynomial. That is, within the filter span (2N + 1points), the signal f can be replaced by the first terms of its Taylor expansion fairly well such that

= P2M+1 f (17) In the case of Gaussian or Lorentzian lines, condition 17 is fulfilled if the filter width is essentially smaller than the full width at half-maximum (fwhm) of the line D2Mf

DZMP2M+l

N I

Flgure 1. Frequency response of Savitzky-Golay smoothing filters of degree 0, 2, 4, and 6. Filter width N = 10 (21 coefficients).

The effect of multiple filtering may be most advantageously considered with aid of the frequency response since the resulting frequency response of m-time filtering is simply ( & ~ ( w ) ) ~ . Slutsky-Yule oscillations, as conjectured by Madden (4), cannot happen because liT.zM(w)l

for every w satisfying 0 < 1wI 5

-