Reference Manual

SPECTRUM

Signal Processing for Experimental Chemistry Teaching and Research / University of Maryland

Version 1.1, Dec, 1990. © 1988, 1989 T. C. O’Haver

The File Menu

New

Generates synthetic signals containing up to 5 user-selected components (Gaussian, Lorentzian, or sine wave) and an optional noise component. First, set the desired number of points, the first X value, and the X increment (i.e. the X interval between points). Use the radio buttons to select the desired shapes and fill in the height (amplitude) of each component. (Components with zero amplitudes are skipped). For Gaussian and Lorentzian components, specify the position on the X-axis and the width. For sine wave components, specify the number of cycles and the phase shift. The new signal is generated in the currently active signal window, replacing the signal in that window. Signals are limited to 1024 points in this demo version.

Open Y file...

Reads a signal data file from disk into the currently active window, replacing the signal in that window. Expects a plain ASCII text file in the format Y1 <CR> Y2 <CR> Y3 <CR>, etc, where <CR> represents a carriage return. If the data file consists of two or more columns of data, SPECTRUM reads only the first column. Alphabetic labels and blank lines are skipped. Data files may be prepared in a text editor, spreadsheet, plotting or data acquisition program, etc, and saved in ASCII (text only) format. Limited to 1024 points.

Open XY file...

Reads a signal data file from disk into the currently active window, replacing the signal in that window. Expects a plain ASCII text file in the format X1 <TAB or spaces> Y1 <CR> X2 <TAB or spaces>Y2 <CR> etc, where <CR> represents a carriage return. The columns can be separated by tabs or by any number of spaces. SPECTRUM assumes that the X interval spacing is constant and sets the X Increment to X2-X1; however this can always be changed later with the Set X-axis function. Alphabetic labels and blank lines are skipped. Data files may be prepared in a text editor, spreadsheet, plotting or data acquisition program, etc, and saved in ASCII (text only) format. Limited to 1024 points.

Save as Y file...

Saves the signal in the active window to the disk as an ASCII text file in the Y-only format, that is, as a series of Y-values separated by carriage returns.

Save as XY file...

Saves the signal in the active window to the disk as an ASCII text file in the XY format, that is, as X1 <TAB> Y1 <CR> X2 <TAB> Y2 <CR> , etc. Useful for exporting data to programs that require two columns, X and Y (e.g. Kaleidagraph). Disabled in demo version.

Page setup

Not implemented in this version

Print

Prints the signal in the active window to the chosen printer (ImageWriter or LaserWriter). Brings up the standard print dialog box, allowing selection of print quality and number of copies. As usual, Command-period cancels printing.

Quit

Quits SPECTRUM and returns to the Finder.


The Edit menu

Undo

Undoes the last operation, restoring the signal into the currently active window. Undo works for any operation which changes the signal in a non-reversible way (i.e. Open, Paste, Derivative, etc.)

Cut

Copies the signal in the active window to the clipboard and clears the current signal.

Copy

Copies the signal in the active window to the clipboard.

Paste

Pastes the signal in the clipboard into the active window, replacing the signal in that window.

Clear

Sets the signal in the active window to all zeros.

Edit points

Brings up a dialog box that allows you to inspect and edit individual data points in the active signal. You can use the Next and Previous buttons to brouse through the signal one step at a time, or you can jump to the First or Last points. You can type an integer point number directly into the Point box to jump directly to that point, or you can type an X value in the X Value box to jump directly to the point that has that X value (or to the closest point). At any point you can edit the signal by typing a number onto the Y Value box. When you click on OK, the modified signal will be reploted. (Of course, you can always Undo your changes).


The Transformation Menu

Normalize

Normalizes the signal in the active window, that is, sets the minimum to zero and the maximum to 1.00.

First derivative

Computes the first derivative of the signal in the active window by a two-point central difference formula. The formula is

D1=(X2-X1)/∆x

Di=(Xi+1-Xi-1)/(2∆x) for 2 < i < n-1

Dn=(Xn-Xn-1)/∆x

where n = number of points in the signal and ∆x is the x-axis interval between points.

Second derivative

Computes the second derivative of the signal in the active window by a three-point central difference formula. The formula is

D1=D2

Di=(Xi+1-2Xi + Xi-1 )∆x2 for 2 < i < n-1

Dn=Dn-1

where n = number of points in the signal and ∆x is the x-axis interval between points.

Rectangular Smooth . . .

