Method for the correction of background signals in a spectrum

A method for the determination and correction of background signals in a spectrum, consisting of signals of a plurality of spectral points, characterized by the steps of: Calculating at least three statistic or analytic functions of the signal values of the spectrum, attributing probabilities Pi(band) for the presence of bands to each point in each of the calculated functions: Adding the probabilities Pi(band) up to an overall probability ΣPi(band) from all calculated functions for each point; calculating a probability P(background) for the presence of background for each point in the spectrum from said overall probability ΣPi(band) according to P(background)=1−ΣPi(band) wherein negative values are set to zero; and calculating a fit of the signal values at all points of the original spectrum wherein the signal in each point is taken into account in the fit only with the respective probability for the presence of background P(background), and subtraction of the background function determined in such a way from the signal values of the original spectrum in order to generate a background corrected spectrum.

TECHNICAL FIELD

The invention relates to a method for the determination and correction of background signals in a spectrum consisting of signals of a plurality of spectral points.

Spectral analysis is one of the oldest methods for the investigation of solid, liquid or gaseous substances. It is a fundamental physical method which is successfully applied in many ranges such as, for example, astronomy, biology, chemistry and medicine. It uses the fact that all bodies interact with electromagnetic radiation. Natures of such interactions are emission, absorption, scattering and reflection of radiation. Devices for carrying out a spectral analysis are called spectrometer.

Each spectrometer has a dispersing element which influences electromagnetic radiation depending on a physical parameter to a different extent. Such parameter can be, for example, the wavelength λ, the frequency ν, or the energy E. By influencing the radiation as a function of the parameter, the radiation is spread and a spectrum is generated. Such a spectrum can be visualized, graphically recorded or be stored by means of the electronic data processing. Spectrometers are distinguished according to their design and their application: if matter is influenced by electric or magnetic fields they are mass spectrometers. If electromagnetic energy is influenced by material components they are called optical spectrometers. The influencing elements have in both cases equivalent names, such as, for example, ion lens/optical lens, ion mirror/optical mirror. Substances are identified with mass spectrometers due to the properties of their nucleus, with optical spectrometers substances are identified due to processes in the atomic shell. As far as substances or bodies shall be investigated with a spectrometer which do not represent an emission source themselves, the respective spectrometer has a so-called ionization or excitation source.

An optical spectrum is a continuous distribution of the electromagnetic radiation energy S or the intensity I as a function of the wavelength λ or the frequency ν. Characteristic features and structures in a spectrum enable conclusions regarding the source of the radiation and changes which occurred on its way to the detection in the spectrometer. The most important structures in a spectrum are the so-called bands. They are local maxima or local minima of the signal values, for example of the radiation energy S or the intensity I, on an otherwise only weak or non-structured background. If it is maxima, the spectrum is called an emission spectrum, if minima occur, it is called absorption spectrum. Such structures are called “peaks” in Anglo-Saxon literature.

It is an object of the spectral analysis t derive the origin and from this in turn the composition of the radiating body or substance in an emission spectrum or of the transmitted body or substance in an absorption spectrum using the position of such peaks in the spectrum and its relative strength. The quality of the spectral analysis increases with the accuracy with which the position and the strength of a peak can be determined. For this purpose it is necessary to determine the background always present as good as possible because each spectrum can be represented mathematically by a linear combination of background, one or more peaks, and a noise portion.

The background signal in a spectrum is caused by different processes. There is a portion originating from thermal radiation, i.e., a continuous distribution of the velocity of atoms or molecules of the investigated body or substance. There are additional portions originating in the spectrometer itself. This comprises in particular, but not exclusively, the dark current of the used detector.

PRIOR ART

With known methods for background correction the background is determined and subtracted from the signal afterwards.

