Analysis of X-ray spectra using fitting

11210366 · 2021-12-28

Assignee

Inventors

Cpc classification

International classification

Abstract

A method of analysis of X-ray spectra in an instrument fits a measured sample spectrum using a combination of at least one measured reference spectrum with at least one calculated function. The method includes measuring a reference spectrum as a plurality of measured values for a plurality of energy bins from at least one reference sample; selecting a region or multiple regions of interest corresponding to a plurality of the energy bins and, for each region of interest, recording the profile for the respective plurality of energy bins from the measured reference spectrum. The method further comprises measuring a sample spectrum as a plurality of intensity values for a plurality of energy bins; and fitting the measured sample spectrum to a fit function, the fit funtion including the at least one profile in at least one respective region of interest of the measured spectrum as well as the at least one calculated function.

Claims

1. A method of measuring one or more components in a measured sample in an instrument adapted to measure X-ray scattering, comprising: measuring, in the instrument, a reference spectrum as a plurality of measured values R.sub.pr(i) for a plurality of energy bins i from at least one reference sample; selecting, by a controller coupled to the instrument, n.sub.gr region or regions of interest from the measured reference spectrum indexed by j corresponding to a plurality of energy bins i and recording, in a data storage by the controller, a profile R.sub.pr.sup.j(i) for the respective plurality of energy bins, where n.sub.pr is a positive integer; measuring, in the instrument, a sample spectrum from the measured sample as a plurality of intensity values R.sub.spe(i) for a plurality of energy bins i; fitting, by the controller, the measured sample spectrum R.sub.spe(i) to a fit function to obtain a fitted sample spectrum; determining, by the controller, the one or more components in the measured sample based upon the fitted sample spectrum; and recording, in the data storage by the controller, the determined one or more components, wherein: the fit function is: R spe ( i ) = .Math. j = 1 n gr R gr j ( i ) + .Math. j = 1 n pr P pr j ( i ) .Math. R pr j ( i - i s ) + .Math. j = 1 n P j ( i ) ; there are an integer n.sub.gr calculated functions and respective line groups; R.sub.gr.sup.j(i) represents the j.sup.th calculated function which is a response value of a line group j; there are n.sub.pr profiles each in a respective region of interest; R.sub.pr.sup.j(i−i.sub.s) represents the j.sup.th profile; P.sub.pr.sup.j(i) is a profile modifying function for the j.sup.th profile; i.sub.s is a shift parameter for the profiles; R.sub.spe(i) is the measured sample spectrum; and Σ.sub.j=1.sup.nP.sub.j(i) is the sum of n functions P.sub.j(i) representing additional physical effects modelled based on a Monte Carlo simulation, where n is an integer.

2. A method according to claim 1, wherein there is a single profile (n.sub.pr=1) corresponding to the complete spectrum.

3. A method according to claim 1 comprising measuring the reference spectrum in a plurality of samples and taking as the plurality of measured intensity values of the profile a sum or average of the measurements of the reference spectrum of the plurality of samples.

4. A method according to claim 1 wherein the function Σ.sub.j=1.sup.nP.sub.j(i) is taken as zero.

5. A method according to claim 1 wherein at least one function P.sub.j(i) is a polynomial.

6. A method according to claim 1 wherein the profile modifying function P.sub.pr.sup.j(i) is a polynomial.

7. A method according to claim 1 wherein the profile modifying function P.sub.pr.sup.j(i) is a constant scale factor.