Smooths the signal in the active window with an unweighted sliding average smooth. This algorithm replaces each point in the signal with the average of m adjacent points, where m is a positive odd integer called the smooth width. When you select this function, a dialog box prompts you to enter the smooth width. It is left to the user to select the smooth width which gives the best trade-off between signal-to-noise improvement and signal distortion. The optimum choice depends upon the width and shape of the signal. Typical values range from 3 to 51, or even higher.

For a 3-point smooth (m=3), the jth point in the smoothed signal Sj is

Sj = (Yj-1 + Yj + Yj+1)/3 for j=2 to n-1.

and similarly for other smooth widths. The (m-1)/2 points on either end (j1 and jn in this example) are replaced by the first and last values of the above series, respectively, because there are not enough data points to compute a full smooth for those points. As a result, important parts of the signal should not be positioned near the ends.

The main advantage of this algorithm compared to other smoothing algorithms is speed; for example, it is much faster than the Savitsky-Golay smooth, particularly for large smooth widths. Moreover, there are no negative terms in the convolution function, so a step or spike discontinuity in the signal will not result in negative-going oscillations in the smoothed signal. However, this algorithm results in slightly more distortion of Gaussian peaks, for a given degree of noise reduction, than the Savitsky-Golay smooth. Discussions of the algorithms used in this module can be found in Anal. Chem. 1979, 50, 676; Anal. Chem. 1981, 53, 1878; and Anal. Proceedings 1982, 19, 22.

Triangular Smooth . . .

Like the rectangular smooth, above, except that it implements a triangular smoothing function. The smooth width m is the half-width of the triangle. For a 3-point smooth (m=3), the jth point in the smoothed signal Sj is

Sj = (Yj-2 + 2Yj-1 + 3Yj + 2Yj+1+ Yj+2)/9 for j=3 to n-2.

and similarly for other smooth widths. This is equivalent to two passes of an m-point rectangular smooth (q.v.).

Smoothed second derivative . . .

Second derivative followed by three passes of the rectangular smooth (q.v.), all in one undoable step.

Integrate

Computes the integral (running sum) of the signal in the active window, that is, each point is replaced by the sum of all points up to and including that point, divided by the X interval between points. This is essentially the opposite of first differentiation.

Resolution enhancement

Performs a simple resolution enhancement operation, based on the weighted sum of the original signal and the negative of its second derivative.

Yj = Yj - kY''j

where Yj is the original signal, Y''j is the second derivative, and k is a user selected weighting factor. When you select this function, a dialog box prompts you to enter the weighting factor. It is left to the user to select the weighting factor k which gives the best trade-off between resolution enhancement, signal-to-noise degradation, and baseline undershoot. The optimum choice depends upon the width and shape of the signal. Typical values are 2 to 20.

Histogram

Computes the histogram (amplitude probability distribution) of the signal in the active window. When you select this function, a dialog box prompts you to enter the desired number of bins (i.e. Y-axis divisions.) Typical values are 10 to 30.

Interpolate...

Performs a linear interpolation of the current signal onto any specified number of X-axis points. This is used to change the number of points in a signal. When you select this function, a dialog box prompts you to enter the desired number of points, which can be less than or greater than the current number (but less than 1024).

Forward Fourier Transform

Computes the Fourier transform of the signal in the active window, using a Cooley-Tukey real fast fourier transform (FFT) algorithm which requires that the number of points in the signal be an integral power of 2. This function operates in a special way, using pairs of windows to display the real and imaginary parts. The signal whose Fourier transformation is to be obtained must be placed either in window 1 or window 3 before selecting this function. The real part of the transform will replace the original signal in window 1 (or window 3) and the imaginary part of the transform will replace the signal in window 2 (or window 4).

Inverse Fourier Transform

Computes the inverse Fourier transform of the signal in the active window, using a Cooley-Tukey inverse fast fourier transform (FFT) algorithm which requires that the number of points in the signal be an integral power of 2. This function operates in a special way, using pairs of windows to display the real and imaginary parts. Place the real part of the signal whose inverse Fourier transformation is to be obtained in window 1 (or window 3) and the imaginary part of the signal in window 2 (or window 4). The real part of the inverse transform will replace the original signal in window 1 (or window 3) and the imaginary part of the inverse transform will replace the signal in window 2 (or window 4).

Power spectrum

Replaces the signal in the active window with its power spectrum, calculated by taking the Fourier transform of the signal and adding the square of the real part to the square of the imaginary part. The number of points in the signal be an integral power of 2. Note that signal with n points gives a power spectrum with only n/2 points. The x-axis is the harmonic number. The first point (x=0) is the dc component. The second point (x=1) corresponds to the fundamental frequency, which is given by 1/t Hz, where t is the total time duration on the signal in sec. The last point in the spectrum corresponds to a frequency of n/2t Hz.