DE 100 55 905 A1 discloses a method for the background correction in two-dimensional Echelle-spectra. Straylight and dark current of the detector are determined by measuring the intensity between the orders. Otherwise the background is determined by smoothing the curve by multiple application of a moving average. Values above the curse will be set to the value of the smoothed curve. The peaks will shrink with the number of operations while the remainder of the smoothed curve will fit to the original curve. The background calculated in such a way is subtracted from the original curve.

DE 196 17 100 B4 discloses a method for background correction where a function is fitted to the local minima.

DISCLOSURE OF THE INVENTION

It is an object of the invention to provide a device of the above mentioned kind, which enables an automatic and reproducible background correction with high accuracy.

According to the invention this object is achieved by a method with the steps of(a) calculating at least three functions of the signal values of the spectrum, wherein such functions are selected from:(A) mean(B) variance(C) skewness(D) kurtosis(E) moving average with a window width of 3 points(F) second derivative(G) median(H) maximum(I) minimum(J) difference between maximum and minimum(K) quotient of the central signal value and the mean value(L) quotient (maximum-mean value)/(maximum-minimum):(b) attributing probabilities Pi(band) for the presence of bands (20) to each point in each of the calculated functions;(c) Adding the probabilities Pi(band) up to an overall probability ΣPi(band) from all calculated functions for each point;(d) calculating a probability P(background) for the presence of background for each point in the spectrum from said overall probability ΣPi(band) according to
P(background)=1−ΣPi(band)
wherein negative values are set to zero;(e) calculating a fit (34) of the signal values at all points of the original spectrum wherein the signal in each point is taken into account in the fit only with the respective probability (32) for the presence of background P(background), and(f) subtraction of the background function determined in such a way from the signal values of the original spectrum in order to generate a background corrected spectrum.

A point therein is a value on the abscissa and can correspond to, for example, the image points on a detector (detector element, pixel), a wavelength interval, frequency interval or a mass.

The signal value is a value on the ordinate and may correspond to the intensity of an emission or absorption or an intensity in a mass spectrometer.

Contrary to known methods a probability is calculated with the method according to the present invention which indicates whether a signal is part of the background. The background signal determined with any spectrometer assembly, can be automatically and reliably quantified. Thereby, the recognition of bands and peaks is improved. Since the background signal is determined automatically it is independent from the opinion of the staff and can be determined quickly, reproducibly and reliably.

The method uses the finding that background signals in spectra are continuous and continuously differentiable and can be described by a continuously differentiable function. Examples for such functions are polynomials.

The method makes use of a selection of different functions (A) to (L). Consecutively to each point a window with always the same width is attributed. This is, for example, a window with 9 points. Four points are positioned on the left side of the center. Four points are positioned on the right side of the center and the point in the center is also counted. Windows having a width with an odd number of points are preferred because they have a point in the center which may be necessary with some functions. For each point of the spectrum as a center point the following is calculated:(A) mean (moving average): This is the 1st statistical momentum and is calculated according to formula (1) inFIG. 1.(B) variance: This is the 2nd statistical momentum and is calculated according to formula (2) inFIG. 1.(C) skewness This is the 3rd statistical momentum and is calculated according to formula (3) inFIG. 1.(D) kurtosis: This is the 4th statistical momentum and is calculated according to formula (4) inFIG. 1.(E) moving average with a window width of 3 points: This is a special case of (A) with a window width of 3 points.(F) second derivative: This is a function of the differential calculus here the curvature of a curve is described and calculated according to:
f′=d2x/dx2(G) median: this is a signal value which is found in the center after listing all signal values if the values are sorted according to their size.(H) maximum: This is the largest signal value in the respective window.(I) minimum: This is the smallest signal value in the respective window.(J) difference between maximum and minimum: This is the value which is obtained by subtracting the smallest signal value of the respective window from the largest signal value.(K) quotient of the central signal value and the mean value: This is the value which is obtained if the value at the center of the window is divided by the average value.(L) quotient (maximum-mean value)/(maximum-minimum): This is the value which is obtained if the difference between maximum and average value is divided by the difference between the maximum and the minimum.