8. A computer program product embodied in a non-transitory computer-readable medium for measuring one or more components in a measured sample, the computer program product adapted when run on a computer connected to and controlling an instrument, which is adapted to measure X-ray scattering, to carry out the steps of: measuring in the instrument a reference spectrum as a plurality of measured values R.sub.pr(i) for a plurality of energy bins i from at least one reference sample; selecting, by the computer, n.sub.pr region or regions of interest from the measured reference spectrum indexed by j corresponding to a plurality of energy bins i and recording, in a data storage by the computer, the profile R.sub.pr.sup.j(i) for the respective plurality of energy bins, where n.sub.pr is a positive integer; measuring in the instrument a sample spectrum from the measured sample as a plurality of intensity values R.sub.spe (i) for a plurality of energy bins i; fitting, by the computer, the measured sample spectrum R.sub.spe (i) to a fit function, to obtain a fitted sample spectrum; determining, by the computer, the one or more components in the measured sample based upon the fitted sample spectrum; and recording, in the data storage by the computer, the determined one or more components, wherein: the fit function is: R spe ( i ) = .Math. j = 1 n gr R gr j ( i ) + .Math. j = 1 n pr P pr j ( i ) .Math. R pr j ( i - i s ) + .Math. j = 1 n P j ( i ) ; there are an integer n.sub.gr, calculated functions and respective line groups; R.sub.gr.sup.j(i) represents the j.sup.th calculated function which is a response value of a line group j; there are n.sub.pr profiles each in a respective region of interest; R.sub.pr.sup.j(i−i.sub.s) represents the j.sup.th profile; P.sub.pr.sup.j(i) is a profile modifying function for the j.sup.th profile; i.sub.s is a shift parameter for the profiles; R.sub.spe(i) is the measured sample spectrum; and Σ.sub.j=1.sup.nP.sub.j(i) is the sum of n functions P.sub.j(i) representing additional physical effects modelled based on a Monte Carlo simulation, where n is an integer.

9. A computer program product for measuring X-ray spectra according to claim 8, wherein there is a single profiled (n.sub.pr=1) corresponding to the complete spectrum.

10. A computer program product for measuring X-ray spectra according to claim 8, arranged to measure the reference spectrum in a plurality of samples and to take as the plurality of measured intensity values of the profile a sum or average of the measurements of the reference spectrum of the plurality of samples.

11. A computer program product for measuring X-ray spectra according to claim 8 wherein the function Σ.sub.j=1.sup.nP.sub.j(i) is taken as zero.

12. A computer program product for measuring X-ray spectra according to claim 8 wherein at least one function P.sub.j(i) is a polynomial.

13. An apparatus for measuring one or more components in a measured sample, comprising: an instrument adapted to measure X-ray scattering; and a controller adapted to control the instrument, the controller comprising data storage for instructions configured to cause, when executed, the controller to perform steps comprising: controlling the instrument to measure a reference spectrum as a plurality of measured values R.sub.pr(i) for a plurality of energy bins i from at least one reference sample; selecting n.sub.pr region or regions of interest from the measured reference spectrum indexed by j corresponding to a plurality of energy bins i and recording, in the data storage, a profile R.sub.pr.sup.j(i) for the respective plurality of energy bins, where n.sub.pr is a positive integer; controlling the instrument to measure a sample spectrum from the measured sample as a plurality of intensity values R.sub.spe (i) for a plurality of energy bins i; fitting the measured sample spectrum R.sub.spe (i) to a fit function to obtain a fitted sample spectrum; and determining the one or more components in the measured sample based upon the fitted sample spectrum; and recording the determined one or more components in the data storage, wherein the fit function is: R spe ( i ) = .Math. j = 1 n gr R gr j ( i ) + .Math. j = 1 n pr P pr j ( i ) .Math. R pr j ( i - i s ) + .Math. j = 1 n P j ( i ) ; there are an integer n.sub.gr calculated functions and respective line groups; R.sub.gr.sup.j(i) represents the j.sup.th calculated function which is a response value of a line group j; there are n.sub.pr profiles each in a respective region of interest; R.sub.pr.sup.j(i−i.sub.s) represents the j.sup.th profile; P.sub.pr.sup.j(i) is a profile modifying function for the j.sup.th profile; i.sub.s is a shift parameter for the profiles; R.sub.spe(i) is the measured sample spectrum; and Σ.sub.j=1.sup.nP.sub.j(i) is the sum of n functions P.sub.j(i) representing additional physical effects modelled based on a Monte Carlo simulation, where n is an integer.

Description

BRIEF DESCRIPTION OF THE DRAWINGS

(1) For a better understanding of the invention, the invention will now be described purely by way of example, with reference to the accompanying drawings in which:

(2) FIG. 1 is a flow diagram of an embodiment of a method according to the invention;

(3) FIG. 2 illustrates measurements on blank samples;

(4) FIG. 3 illustrates an example profile obtained from the measurements of FIG. 2;

(5) FIG. 4 illustrates a fit according to a comparative example;

(6) FIG. 5 illustrates a fit using a method according to an embodiment using the same data as the comparative example in FIG. 4;

