Demonstrations of signal-to-noise enhancement: Digital filtering

Aug 1, 1985 - Bits and pieces, 25. Two demonstration programs for the Apple II involving signal-to-noise enhancement. Keywords (Audience):. Second-Yea...
0 downloads 0 Views 1MB Size
trum is displayed in a narrow hand a t the top of the screen. The user can then select what region is to he displayed hy moving and/or expandingJcontracting a rectangular window superimposed on the spectrum (note top of Figure 6 Part B). One canthen assien a reference wavenumher to any hand and the program will compute the others relative to it. Once the snectrum is suitahlv . disnlaved . . i t can he printed to a dot matrix printer (program written for an Apple Printer) and saved to disk. An auxiliary routine allows one to calculate, display, print, and save difference spectra from any pair of files saved on disk. Readers interested in implementing this program may obtain a free copy of documentation and detailed instructions by writing t o u s (BMM). Afloppy diskcontaining these programs is available for $10 (checks payable t o & r & & n Universitv).

DelpbPNations of Slgnal-to-Noise Enhancement digital Filtering L. Glasser

University of the Witwatersrand Johannesburg 2001. South Africa The conceptEof signal-to-noise ratio (SIN)measurement and enchancement are, as yet, unfamiliar to most chemists, hut increasing exposure to computerized laboratory instrumentation, with access t o methods of digital filtering, ensures that this situation is changing rapidly. I t is necessary that the student understand the advantages of, and prohlems in, digital filtering so that he may apply the techniques appropriately, and not he misled by signal distortions and displacements (9). He must also be made aware of the essentially cosmetic nature of the procedure. Since digital filtering lends itself to display, we have developed two demonstration programs (for the Apple I1 series of microcomputers) which have been used in successively refined versions in our Chemometrics course (10) since 1980, and which are described helow. The microcomputer display acts as an '.electronic hlackhoard" and experimental tool in this demonstration. Both demonstration programs start by offering the user a choice of a fixed, "sample" signal ((a) in Figs. 8 and 9) or the opportunity to synthesize a noisy signal ((a) in Fig. 7) consisting of the summation of from one t o three Gaussian curves together with normally distributed noise added in. For meed. the Gaussians are generated by. appropriate scal.. ing and shifting of a standardcurve rather than by individual calculation. The noise has a component independent of signal size plus an independent component scaled a t 10%of the instantaneous signal strength; this noise is generated by an approximate procedure due to Marsaglia and Bray (11). In hoth programs, the filter function may he altered in ap-

Figure 7 . (a) Synmesired waveform consisting of two Gaussians, with noise superimposed; (b) "box-car" filtered wavefo~m:(c) equal-weighted movingaverage filtered waveform.

propriate ways by the user, hy which he can readily investigate the effectsof changes of parameters such as filter width, filter decay constant, and spectrum truncation. The programs cycle repeatedly through their displays in order to facilitate such investigation. The first program (FILTER DEMO) displays the noisy waveform (containing 50 datapoints) in the upper half of the screen. On depression of a key, various filter widths (encompassing 3 to 9 data points) are made available. Then, a "boxcar" filtered version of the waveform is produced in the lower left quadrant; distortions in the rapidly changing regions of the waveform are readily visible. A second key depression produces a moving-average (with equal weighted elements) filtered waveform in the lower right quadrant, whose improved characteristics are evident (Fig. 7). I t is also possible to weight individually the elements summed into the average, as is demonstrated in the next section of the program. Thus, further key depressions cause a display of hoth a single-sided exponentially weighted filtered waveform, and of a douhle-sided exponentially weighted filtered waveform (Fig. 8). The user may choose the "time constant'' of the filter, and the program selects the correct number of elements to achieve an accuracy of better than 10%. The single-sided filter represents theiesult ofstandard electronic RC-circuit filtration, while the douhle-sided filter also takes account of the "future" pattern of the waveform, ahead of the central point in the weighted moving average, and so can only be performed digitally on prerecorded data. The peak displacement in the former may he contrasted with the more accurate.. nredictive. result of the latter. The . display should he accompanied by a discussion of the effect of a dieital smooth in filrerinr! out certain of the frequency comp&ents of the signal (12). I t is worth mentioning that these moving filterscorrespond to the mathematical process of convolving the signal with the filter function (13).

Flgure 8. (a) Noisy waveform (50 data points), as provided in the program: (b) one-sided $point exponential moving filter applied to (a): (c) symmetrical 5point exponential moving filter applied to (a).

Figure 9. (a) Noisy waveform of Figure 8 (a). zero-filled to 64 data points; (b) power spechum of (a) (32 paints): (c)spectrum of (a) truncated to 12 points; (d) low-pass filtered waveform. 1.e.. inverse Fourier nansform of (c).

Volume 62

Number 8 August 1985

691