All functions describe properties of the spectral distribution. A combination of three of such functions, preferably five, is sufficient to obtain sufficient information for the determination of the background distribution. Preferably such functions are calculated at least for two different window widths. Afterwards, probabilities Pi(band) for the presence of a band are attributed to each point. A high probability is, for example, attributed to a range where there is a peak and can be expressed as a number approximately 1-100%. For the calculation of the probabilities one of the selected functions (A) to (L) are used, respectively. A corresponding probability spectrum is derived for each of the selected functions.

Furthermore, the method according to the present invention provides that the probabilities Pi(band) determined in such a way are summed up to an overall probability ΣPi(band) from all functions on each of the points. The sum is calculated pointwise. An overall probability spectrum is obtained for the various probability spectra.

The overall probability spectrum can be inverted to a spectrum representing the probability for the presence of background. This is effected according to:
P(background)=1−ΣPi(band)

The larger the probability that a point belongs to a band or peak the smaller is the probability that the signal on such a point belongs to the background. Since the sum of the probabilities may add up to a value which is larger than 1 there is a possibility that negative values P(background) are obtained. They are set to zero. In other words: There is a band or peak on this point anyway.

A background function is determined by a fit through the signal values on all points of the original spectrum. The signal on each point is only taken into account only with the respective probability for the presence of background P(background) for the calculation of the fit. A point, where it is certain that a band is present, will, therefore, be entirely neglected. A point where it is certain that there is no hand or peak present, will be taken into account with its full value. Contrary to known methods, values where a probability therebetween must be assumed will be taken into account with such a reduced probability. This means that the probability P(background) is used as a weight for all points of the spectrum when the background function (fit) is mathematically determined.

Afterwards the once found background function is subtracted from the signal values and the background-corrected spectrum with analytically interesting bands and peaks remains.

In a particularly preferred embodiment of the invention the values of the calculated function are normalized by division by the mean value of the corresponding function values over all points. This step is preferably carried out immediately after the functions (A) to (L) or the selected functions are calculated. Normalized spectra are obtained.

In a preferred modification of the present invention the probabilities Pi(band) for the presence of bands are calculated by attributing a probability to each point having a parameter above or below a threshold, in particular above 1.3 and below 0.7, the attributed probability being proportional to the distance of the parameter from said threshold. The threshold S is generally in the range of 1, but other thresholds are, of course, also possible. Alternative embodiments use different calculation methods for the calculation of the probability.

Preferably, the probabilities Pi(hand) are multiplied by a factor αibefore calculating the overall probability in such a way that the following equation applies:
P(background)=1−ΣαiPi(band)

The use of a weight factor enables that functions having a higher relevance when bands or peaks are determined than others will be considered with a higher weight in the calculation than functions which are of minor significance.

In a modification of the invention the fit of the signal values on all points of the original spectrum is effected by means of a fit-function and the method of least squares. With such a method the square of the difference with the fit function is determined for each point. The sum of the squares of the differences is a measure for the quality of the fit function. Accordingly, the fit function can be optimizes until it adequately represents the background function.

In a further modification of the invention several fit functions of different type are used and the one with the smallest deviation of the least squares is selected. For example, the logarithmic values of the values on one or both axes can be used for optimizing the fit function. In any case each point will always be taken into account for the calculation only with its own probability.

For example, a polynomial can be used as a fit function for the fit of all points of the original spectrum. A linear function having the form y=a+bx may be sufficient already, where each point is considered with its probability. Furthermore, it can be checked if a preceding coordinate transformation having the form x→log x and/or y→log y will provide a higher quality of the fit function.

In a particularly preferred embodiment of the invention the method is carried out a plurality of times for at least two different window widths, preferably for window widths having 5, 9, 13 and 17 points and the one with the smallest deviation of the least squares is selected as a fit function. Depending on the width of the bands or peaks and the spectral distribution different window widths will provide different results. The functions (A) to (L) are separately calculated for each window width.