(7) FIG. 6 illustrates a fit according to a comparative example;

(8) FIG. 7 illustrates a fit using a method according to an embodiment using the same data as the comparative example in FIG. 6;

(9) FIG. 8 illustrates a fit according to a comparative example;

(10) FIG. 9 illustrates a fit using a method according to an embodiment using the same data as the comparative example in FIG. 8;

(11) FIG. 10 illustrates measurements on a different sample, and the fit using a comparative example;

(12) FIG. 11 illustrates the difference between measured data and the fit using a comparative example;

(13) FIG. 12 illustrates the difference between the same measured data and a fit using a method according to an embodiment;

(14) FIG. 13 illustrates smoothed measured data used in the method illustrated in FIG. 12;

(15) FIG. 14 corresponds to FIG. 10 but using the method illustrated in FIGS. 12 and 13; and

(16) FIG. 15 is a highly schematic representation of an embodiment of an apparatus.

DETAILED DESCRIPTION

(17) For a better understanding specific embodiments will now be described, purely by way of example.

(18) Referring to FIG. 15, an embodiment includes XRF measurement apparatus 110 into which a sample or samples 120 may be inserted for measurement. The XRF measurement apparatus is connected to a controller 100 which contains a computer program product 130 for controlling the controller 100 and in turn measurement apparatus 120. The XRF measurement apparatus 110 in this embodiment is commercially available XRF measurement apparatus and so will not be described further.

(19) It should be noted that FIG. 15 is highly schematic and the controller 110 may be, for example within the casing of the measurement apparatus 100. The computer program product 130 may include multiple separate programs. Further, those skilled in the art will realise that the controller 100 may include one or more processors, data storage, and networks.

(20) Embodiments fit to measured data not just using the deconvolution approach but also by using simultaneously at least one measured profile, which may be the profile of all or part of the spectrum.

(21) In a first step (10) (see FIG. 1), at least one reference sample is placed in measurement apparatus and a spectrum is measured. The reference sample may be for example a standard sample or simply a reference sample similar to that of the sample to be measured. The intensity values are recorded as a function of energy, in a number of contiguous energy bands, creating a spectrum of measured intensity values over a plurality of bins, each bin corresponding to an energy range.

(22) In an example, a single blank standard can be measured. In other examples, multiple standards can be measured.

(23) In a second step (20), a profile is calculated from the measured data. Each profile is a set of measured values R.sub.pr(i) for energy bins i within a respective region of interest, ROI. In the case where only a single spectrum is measured, over the full measurement range, the profile can simply be a smoothed version of the measured spectrum and the region of interest can be the whole measured spectrum. In this case the profile may have non-zero values for all energy bins.

(24) In cases where other measurements are taken to measure effects in particular energy ranges, then the region of interest will be the region of that particular effect and the profile R.sub.pr(i) will have non-zero values only for values of i within the respective ROI.

(25) In a third step (30), a sample to be measured is introduced into the instrument. The spectrum is measured and recorded as a plurality of intensity values R.sub.spe(i) for a plurality of energy bins i.

(26) Next, a fit is carried out (40). The measured spectrum R.sub.spe(i) is fit to a combination of calculated functions, as in the conventional deconvolution method, together with the measured profiles in the respective region of interest, and optionally one or more further functions P.sub.n(i) which represent other effects that may be fitted.

(27) This may be expressed mathematically as fitting the spectrum R.sub.spe(i) as follows:
R.sub.spe(i)=Σ.sub.j=1.sup.n.sup.grR.sub.gr.sup.j(i)+Σ.sub.j=1.sup.n.sup.prP.sub.pr.sup.j(i). R.sub.pr.sup.j(i−i.sub.s)+Σ.sub.j=1.sup.nP.sub.j(i)  (1) wherein R.sub.spe(i) is the measured spectrum; R.sub.gr.sup.j(i) represents at least one calculated function which is a response value of a line group j, wherein the number of calculated functions and respective line groups is an integer n.sub.gr; there are n.sub.pr profiles each in a respective region of interest; R.sub.pr.sup.j(i−i.sub.s) represents the j.sup.th profile; P.sub.pr.sup.j(i) is a profile modifying function for the j.sup.th profile; i.sub.s is a shift parameter for the profiles; and Σ.sub.j=1.sup.nP.sub.j(i) is the sum of n functions P.sub.j(i) representing additional physical effects, where n is an integer.

