Fourier and Hadamard: Transforms in Spectroscopy - Journal of

Brent Shepherd and Michael K. Bellamy. Journal of Chemical ... Chemometrics. Steven D. Brown, Stephen T. Sum, and Frederic Despagne , Barry K. Lavine...
0 downloads 0 Views 5MB Size
Fourier and Hadamard: Transforms in Spectroscopy Darla K. Graff Venable Hall, CB#3290, University of North Carolina at Chapel Hill, Chapel Hill, NC 27599-3290. Mathematical transformations have found a wide range of application in the physical sciences, including various spectroscopic (1) and imaging techniques (Z), a s well as methods of signal compression for data storage (31. Generally speaking, a transform i s a mathematical operation that allows the direct mapping of information from one domain to another. I n many applications, the transform describes a physical relationship between two domains. The ability to convert mathematical data from one domain to another is particularly useful when analysis or experimeutation is easier in one domain than in the related domain. The most widelv used transform in snectrosconv . . is the Fourier ttxnsfiwm. Indt:(d, the dt:velopl;lent of crmputers and alm~rithmsthat r:ioidlv . " c;ilculate Fourier-tvve ". mathematics has completely revolutionized spectroscopy i n the past few decades. For beginning students, the mathematical properties of the Fourier transform can appear magical and its principles elusive. I begin with a general discussion of mathematical transforms followed by a simple example with a clear physical interpretation. The discussion will then focus on t h e Hadamard transform. Although fascinating and useful in its own right, an understanding of the Hadamard transform and its applications in spectroscopy will provide a unique perspective for the presentation of the Fourier transform (4). Finally, I will emphasize the similarity of the Hadamard and Fourier transforms while showing that each is unique with respect to the domains in the physical world that serve a s its basis. For simplicity and consistency, this discussion will make use of the symbols and properties of elementary linear algebra, with which the student should be familiar. Linear Transforms A transform is any operation that maps one vector space, X, into another, Y. Alinear transform, L, is defined a s one that conserves the properties of matrix addition and scalar multiplication. Y=L(X)