In a particularly preferred modification of the invention the following functions are selected:

(E) moving average with a window width of 3 points

(F) second derivative

(J) difference between maximum and minimum

(K) quotient of the central signal value and the mean value and preferably only the functions

(E) moving average with a window width of 3 points

(F) second derivative

Such functions will already provide very good results.

Modifications of the invention are subject matter of the subclaims. An embodiment is described below in greater detail with reference to the accompanying drawings.

DESCRIPTION OF THE EMBODIMENT

FIG. 2shows a spectrum generally designated with numeral10. The spectrum10shows signal values12which are detected, for example, with a line detector with a plurality of linearly arranged detector elements. Accordingly, the abscissa14is provided with numbers representing the position of the detector elements in the line. Values representing the signal value are shown on the ordinate16. Signal values ma he for example, intensities measured with a detector element.

The spectrum10is provided with ranges18where the signals extend very flat apart from some noise and which are presumably caused by background. A peak20can be recognized in the middle range.

It is an object of the automatized processing of this and any other spectrum to quantitatively determine the background and thereby enable a separation of bands (peaks).

In a first step the signal values are statistically analyzed. For this purpose a window width is selected. The present embodiment is carried out with a window width9. An example with such a window width is illustrated inFIG. 2. The window designated with numeral22comprises a center point12and four points on either side, respectively, i.e. 9 points altogether.

For calculating the first statistical moment, the average value—designated “function (A)” below—is calculated. The corresponding formula is designated with (1) inFIG. 1. The signal value12on point24is replaced by the average value of all points in the window22around this point12. This procedure is repeated for all points. The result of such a calculation of the function (A) is represented inFIG. 3. It can be recognized that flat ranges18will remain flat furthermore. The peak20, however, is flatter and wider. Individual spikes are removed.

Further functions are calculated in addition to the moving average of function A the results of which are represented inFIGS. 4 to 14. The calculation of the variance designated as “function B” is calculated according to the formula represented inFIG. 1(2). The result is shown inFIG. 4. The calculation of the skewness designated as “function C” is calculated according to the formula represented inFIG. 1(3). The result is shown inFIG. 5. The calculation of the kurtosis designated as “function D” is calculated according to the formula represented inFIG. 1(4). The result is shown inFIG. 6. In the formulas x designates the position of the point and N the width of the window which is, in the present case. N=9.

Further to the first four statistical momentums further functions are calculated:

Function (E) is the moving average with a window width of 3 points and corresponds to function A apart from the window width. The result of the calculation of function (E) is represented inFIG. 7. It can be recognized that a smaller window width causes less widening of the peak than a larger window width.

Function (F) is the second derivative and describes the distribution of the curvature. The result of the calculation of function (F) is represented inFIG. 8.

Function (G) is the median. It is determined as follows: the signal values in a window are sorted according to their size (value). The 5th-largest value, i.e. the one in the middle of the sorting, is the median at a window width of 9. The result of the calculation of function (G) is represented inFIG. 9.

Function (H) is the maximum of all values in a window. The central value of the window is replaced by the maximum value even if it is at the edge of the window. Accordingly, a very smooth curve without any spikes is obtained. Peaks are broadened very much. The result of the calculation of function (H) is represented inFIG. 10.

Function (I) is the minimum of all values in a window. The calculation is earned out in an analogue way as the calculation of the maximum value. The result of the calculation of function (I) is represented inFIG. 11.

Function (J) is the difference between maximum and minimum of all values in a window. The result of the calculation of function (J) is represented inFIG. 12.

Function (K) is the quotient of the central signal value and the mean value. The result of the calculation of function (K) is represented inFIG. 13.

Function (L) is the quotient (maximum-mean value)/(maximum-minimum) of the values in one window. The result of the calculation of function (L) is represented inFIG. 14.