(28) The calculated functions are obtained and fitted using a conventional deconvolution approach with constraints. Examples of this approach are provided in the previously mentioned Handbook of X-ray Spectrometry and so this aspect will not be described further.

(29) Note that the profiles are not simply subtracted from the measurements before fitting. Instead, the profiles are used integrally in the fitting process. The values of the parameters of the profile modifying functions P.sub.pr.sup.j(i) the calculated functions R.sub.gr.sup.j(i), and the functions P.sub.j(i) representing additional physical effects are all fitted in the step of carrying out a fit.

(30) Note that although in general additional physical effects are represented by functions P.sub.j(i), in the simplest case there are no such functions (n=0). In this case the fit is to the fit function:
R.sub.spe(i)Σ.sub.j=1.sup.n.sup.grR.sub.gr.sup.j(i)+Σ.sub.j=1.sup.n.sup.prP.sub.pr.sup.j(i). R.sub.pr.sup.j(i−i.sub.s)  (2)

(31) Further, the use of the shift parameter i.sub.s is also optional—the shift parameter takes into account drifts in the measured energy bins. If the reproducibility of data in energy is sufficiently good, the shift parameter may be omitted (mathematically i.sub.s=0).

(32) The method delivers significant advantages compared with the methods presented in the Handbook of X-ray Spectrometry. No assumptions need to be made in the profiles—they are simply measured. For this reason, even physical processes that cannot be easily modelled can be taken into account and compensated to a large extent.

(33) Further, contributions from spectral contaminations from non-sample related fluorescent or scattering processes are automatically removed from the deconvoluted spectra.

(34) Where one of the profiles corresponds to a blank sample, this may serve as a reference monitor spectrum which can take account of tube or detector degradation, for example caused by deposits of C or W on the anode or effects due to radiation damage. Such effects are particularly prevalent in on-line measurements in which apparatus is in continuous use.

(35) The method is of particular application to the measurement of trace elements, such as contaminants in plastics, traces in oil, pharmaceutical or air filter analysis.

(36) In embodiments, a blank sample may be incorporated into apparatus, for example in a sample holder, to allow the measured profiles to be remeasured on a regular basis, for example daily or hourly.

(37) The measurement works optimally in vacuum, since it does not take into account fluctuations in air pressure.

(38) Note that one or more profile modifying model functions P.sub.prmay be included, for example a polynomial:
P.sub.pr=α.sub.0+α.sub.1(i−i.sub.0)+α.sub.2(i−i.sub.0).sup.2+  (3)

(39) in which i.sub.o is an offset which may be treated as a fitting parameter; the coefficients a may also be treated as fitting parameters. Such a profile modifying function in the form of a polynomial can have a moderate effect on the widths of the peaks and may correct a profile for resolution changes—if the profile in use was measured at an earlier time but the resolution has deteriorated, it is possible to correct for this change using such a modifying polynomial.

(40) The method described here may account for ratio changes between two line peaks. In an example, when using a profile with a particular ratio of the Ka and Kb lines, for example Fe, it may be that the measured ratio of the Ka and Kb lines in the sample does not match the profile. In this case, theoretical model functions (calculated functions R.sub.gr.sup.j(i)) may be introduced for the Fe Ka and the Fe Kb lines. If the Kb line is too strong after scaling the profile for the Ka line, a negative value for the calculated function will allow the calculated value of the theoretical model of the Kb line to become negative and so compensate for the too-strong Kb line after the profile is scaled.

(41) In summary, in a preferred embodiment, the following details are adopted.

(42) During the step (10) the sample that is measured is preferably a properly defined standard i.e. a standard of known repeatable material. Such standards are commercially available.

(43) The measurement time in this step may be adjusted as long as required to obtain a significant reduction in measurement uncertainty in each of the energy bins. Alternatively or additionally, during the step (20) of obtaining at least one profile the measured spectrum may be carefully smoothed. A calculated background may be also subtracted. This step may be automated. The result may be checked for distortions.