Convolute with clipboard

Replaces the signal in the active window with the convolution of that signal and the clipboard signal. The algorithm multiplies the two signals in the Fourier domain. First, the Fourier transform of each signal is obtained. Then the two Fourier transforms are multiplied by the rules for complex multiplication:

(a + ib)(c + id) = (ac - bd) + i(bc + ad)

The result is then inverse Fourier transformed. The number of points in the signal be an integral power of 2.

Deconvolute clipboard

This function deconvolutes the signal in the clipboard from the signal in the active window by dividing the two signals in the Fourier domain. First, the Fourier transform of each signal is obtained. Then the two Fourier transforms are (divided by the rules for complex division:

(a + ib) ac + bd bc - ad

________ = _________ + i _________

(c + id) c2 + d2 c2 + d2

In the divide operation, any point for which c + id = 0 is skipped. The result is then inverse Fourier transformed. The number of points in the signal be an integral power of 2.

Cross correlate with clipboard

Replaces the signal in the active window with the cross correlation of that signal and the clipboard signal. This is similar to the convolution function. The number of points in the signal be an integral power of 2.

Auto correlate

Replaces the signal in the active window with its autocorellation function. The number of points in the signal be an integral power of 2.

Fourier filter

Replaces the signal in the active window with a Fourier low-passed filtered signal. The algorithm works by taking the Fourier transform of the signal, then cutting off all frequencies above a user-specified limit, then inverse transforming the result. When you select this function, a dialog box prompts you to enter the cut-off frequency. The number of points in the signal be an integral power of 2.

Zero Fill...

Adds zeros to the end of the signal in the current window. When you select this function, a dialog box prompts you to enter the total number of points desired in the final signal. If that number is larger than the current number of points, the signal will be expanded to that number by adding zeros to the end.

Group points by 2s

Halves the number of points in a signal by averaging pairs of adjacent points. Use to thin oversampled signals.

Bridge segment...

Replaces any specified segment of a signal with a straight line. Rubber-band cursor can be used to specify segment. Used to remove spikes and artifacts. Can be used to remove peaks from a background in order to allow the background to be curve-fit or smoothed for later subtraction.


The Window Menu

Zoom windows

Zooms the the four main signal windows to full-screen.

Stack windows

Stacks up the four main signal windows.

Tile windows

Tiles the four main signal windows so that all signal are visible at one time.

Select Signal 1,2,3 or 4.

Make the designated window the active (i.e. topmost) window.

Swap with clipboard

Exchanges the currently active signal with the clipboard signal.

Superimpose clipboard signal

Temporarily plots the clipboard signal onto the currently active window, at the current X- and Y-axis scale expansion of the active window. The signal and the clipboard remain unchanged. The superimposed signal is plotted as a green solid line. Note: The superimposed plot is only temporary and is removed after the next operation.

Extract subset of points

Used to extract a specified range of contiguous points from a signal. When you select this function, a dialog box allows you to enter the first and last points numbers or X-values to extract. The signal is then replaced by the subset.

Expand on Y-axis

Doubles the Y-axis scale expansion of the current window and replots the signal. This operation has no effect on the data, only on the way it is plotted.

Contract on Y-axis

Halves the Y-axis scale expansion of the current window and replots the signal. This operation has no effect on the data, only on the way it is plotted.

Autoscale

Automatically adjusts the X-axis and Y-axis scale expansion of the current window so that the entire signal will be shown and replots the signal. This operation has no effect on the data, only on the way it is plotted.

Concatenate with clipboard

The signal in the clipboard is concatenated (merged end-to-end) with the currently active signal, replacing the original signal. The resulting number of points is of course the sum of the number of points in the two signals. The clipboard signal remains unchanged.

Reverse X-axis

Flips the signal end-to-end along the X-axis, as a mirror image. The X-axis itself remains unchanged.

Rotate . . .

Rotates the signal in the active window along the X-axis, wrapping points that “fall off” one end back to the other end. When you select this function, a dialog box prompts you to enter the number of points to rotate. The X-axis itself remains unchanged.

Expand on X axis

Doubles the X-axis scale expansion of the current window and replots the signal. This operation has no effect on the data, only on the way it is plotted.

Contract on X-axis

Halves the X-axis scale expansion of the current window and replots the signal. This operation has no effect on the data, only on the way it is plotted.

Set X axis values...

Prompts the user to enter the first X value and the X Increment (interval between the X values of adjacent points). SPECTRUM assumes that the X interval spacing is constant .

Set Y axis range...

Allow direct setting of any arbitrary Y axis limits.

Rubber band cursor

Initiates a procedure that allow you to use the mouse to specify a range of signal points along the X axis, for the purpose of measuring the area under the curve. When you select this function, the normal arrow cursor is changed into a mouse-controlled vertical line cursor. Position the cursor at the left end of the desired range and click the mouse button. The cursor line is erased. Now move the mouse to the right. You will see two black vertical lines extending below the signal line, one fixed at the first place you clicked and the other tracking your mouse movements. They are connected by a “rubber band” stretching between their tops. The two vertical lines define the selected X-axis range. Position the right-hand line at the right end of the desired range. The first line at the top of the window now displays area information. The “Total area“ is the area bounded by the signal curve, the X-axis, and two vertical sections of cursor that you just positioned. The “tangential skim” is the area between the signal curve and the rubber band line. Click the mouse or press any key to restore the normal arrow cursor.

The rubber band cursor may also be used to specify the range for the Extract subset of points function. Select the desired range using the cursor as explained above, then select Extract subset of points from the Window menu (or press command-K) and press RETURN.

Vertical line cursor

Changes the normal arrow pointer to a vertical line cursor. The top line of the window shows the current X-axis location of the cursor and the Y-value of the signal at that point. If the cursor is positioned between points, the Y-value is calculated by linear interpolation between the points before and after. Click the mouse button or press any key to return to the normal arrow pointer.

The Math Menu

Add constant

Adds a user-specified constant to the signal in the active window. When you select this function, a dialog box prompts you to enter the constant. Very large or very small numbers can be entered in exponential notation, i.e., 2e-6 for 2 x 10-6. Beeps and ignores your entry if you enter an illegal number format.

Multiply by constant

Multiplies the signal in the active window by a user-specified constant. When you select this function, a dialog box prompts you to enter the constant. Very large or very small numbers can be entered in exponential notation, i.e., 2e-6 for 2 x 10-6. Beeps and ignores your entry if you enter an illegal number format.

Add clipboard signal

Adds the signal in the clipboard to the signal in the active window, replacing the current signal. The clipboard signal remains unchanged.

Subtract clipboard signal

Subtracts the signal in the clipboard from the signal in the active window, replacing the current signal. The clipboard signal remains unchanged.

Multiply by clipboard signal

Multiplies the signal in the clipboard by the signal in the active window, replacing the current signal. The clipboard signal remains unchanged.

Divide by clipboard signal

Divides the signal in the clipboard by the signal in the active window, replacing the current signal. The clipboard signal remains unchanged. Zeros in the denominator are skipped.

Reciprocal

Replaces the current signal with its reciprocal. Zeros are skipped.

Log

Replaces the current signal with its common log. Zeros and negative points are skipped.

Peak Area

Calculates the “area under the curve”, that is, between the signal and the X-axis, within a user-selected X-axis range. When you select this function, a dialog box prompts you to enter the point numbers or X-axis values between which the area is to be calculated. The result is displayed in a pop-up window; click the mouse button or press a key to continue.

Standard deviation

Displays the standard deviation of the current signal in a pop-up window.

Absolute value

Replaces the current signal with its absolute value.

Antilog

Replaces the current signal with its antilog (i.e. anti common log).

Square root

Replaces the current signal with its square root. Negative points are skipped.

Ln

Replaces the current signal with its natural log. Zeros and negative points are skipped.

AntiLn

Replaces the current signal with its antiln (i.e. anti natural log).


The Curve Fit menu

The functions in this menu compute least-squares fits to the signal in the active window. The fitted Y values are plotted as an overlay on the signal (as a green line on a color display) and a small window pops up to display the coefficients of the fit equation and the standard deviation and variance. Click the mouse to continue. The signal data are not modified. The fitted Y values are also placed onto the clipboard (replacing the former clipboard contents) so that they may be transferred to another window or subtracted from the original signal data (to generate the residuals).

The equations for the fitting equations are as follows (where c1=coefficient 1, c2=coefficient 2, etc.)

Linear

Y = c1 + c2X e.g Coefficient 1 is the intercept and Coefficient 2 is the slope.

Quadratic

Y = c1 + c2X + c3X2

Cubic

Y = c1+ c2X + c3X2 + c4X3

Quartic

Y = c1 +c2X + c3X2 + c4X3 + c5X4

Quintic

Y = c1 + c2X + c3X2 + c4X3 + c5X4 + c6X5

Exponential

Y = c1exp(c2X)

Logarithm

Y = c1ln(c2X)

Power

Y=c1Xc2

The Line menu

Sets the plotting style of the currently active window. The selected plotting style remains associated with that window until changed.