It can be easily recognized that the functions (A) to (L) have different Offsets. Therefore, the values are normalized by dividing them by the average value of all points of the functions. Thereby, it is achieved that the values vary about the value 1. The result is shown inFIGS. 15 to 26for all functions (A) to (L).

Then, from the normalized values of the functions (A) to (L) probabilities Pi(band) are calculated that the signal value at the respective point belongs to a band or peak. A probability is attributed to each point having a normalized parameter above or below a threshold S which is proportional, to the distance of the parameter from the threshold mentioned above. The threshold S is always in the range or 1 apart from one exception. Such exception relates to the function (F)=y″, i.e. the second derivative. In this case S must be selected according to the structure of the bands in the spectrum: fine and narrow bands→S is selected to be a large value, wide or badly resolved bands→S is selected to be a small value. In principle the following applies:
Pi(band)=ri*(functionnormalized−Si)t,
wherein the proportionality factors r, are suitably selected, In as preferred embodiment of the method riand Sihave the following values:

A value of r=0 indicates that the corresponding function is not considered when calculating a probability and will, therefore, not influence the background function. A value of t=½ indicates that a root is extracted from the distance (function-S).

It does not make sense for all spectra to use all functions. Therefore, in the present case the functions (C), (D), (I), (J) and (L) were not further processed. The probabilities Pi(band) for the presence of a band or peak calculated from the remaining normalized functions are shown inFIGS. 27 to 33. The peak20can be well recognized in all such figures.

In a next step the probability values Pi(band), which are between 0 and 1, point wise added up for each point to an overall probability. It was found that some of the functions generally provide more relevant information than others. Therefore, the probabilities are multiplied with a factor αibefore calculating the sum to ΣαiPi(band). The result is shown inFIG. 34.

The larger the probability Pi(band) that a point is part of a band or peak the smaller is the probability Pi(background) that it shows background.FIG. 35shows the probability that background is present which is calculated according to
P(background)=1−ΣPi(band)

Since probabilities are between 0 and 1 all negative values are set to zero. High values inFIG. 35indicate that with a high probability there is only background present. In other words: each point in the spectrum has its own probability that there is only background. Such values are illustrated inFIG. 2in the form of vertical bars26. It can be recognized that there are no probabilities in the range of the peak20and indeed high probabilities arc calculated for the flat range18to be caused by background. Such automatically calculated result, therefore, corresponds to the visual perception.

The described method in the present embodiment is repeated fix several window widths, such as, for example, window widths with 11, 13, 15 and 17 points. It is understood, however, that such values are mentioned by way of example only and that depending on the spectral resolution, the computing capacity and the peak widths entirely different values can be useful.

As a result there are several probabilities for each point of the spectrum which were determined with different window widths. The N probabilities are sorted according to their values. Finally the value in the center is selected which corresponds to the median. Thereby, a very high stability regarding spikes is achieved with the N probabilities. Such spikes would otherwise have strong effects on the final result (calculation of the average, addition of values etc.),

In the following step a fit function is determined for the background. Such a fit function can be determined for the original spectrum. It is also possible to calculate a lit function for a spectrum which is shown in logarithmic form on one or both axes. From this for each selected window width of for example, 9, 13, 17 etc. points four functions can be derived. The fit functions are fitted by the method of least squares. Each point is taken into account only with the corresponding probability. Ranges where there is a peak are consequently not considered at all. The fit function which finally has the smallest error will be used for background correction.

A linear function was used in the present embodiment. It is, however, also possible to use polynomials with higher order or different functional relations.FIG. 36shows a real spectrum28with a peak30. A probability was attributed to each point of the spectrum according to the above method which is represented by a bar32, if a probability is present at all.FIG. 37shows the linear fit function34determined in the above described way. If such function34is subtracted from the signal values of the spectrum28it can be easily seen that apart from some small noise only the interesting peak remains. This can then be quantitatively evaluated.

The described method has the advantage that the background is automatically determined over the entire spectral distribution and not only locally. Thereby, a high reproducibility and accuracy can be achieved.