(44) After the sample to be measured is measured (step (30)), then the measured data is fit (step (40)) to both the calculated functions R.sub.gr.sup.j(i) as well as the measured profiles R.sub.pr.sup.j(i).

(45) In terms of physical effects represented by the functions P.sub.j(i), these can represent a variety of additional effects that may need to be taken into account, for example additional atomic or nuclear effects such as Bremsstrahlung or Resonant Raman Scattering.

(46) Take, for example, the case of resonant Raman scattering. This effect becomes visible in a spectrum when the energy of a characteristic line is very close to but lower in energy than an absorption edge (e.g. K) of another element. In this case, a tailed distribution is introduced in the fitting model calculated from a doubly differential scattering cross section a as a that can be described using the following formula:

(47) d 2 σ rrs d Ω dE s = C ( E 0 ) ( U K + T e ) ( U K - U L ) ( U K - U L - E S ) 2 + ( Γ K 2 ) 2 ( 4 ) where E.sub.0 is the energy of the incoming photon, C(E.sub.0) is a constant that depends on E.sub.0, E.sub.s is the energy of the scattered photon (energy at a bin), U.sub.K is the absorption energy of the element, U.sub.L is the energy of the L absorption edge of the element and F.sub.K is the natural width of the K absorption edge of the element. To obtain the value of the fitting function P.sub.j from the cross section a, the formula must be integrated over energy within the width of a bin and convoluted with the detector's resolution. The U.sub.L can be allowed to vary as shift parameter and C(E.sub.0) as the scaling factor during the deconvolution.

(48) Another example of a physical effect is in sample induced photoelectron Bremstrahlung background. This can be calculated from a modified form of the original Kramer's formula:

(49) P j = K E 0 - E i E i ( 5 )

(50) where K can be a fitted parameter E.sub.0 can be either a constant energy or a fitted parameter and E.sub.i is the energy at a bin with bin number i.

(51) A further example of a function P.sub.j that may be used is an analytic function, generally a polynomial, to fit to the results of a physical effect which has been modelled by means of a detailed Monte Carlo simulation. Another example can be a theoretically calculated response of a Monte Carlo simulation. For example, when measuring oil samples, the scattered profile of the primary excitation spectrum by the dark organic radiation may be calculated by such a Monte Carlo simulation.

(52) Note that although many fitting algorithms use Gaussian functions for the functions R.sub.gr.sup.j(i) other functions may be used, including in particular Exponential tail functions. Other examples include Shelf functions, Voigt functions, and Hypermet functions, the last being linear combinations of Gaussian or Voigt main peaks with exponential tail and shelf functions. These functions are described in the Handbook of X-Ray Spectroscopy referenced above.

(53) Those skilled in the art may also use Lorentzian functions, generally together with Exponential tail or shelf functions, Pseudo Voigt functions, for faster implementation than Voigt functions, Pearson VII functions, or split functions to account for asymmetries. Such functions are known for XRF fitting, or in the case of Pearson or Split functions, for XRD fitting.

EXAMPLES

(54) In the example first presented below, a single profile was used, corresponding to a blank sample.

(55) In this case, a commercial collection of reference samples was used, namely the “ADPOL” collection from Panalytical BV. This is a set of reference samples in the form of polyethylene discs containing the following elements: F, Na, Mg, Al, Si, P, S, Ca, Ti and Zn. There are four samples with varying amounts of these elements to act as standards as well as four blank standards without.

(56) The samples were measured using a Ag tube at 9 kV, 600 μA, using a Ti filter and a silicon nitride window silicon drift detector in a Panalytical E3 X-ray fluorescence analysis apparatus.

(57) This example was chosen because a number of difficulties are presented by such samples using conventional methods.

(58) These difficulties include the fact that the signals for Al, Mg and Si are strongly influenced by the overlapping escape contributions of the scattered Ag lines. Consequentially, an accurate determination of these escape contributions requires an accurate deconvolution of the scattered tube lines. Such an accurate deconvolution is not straightforward since it requires complex “Fundamental Parameters (FP)” based model modifications to account for changes in the atomic line ratios of scattered lines.

(59) Secondly, the fluorescence peaks from P and S are positioned closely to the tail of the Ag L lines and are affected by a wide structure, which may be the result of diffraction effects. Any mathematical definition of the background therefore may result in a calculated component that differs substantially from the underlying component when carrying out measurements.