L(dD = cL(X)

for every X and X

for everyX and every scalar c

This discussion will be limited to cases in whicH the dimensions o f X and Yare equal and the linear transformation i s said to be one-to-one. I n other words, for every unique vector, X, there is one and only one vector, Y, defined by the transform. Velocity: A Simple Transform

A simple problem illustrates the concept of a linear transformation. Consider four objects a t the origin of a straight path that travel in the same direction for 2 h a n d then ston. What is the final distance between obiects 2 and 3? Obviously some necessary information is missing. The time traveled by each of the objects is known, yet we want to answer a question about distances. A "transform" is needed that will convert units of time to units of distance. 304

Journal of Chemical Education

These physical properties are related by the concept of velocity, and i n this problem, velocity serves as the transformation. If the four objects travel with velocities of 15, 10, 20, and 25 m h , the information can be "transformed" from the time domain, where the initial measurements were made. to the distance domain. This problem can be solved using the formalism of linear algebra. transforming time to distance usine a velocitv" matr&, V, which relatesthese two physical

meters -x hours = meters hour

"Time of travel" has now been transformed to "distance of travel". The data set is in the domain of choice, and a question regarding distance can be answered directly. To further illustrate the usefulness of linear algebra i n transform mathematics, suppose the velocities and the distances traveled by the four objects were given, and a question was asked about the time of travel. We then need an "inverse velocity" matrix. Algebraically, we obtain the new ex~ressionbv andvine a n inverse Vmatrix to both sides of

Because (by definition of inverse matrix), V1(V(t)) = t

(4)

we have

t=

dl

(5)

An introductory linear algebra text will present a procedure for finding the inverse matrix of any n x n nonsingular matrix (5).In this case, the inverse matrix is simply

Vl5 L-1 =

0

0

0 '/lo

0

[, 0

0 0

Y20

0

:]

0 Yzs

(61

This matrix allows u s to transform information i n the opposite direction of our original transformation; distance information (dl can now be converted back to time ( t ) .The V and V-' matrices are inversely related, and they constitute simple examples of linear, one-to-one transforms in the forward and reverse directions. Weighing Designs and the Concept of Multiplexing Before the Hadamard and Fourier transforms are discussed in detail, i t is important to understand what i s meant by the "multiplex advantage", which is an advantage gained when applying these transform methods to

problems in spectroscopy. Simply stated, the multiplex advantage can be obtained when each measurement of a system is comprised of contributions from multiple compon e n t s of t h a t system. If some subset of the system's components contributes to each measured value, then the advantage arises statistically from the fact that i f j measurements are made on a system with n components, each of the components will have contributed to more than just a single measurement. I n the course of taking a single measurement, we effectively make many. The trick is to be able to deconvolute the way i n which the multicomponent information was merged into each single measurement.

EI""' (10)

4.0iO.l

The mean square error associated with this weighing design is computed using eq l l , where R, is the true weight, andX, is the measured weight of the nth object.

For the trivial weiehina desim. the mean sauare error is

Weighing Designs

The concept of weighing designs i s useful i n illustrating the m u l t i ~ l e xadvantage. ., A weiehine .. .. desim is a ~rocedure hy which ;he m.iii of each ot'sevcral ul,j(!ii;i i d deierrnmed. C:i\vn ;I h.ilnnce w ~ t hunilbrm rrnbr. thr l>estwe~ahme - - design is the one most effective in acc&ately measuring the weights of n objects i n a specified number of measurements. The weighing procedure can be written as a matrix equation. Note the similarity between eqs 7 and 2.

Conversion Calculated weight of nth matrix object

Value of Ph measurement

Error ofPh measurement

the appendix: The Multiplex Advantage

A more useful and interesting weighing design involves measuring the objects in a series of various combinations on the single-pan balance, thus gaining the multiplex advantage (Fig. 1). Such a design is presented in the matrix equation below, with the transform matrix indicating once aeain how the weiehine ~rocedureis to be conducted. that is: which objects ( c h m y )will be placed on the balance (indicated bv a 1) dnrine each measurement (row). and which objects i l l be left &(indicated by a 0).

This expression indicates a transformation from j measurements on the right-hand side to the calculated weight of n objects on the left-hand side. The conversion matrix, q.,",serves as the transform. Each column of this matrix represents one of the n objects, and each row represents one of the j measurements, indicating for each, which of the n objects are to be placed on the balance for that particular measurement. The Diuial Design

An example will help to clarify this point. Let's begin with a set of four obiects and a single-oan balance. Assume that the true weigh& of the objects are 9 , 6 , 3 , and 4 g, and that the single-van balance has a constant error of f0.1 cr associated with each of its measurements. The simplest weighing design of this system consists of four measurements, where each measurement involves weighing one of the four objects individually on the balance. This design can be represented by the following matrix equation.

This weighing design is called the trivial design because its transform matrix is simply the four-dimensional identity matrix, accomplishing only the task of converting measured numbers from units of grams per measurement to units of grams per object. To solve this expression for the "unknown" X,, values, a n inverse conversion matrix must be applied to both sides of the equation (eqs 3-5). I n the trivial design, finding the inverse of the transform matrix is truly trivial: The inverse of the identity matrix is itself. Thus, applying the inverse matrix to both sides of eq 8, the solution is easily obtained.

Fagwe 1 I 4slrallon of a rneas c . . r l t Lsmg a sing e-pan oa ance corresponas to me Iomn ron r ' 'r L :OnVerSOn rna1r:X In eq 12 For example, row 1 of this "design" weighs objects 2, 3, and 4 with a total observed weight of 13 g on the balance. The other observed weights are 15, 12, and 13 g.

Again, the balance has a n error of 0.1 g associated with each measurement. Methods of linear algebra provide the solution for the inverse transform. r-1 1 1

11

This matrix can be applied to both sides of eq 12, and the "unknown" object weights are computed. Application of the inverse matrix to the transform matrix on the left-hand side of eq 12 gives unity. Thus, i t becomes a simple matrix multiplication problem to solve for the unknownx" values.

Volume 72 Number 4

April 1995

305

The mean square error, eq 11,for this weighing design i s 0.007. The same number of measurements were used in this design a s in the one previous, yet the mean square error was improved by about 30%. This illustrates the multiplex advantage. The experimental design has allowed multiple measurements of four objects to be made i n only four total measurements and thus has statistically improved the precision of the results. As a final weighing design, consider a case involving a two-pan balance (see Fig. 2). As in the previous example, n = 4 and j = 4. Using the two-pan balance (again with a n error of 10.1 g), all n objects can be included i n each of the j measurements. Again, the experimental procedure is dictated by the transform matrix. I n this example, +1 in the nth column indicates that the nth object is to be placed in one Dan. and -1 indicates that i t is to be laced i n the alt e r n k e pan for that j t h measurement (row). The observation weight is the imbalance between the two pans.

object was measured only once. I n the second example, the combination design using the single-pan balance, the summation over column 1eives a value of 3. and the summation over each of the remaining columns gives a value of 2. In the third example, the summation down each of the four columns yields a'value of 4, each object contributing to each measurement made. As thev were .presented. the three weighing-design examples i&olved more and more multiplexing and consequently had a smaller mean-square error associated with thkir results. Deconuolution The matrices used in weighing designs serve to transform the observed weights into individual object weights by deconvoluting the way in which the components of the system are combined to give the observed measurements. As noted above, the transform matrix represents a physical relationshin inherent in the svstem being.. urobed. In ,~ -~~ the, prrcrding weixhinpdesign examples, this physical reI;~tionshioi i sirnnlv thnt an obiect can onlv bc w e i"e h d if it is p ~ a c e d b nthe 6aiance. In spectroscopic applications, techniques of multiplexing allow the simultaneous detection of the different frequency comoonents of radiant enerw. Similar to the concent of wei&ing designs, the multi$lx advantage can increase the simal-to-noise ratio for a fixed number of snectral measurements. The transforms used in such appfications are based on fundamental characteristics of light, allowing observed intensities to be deconvoluted, yielding the specific frequency components t h a t comprise them. Two such transforms are the Hadamard and the Fourier. ~

Once again the inverse matrix, eq 16, is used to solve the

~

~

~~

The Hadamard Transform It can be shown that the best w e i ~ h i n design s (smallest associated error) involving a two-pan balance uses a special matrix called the Hadamard matrix. The Hadamard matrix is characterized by the following properties 16):. 1. It is an n x n matrix with orthogonal raws (and columns)

Figure 2. Illustration of a measurement using a double-pan balance; corresponds to the fourth row of the conversion matrix in eq 15.

such that

matrix equation for the unknown weights, eq 17. 2. It is normalized when all elements of the first row (and column) are +1and all other elements are +1or -1. 3. Due to the above restrictions, it is easy to show that Hadamard matrices exist for dimensions of 1, 2, and all multiples of 4. 4. When used as a weiebine desim. this t v ~ of e matrix re-

S Matrices

- -

The mean sauare error (ea 11)for this weiehins design is .. OU025, a 75"r inlprlrwrnlmt over thnt ohtained for the trivial dvsifin and a 64'; lrnoro\.emcnt over th.it obtained fur the combination design ;sing the single-pan balance Evaluating the Multiplexing The multiplexing that occnrs in each of these design systems can be evaluated by summing the absolute value of the entries in each column of the transformation matrix. The nth column represents the nth object, and by summing over all of the j rows ( o r j measurements) we see how many times in the course of the entire experiment each of the n objects was actually weighed. In the first example, the "trivial" design, the summation down each column gives a value of 1, indicating that each 306

Journal of Chemical Education

For measurements made on a single-uan balance. the best weighing designs use special matrices called S matrices. which are derived from Hadamard matrices. An S mat r i i is defined a s follows "

2

1. It is an (n - 1)x (n - 1) matrix ohtained hy deleting the first row and first column of a normalized Hadamard matrix and changing all the +1 values in the matrix to 0 and all the -1 values to +l.

2. S matrices exist for dimensions of 4x. - 1 (i.e., 3 , 7 , 11, ...I. 3. As compared to the trivial design, an S matrix weighing design reduces the mean-square error by s factor of (n +

112/4n andinereases the signal-to-noiseratio by a factor of

A:

Spectrometer

in + l)l2n1".

General lnstrumental Design A general instrumental design for application of the Hadamard matrix to spectroscopy is shown in Figure 3a. The process begins when light from a photon source is passed through the sample and then dispersed from a grating. At this point, the light carries frequency information pertaining to the sample. The dispersed light is passed through a gated mask (called the Hadamard mask) that has open gates (light squares), allowing some frequency components to pass directly through to the detector, and mirrors (dark squares), reflecting the other components to a second detector. Components passed through (or reflected by) the mask are optically recombined, reaching each of the detectors with some combined intensity, I,. The total intensity of the raw data is obtained by adding the measurement from the first detector to the negated measurement of the second = I,,; - Izj,and i t refers to the intensity measdetector, lbtj ured with t h e j t h pattern of gates and mirrors on the Hadamard mask. The opened and mirrored slits of the mask are constructed to correspond exactly with the 1's and -1's of each row of the Hadamard matrix.

Hadamard mask

6:Encodeuram

I

Hadamard Mask The mask in Figure 3a is coded for the second row of the following four-dimensional Hadamard matrix, where a gate (light) in the mask is represented i n the matrix by +1, and a mirror (dark) by -1. A mask is constructed for each row of the Hadamard matrix, and the total intensity detected for each mask, is recorded in the column on the left.

C: Spectrum

I The Hadamard matrix (jrows, n columns) thus represents the positive or negative contribution of the nth frequency component in the total intensity, I,, measured with the jth mask configuration. Raw experimental data from a Hadamard instrument is called an encodegram (Fig. 3b), plotted as total intensity, I,,tj, versus mask configuration (or encodement) number, j. 'Ii-ansform mathematics deconvolute the frequency information from the raw encodement data. The definition of Hadamard matrix (above) makes i t easy to obtain the inverse Hadamard matrix. HTindicates the transpose of the H matrix, obtained by interchanging the rows and the columns of the matrix. For a symmetric matrix, the transpose is equivalent to the original matrix.

Application of the inverse matrix to both sides of eq 21 transforms the intensity information from units of "perjth mask configuration" to units of "per nth frequency", providing the benefit of the multiplex advantage. The final frequency spectrum is plotted in Figure 3c as intensity, In, , , versus wavelength, kw,,.

mask #

frequency

I

Figure 3. (a) General instrumentation of a Hadamard spectrometer. (bj Encodegram from a 64-dimension Hadamard encodement experiment. (c) Frequency spectrum of two Lorentzians with 64 resolvable frequencies, obtained by applying the inverse Hadamard transform to Figure 3b.

The mask in Figure 3a is called a "Hadamard mask" because it is coded in the positivelnegative manner (+I/-1) representative of a Hadamard matrix. However, a similar mask can be constructed in the odoff manner (011)of the S matrix. In this case, there is only one detector, and the gates are either open, allowing frequency components to pass through and be detected, or they are simply blocked. Instruments involving S-type matrices are much easier to construct because they do not require the construction of a mirrored mask with adequate reflectivity and minimized edge effects, as do Hadamard-type instruments. As stated above, Hadamard matrices result in more multiplexing and better signal-to-noise ratios than S matrices. Although Hadamard-type instruments have been hypothesized and discussed in the literature, applications of S-type instruments are far more practical and predominant. Volume 72 Number 4 April 1995

307

The Hadamard transform does mathematically what the spectroscopic grating does physically. More specifically, the transform relates the wavelength (frequency) of scattered light with the angle a t which it is scattered from the grating (quantified a s slit number in the mask encodement). The transform (also the grating) allows the simultaneous detection of various spatially separated components of light and makes that equivalent to a direct resolution of the various frequency components of the spectrum. The Fourier Transform The instrumental comoonent that allows a~vlication of .. the Fouricr trdnsfortn is t l ~ cinterferonierer, illusrrated in Firwre l a The interferometer is cornvnsed ot'rnro mirrors atuthe end of perpendicular paths, one stationary and the other movable. With this design there is constructive and destructive interferences of the light waves that pass through the sample as one of the mirrors is moved a t constant%elocity. The resultant light is sent to a detector where signal intensities are recorded a t constant step sizes and a s a function of mirror disdacement. This is accomplished by simultaneously monitoring the rapid interference pattern of a laser line with a known frequency Maximal points of constructive (or destructive) interference will occur when the displacement of the mirror is equal to the wavelength (or equal to half the wavelength) of the laser beam. These voints of the laser line are distinguished electronically a i d used to trigger the detector to collect the data pertaining to the sample. If the velocity of mirror travel is held constant, the detection of points equidistant in mirror disolacement would be eauivalent to detection of points equidistant in time. E x ~ e r i m e n t a ldata are recorded a s a n interferonam (Fig. 4b), light intensity measured a t each time (mirror distance) point. An interferogram is the interference pattern of two light beams being passed through the sample as the "phase" of one beam is varied with respect to the other. The frequency composition of the light ultimately determines how constructive and destructive interferences will express themselves in the observed intensity as the mirror is moved. Frequencies absorbed or emitted by a sample will modify this interference pattern. The frequency spectrum of the sample may be recovered from the interferogram by a Fourier transform (Fig. 4c). Fourier Equations

Fourier equations are presented in detail in most standard textbooks for mathematical applications in the physical sciences (7). The Fourier relationship can be written in the following manner, indicating the transformation of a function from the time domain, fit), to the frequency domain, F(v).

A: Interferometer

stationmy mirror

movable

mirror light

6: lntetterogram

I

time

C: Spectrum

F gue 4 (a, Genera mstrJmenlal on of a Fo4rer speclromeler (tne ntederomeler, (or lnlederogram of a 64-polnl Fo~rerexpermenl. (c, Freq~encyspec1r.m of two Lorentllans wlln 32 resolvao e frequencies, obtained by applying the inverse Fourier transform to Figure 4b. (Dueto the complex nature of the Fouriertransform,the other 32 resolvable frequencies are mirrored on the negative side of the spectrum.) ,-

At) = e'2'v1~(v)dv

-

-

For an exoerimental situation. such as that involving an interferometer, in which it is impossible to make an "infinite" number of time measurements. the Fourier series equations are used. These equations are analogous to eqs 24-27, but they use a sum rather than a n integral and correlate n discrete time measurements with m resolvable frequency elements. N-l

N-1

F(v,) =

The indefinite integral convolutes the time function with continuous trigonometric functions and relates it to the frequency function. The inverse Fourier transform converts data in the reverse direction. from the freauencv to the time domain.

-1

At) =

308

(cas

a

where

+-

2mt i s i n 2mt)F(v)dv

Journal of Chemical Education

(26)

(27)

x

n~

(COS

2m,t, - isin 2m,t,)fltn)

=

x

"dl

eL2'"mt"f(tn) (28)