(60) FIG. 2 illustrates measured spectra from each of four blank (nominally identical) ADPOL standards as well as the sum and average. In order to obtain a measured profile from these measured spectra, the sum of the four measurements was smoothed. In this example, the region of interest is the whole of the region of fit and the whole of the energy range shown (up to 4.5 keV) and there is only a single profile used. Note that the line labelled “measurements and average” is in fact five plots of the same data (each of the four blank samples and their average) but the differences between these lines are too small to see on this graph.

(61) FIG. 3 illustrates the profile obtained by smoothing the summed spectrum, used in the following examples.

(62) Then, one of the non-blank standards in the commercial ADPOL standard collection was measured. This was then processed in two ways.

(63) By way of a comparative example, a conventional deconvolution approach was used. FIG. 4 illustrates the raw data, a background correction and the fit using a conventional deconvolution approach. Note that the data is presented as a linear graph not a log graph which explains the difference to FIG. 3.

(64) Although the conventional method does give reasonable results, in some cases there are significant differences between the fit lines and the raw data which indicates strong deviations and a poor fit—see especially the deviation about 3.4 keV. This means that the fit parameters cannot be treated as wholly reliable. The χ.sup.2 value of 183.9 indicates a poor fit.

(65) Then, a fit using the profile of FIG. 3 as the single profile in equation (1) was carried out and the results presented in FIG. 5. This profile is the blank spectrum over the whole measured energy range as the region of interest.

(66) In this example, a single profile R.sub.pr is combined with Gaussian functions R.sub.gr the latter describing the effect of the response of characteristic lines, i.e. the fit uses the first two terms of equation (1) above. Even with only a single profile (obtained from measurement) combined with Gaussian functions (obtained by calculation), the results are much better than using Gaussians alone.

(67) FIG. 5 shows the fitted blank background spectrum in this case with one profile (n.sub.pr=1) the term Σ.sub.j=1.sup.n.sup.prP.sub.pr.sup.j(i). R.sub.pr.sup.j(−i.sub.s) of equation (1) reduces to P.sub.pr(i). R.sub.pr(i−i.sub.s). FIG. 1 also shows the raw (measured) data and the fit data which align so exactly that the lines cannot be distinguished at the scale of the graph. In this case, fit is much better, indicated by a χ.sup.2 value is 1.871, almost two orders of magnitude better than the comparative example.

(68) Note further that the method of the invention in which the measured spectrum is included in the fit as a profile is much better than subtracting a blank spectrum and then just fitting the remainder using the conventional deconvolution approach as in the comparative example of FIG. 4 (negative values are avoided in the fit). Even in this example with only a single profile over the whole of the measured spectrum it will be noted that the fit to the measured spectrum is much better and there are fewer unexplained deviations.

(69) Good results were obtained with other conditions. The above experiments were repeated using 12 kV X-rays, 500 using an A1 filter in the same apparatus. FIG. 6 illustrates the fit using a comparative example and FIG. 7 an embodiment of the invention, the same method as discussed above with reference to FIG. 5. Again, the invention gives better results, though in this case the improvement in χ.sup.2 is less, from 1.47 in the comparative example to 1.11 using the method of the invention. This is expected as in this example the existing method already produces a reasonable fit, though not as good as that using the invention.

(70) A further example was then tested, using 50 kV, 200 μA and an Ag filter, with the comparative example presented in FIG. 8 and that using a method according to the invention in FIG. 9. In this case, the χ.sup.2 value improves from 1.86 to 1.126 using the method of the invention.

(71) The above examples show that even using only a single profile good results can be obtained.

(72) The method is also applicable to situations where more than one profile gives improved results. This applies in particular where only part of the spectral response has an important effect on the quality of the fit, and therefore a calculated response may be replaced with the measured profile in the region of interest to provide improved results.

(73) A specific example will now be described which relates to measurements of a coating of a pill containing significant quantities of Ti. The organic coating gives a number of peaks—in addition the Ti gives a pair of peaks at approximately 4.5 and 4.95 keV.

(74) FIG. 10 shows the measured spectrum (with a standard background removed), a fit using a standard background algorithm (i.e. a calculated spectrum based on the presence of a number of components, including Ti), and the residuals. At the scale of the graph the discrepancy between the raw and the fit lines is not easy to see, though it is visible at around 4.3 keV. Instead, the graph of the residuals shows the discrepancy more clearly. The fit gives a concentration of Ti. However, there is significant deviation from the fit in the region of the peaks between about 4 keV and 5 keV—especially note the deviation just above 4 KeV—demonstrating that the fit is poor in exactly the region of interest, i.e. the Ti peaks. The value of χ.sup.2 for this fit is 70. The poor fit leads to a lack of confidence in the concentration of Ti and possible V peaks of that are overlapping with Ti peaks.

(75) FIG. 11 illustrates the reason for this—the raw measured data (labelled unknown) does not exactly resemble the calculated data (labelled blank). The exact shape of the Ti peak as measured does not match the calculated data. Note that in FIG. 11 the graph has an x-axis corresponding to bins, not energy—the energy range 4 to 5 keV corresponds to bins 480 to 650.

(76) However, if the raw measured data (labelled unknown) is compared with measured data from a measured standard (labelled standard) then the line fit in the range 4 to 5 keV, corresponding to bins 480 to 650, is very good. See FIG. 12.

(77) Therefore, in a method according to an embodiment, in order to correctly fit to the measured spectrum (unknown) a smoothed version of the measured standard is used as the profile in a region of interest that is, in this example, not the whole of the measured range but in this case the region of interest is the range of bins 480 to 650 (approximately 3.8 to 5.2 keV)—corresponding to the two Ti peaks. This smoothed measured spectrum used as a profile is illustrated in FIG. 13.

(78) This profile is used instead of the calculated values from the standard background algorithm and Ti peak functions within this energy range (bins 480 to 650) to fit to the original unknown spectrum. Outside this energy range, the original fitting algorithm is used, i.e. outside the range of bins from 480 to 650, the fit is to a calculated function.

(79) The results are illustrated in FIG. 14, which shows the same data (Raw) as in FIG. 10. Note that the size of the residuals is less—in this case the χ.sup.2 value is approximately 12, compared with 70 in FIG. 10, indicating a much better fit and hence more reliable estimates of the concentration of Ti in the coating.

(80) In addition if a signal of V is hidden under the Ti-Kb peak and since minimization is not selective, non-fitted parts of the spectrum will influence the results obtained for this element as well By using a measured spectrum, not a calculated spectrum in the range of the Ti peaks, such effects can be taken care of without requiring the user to be aware of the underlying mechanism.

(81) Thus, referring to the general equation (1) above, only one line group is fitted using a profile, which is not offset, so n.sub.pr=1, P.sub.pr.sup.j(i) reduces to 1, and j only takes the value 1. Thus, the term Σ.sub.j=1.sup.n.sup.prP.sub.pr.sup.j(i). R.sub.pr.sup.j(−i.sub.s) reduces to R.sub.pr.sup.1(i) and is applied in the energy range from bins 480 to 650 corresponding roughly to 3.8 to 5.2 keV. This single profile corresponds to the Ti line group (the group of lines which are produced by Ti),

(82) The remaining composition of the organic coating is not represented by such a measured profile but by calculation. In this example, n.sub.gr=7 and each term in the equation Σ.sub.j=1.sup.n.sup.grR.sub.gr.sup.j(i), R.sub.gr.sup.1(i) represents the lines of a single element, such as calcium, iron, etc. Each line of each line group, representing for example the peaks observed at 6.4 keV and 7 keV, as well as the peaks between 1.5 and 3.6 keV, is represented by a Gaussian.

(83) The background in this example is precalculated. The precalculated background is added to the fitting model, so there is one additional function P.sub.j representing the background physical effect.

(84) Thus, in this example the region of interest for the use of the measured reference spectrum is not the whole spectrum, as in the example of FIGS. 1 to 9, but only the energy range of bins 480 to 650 (corresponding to 3.8 keV to 5.2 keV).

(85) By fitting the energy range of the Ti peaks using a measured spectrum, rather than fitting to calculated functions as used for the peaks of trace elements in the organic matrix spectrum, an improved fit can be obtained.

(86) This approach is not limited to this measurement but may be used in a wide variety of scenarios. For example, this same method may be used in particular to the measurement of A1 in low concentrations in a glass (SiO.sub.2) matrix.