xraytools.

Peak Finding

Powder data

A diffractometer hands you thousands of points and every page that does anything with a powder pattern wants a handful of numbers instead. Peak finding is that step: fit the background, subtract it, decide which bumps are peaks, and measure each one. This page does it without fitting a peak shape, and it hands the answer straight to the pages that index the positions and take the widths apart.

Before this
A powder pattern is intensity against angle, and each maximum in it comes from one or more reflections at the same spacing — which is why a peak and a reflection are not the same thing. The forward calculation shows where they fall.
You supply
A raw scan — two columns, a position in degrees 2θ and a count, one point per line. No peak list, no widths and no wavelength except for the d column. If you have no scan to hand, the page simulates one from a structure it ships, so you can see what the search does to a pattern whose answer is already known.
Reading it
A peak finder has two failure modes and shows neither: noise read as a peak, and two reflections reported as one. The thresholds this page applies, and which of the two it can defend against at all, are stated under the results.

Worked examples: albite – 200 reflections, and the scan cannot resolve them all · rutile at 5 nm – the peaks merge, and nothing can undo that · a 0.1° step – the search stops at its floor of three steps · rutile with the Kα doublet – every line arrives twice · the same scan stripped – one line each again, and a new wavelength

Next on the path: Powder Indexing On From a measured scan to sample information, step 1 of 4

Notation here: θ, 2θ — what each one means here

Terms here: reflection

See also: Bragg Calculator · HKL Calculator · Line Broadening · Intensity Corrections · Powder Indexing

What each input changes
Report peaks above
How high a bump must be to count as a peak. Lower it and weak lines appear along with noise; raise it and real lines are dropped silently, which nothing downstream can detect.
Your scan
The measurement itself. A coarse step sets a floor on every width that comes out, and that floor is invisible in the answer.
Teaching with this page
Objective
After this page a learner can turn a raw scan into a peak list and name two failures the list cannot report.
Start from
this worked example
Ask first
A peak search returns eleven peaks from a scan. Are there eleven diffraction lines in the pattern?
Watch for
“Yes — the search found what is in the scan”
Then
Powder Indexing
Check yourself: A peak search returns eleven peaks from a scan. Are there eleven diffraction lines in the pattern?

Not established — a pair too close to resolve is found as one Yes — the search found what is in the scan

A search reports what it could separate. Two lines closer together than the instrument resolves give one maximum, and the search returns one peak for it — wider than either, which is the only trace left. A line below the noise is not in the list at all, and nothing marks its absence. So the count is a lower bound on the number of lines rather than a measurement of it.

Input

Your scan

One point per line, whitespace-, comma- or semicolon-separated — .xy, .xye, .dat and what a spreadsheet puts on the clipboard all work. A third column is ignored, so an .xye keeps its error bars. Anything after a # is ignored and a header row of words is skipped. A decimal comma cannot work here: a comma also separates the columns.

Å
% of the tallest
Or simulate one
° 2θ
× counts
nm, blank for large
% of the tallest

A scan this site generates rather than measures, so every line in it is known before the search runs — which is what makes the panel below a score rather than a claim. Drop the crystallite size to a few nanometres and watch the peaks merge.

This scan is simulated

Nothing was pasted in, so this is a scan this site generated rather than measured: rutile at Cu Kα, through the same forward model the powder simulator draws with, on a broad amorphous background with counting noise on top. The background and the noise are there on purpose: a finder shown clean peaks on a flat line demonstrates nothing, and the background is the step this page spends most of its care on. Paste your own scan over it.

What came back

19 peaks, at a full width of 0.081°. That width is a measurement in its own right: it is what the instrument contributes plus whatever the sample adds, and the line broadening page is where the two come apart.

peak — 2θ 27.457°, d 3.2485 Å, I 100.0, FWHM 0.0806°peak — 2θ 27.457°, d 3.2485 Å, I 100.0, FWHM 0.0806°peak — 2θ 36.106°, d 2.4876 Å, I 45.7, FWHM 0.0813°peak — 2θ 36.106°, d 2.4876 Å, I 45.7, FWHM 0.0813°peak — 2θ 39.221°, d 2.2970 Å, I 7.1, FWHM 0.0763°peak — 2θ 39.221°, d 2.2970 Å, I 7.1, FWHM 0.0763°peak — 2θ 41.272°, d 2.1874 Å, I 18.7, FWHM 0.0818°peak — 2θ 41.272°, d 2.1874 Å, I 18.7, FWHM 0.0818°peak — 2θ 44.077°, d 2.0545 Å, I 6.9, FWHM 0.0816°peak — 2θ 44.077°, d 2.0545 Å, I 6.9, FWHM 0.0816°peak — 2θ 54.363°, d 1.6876 Å, I 58.7, FWHM 0.0803°peak — 2θ 54.363°, d 1.6876 Å, I 58.7, FWHM 0.0803°peak — 2θ 56.670°, d 1.6243 Å, I 17.0, FWHM 0.0831°peak — 2θ 56.670°, d 1.6243 Å, I 17.0, FWHM 0.0831°peak — 2θ 62.808°, d 1.4795 Å, I 8.2, FWHM 0.0812°peak — 2θ 62.808°, d 1.4795 Å, I 8.2, FWHM 0.0812°peak — 2θ 64.099°, d 1.4528 Å, I 8.4, FWHM 0.0814°peak — 2θ 64.099°, d 1.4528 Å, I 8.4, FWHM 0.0814°peak — 2θ 65.574°, d 1.4236 Å, I 0.6, FWHM 0.0870°peak — 2θ 65.574°, d 1.4236 Å, I 0.6, FWHM 0.0870°peak — 2θ 69.061°, d 1.3600 Å, I 21.6, FWHM 0.0803°peak — 2θ 69.061°, d 1.3600 Å, I 21.6, FWHM 0.0803°peak — 2θ 69.861°, d 1.3464 Å, I 10.8, FWHM 0.0774°peak — 2θ 69.861°, d 1.3464 Å, I 10.8, FWHM 0.0774°peak — 2θ 72.482°, d 1.3040 Å, I 1.1, FWHM 0.0782°peak — 2θ 72.482°, d 1.3040 Å, I 1.1, FWHM 0.0782°peak — 2θ 76.604°, d 1.2438 Å, I 2.4, FWHM 0.0731°peak — 2θ 76.604°, d 1.2438 Å, I 2.4, FWHM 0.0731°peak — 2θ 79.900°, d 1.2006 Å, I 1.3, FWHM 0.0786°peak — 2θ 79.900°, d 1.2006 Å, I 1.3, FWHM 0.0786°peak — 2θ 82.411°, d 1.1702 Å, I 4.6, FWHM 0.0810°peak — 2θ 82.411°, d 1.1702 Å, I 4.6, FWHM 0.0810°peak — 2θ 84.322°, d 1.1485 Å, I 3.4, FWHM 0.0743°peak — 2θ 84.322°, d 1.1485 Å, I 3.4, FWHM 0.0743°peak — 2θ 87.560°, d 1.1142 Å, I 1.1, FWHM 0.0835°peak — 2θ 87.560°, d 1.1142 Å, I 1.1, FWHM 0.0835°peak — 2θ 89.634°, d 1.0937 Å, I 7.8, FWHM 0.0825°peak — 2θ 89.634°, d 1.0937 Å, I 7.8, FWHM 0.0825°reflection — 2θ 27.456°, I 100.0reflection — 2θ 27.456°, I 100.0reflection — 2θ 36.107°, I 45.7reflection — 2θ 36.107°, I 45.7reflection — 2θ 39.220°, I 6.9reflection — 2θ 39.220°, I 6.9reflection — 2θ 41.271°, I 18.9reflection — 2θ 41.271°, I 18.9reflection — 2θ 44.077°, I 6.9reflection — 2θ 44.077°, I 6.9reflection — 2θ 54.363°, I 58.5reflection — 2θ 54.363°, I 58.5reflection — 2θ 56.670°, I 17.5reflection — 2θ 56.670°, I 17.5reflection — 2θ 62.810°, I 8.4reflection — 2θ 62.810°, I 8.4reflection — 2θ 64.099°, I 8.5reflection — 2θ 64.099°, I 8.5reflection — 2θ 65.563°, I 0.7reflection — 2θ 65.563°, I 0.7reflection — 2θ 69.061°, I 21.5reflection — 2θ 69.061°, I 21.5reflection — 2θ 69.861°, I 10.6reflection — 2θ 69.861°, I 10.6reflection — 2θ 72.479°, I 1.2reflection — 2θ 72.479°, I 1.2reflection — 2θ 76.605°, I 2.3reflection — 2θ 76.605°, I 2.3reflection — 2θ 79.901°, I 1.3reflection — 2θ 79.901°, I 1.3reflection — 2θ 82.409°, I 4.6reflection — 2θ 82.409°, I 4.6reflection — 2θ 84.323°, I 3.2reflection — 2θ 84.323°, I 3.2reflection — 2θ 87.559°, I 1.2reflection — 2θ 87.559°, I 1.2reflection — 2θ 89.633°, I 7.9reflection — 2θ 89.633°, I 7.9102030405060708090foundreflectionscounts2θ / degrees
The dashed curve is the background this page fitted and subtracted; every height, width and area in the table is measured above it. Hover any mark to read its own numbers. The upper row of marks is where the peaks were found. The lower row is where the simulator actually put the reflections, which is not the same list: several reflections at one d make one peak. They are drawn in separate rows rather than on top of each other, because two marks at one place look like one mark and a near miss would look like a hit. There is no hover on a touch screen: the table below carries the same numbers. The whole scan. Zoom with the buttons above to look at one peak; the peak search itself always runs over everything you gave it, so the table does not change when the frame does.

How it did

This scan was generated by this site, so the answer was known before the search ran. The forward model put 20 reflections into it, of which 19 are strong enough to clear the reporting threshold. The search returned 19 peaks, and 19 of those reflections lie within one peak width of one of them — worst position out by 0.0112°, worst width out by 0.007°. 0 peaks correspond to no reflection at all. A match counts within one peak width (0.081°), because that is the resolution the scan physically has.

The peaks

Every peak the search found, lowest angle first. CSV
#2θ / °d / Åheightrel. / %FWHM / °area
127.4573.248529321100.00.08063720
236.1062.48761339345.70.08131711
339.2212.297020807.10.0763247
441.2722.1874547718.70.0818704
544.0772.054520206.90.0816259
654.3631.68761720158.70.08032172
756.6701.6243498517.00.0831658
862.8081.479524048.20.0812308
964.0991.452824548.40.0814315
1065.5741.42361810.60.087027
1169.0611.3600632321.60.0803794
1269.8611.3464317210.80.0774383
1372.4821.30403221.10.078240
1476.6041.24387062.40.073183
1579.9001.20063811.30.078649
1682.4111.170213524.60.0810174
1784.3221.14859923.40.0743116
1887.5601.11423361.10.083545
1989.6341.093722737.80.0825300

Heights and areas are in the units of the second column of your scan, above the fitted background. The area is the area between the two half-height crossings, doubled, and how that relates to the integrated intensity depends on the peak shape: for a Lorentzian peak exactly half the area lies between those crossings, so the doubled figure is the integrated intensity, while a Gaussian keeps 76 per cent there, so the same figure is 1.52 times too large. A real peak is between the two and which it is cannot be known without fitting a shape. Use the column for ratios between peaks of similar shape, where that factor cancels, and not as an absolute.

Where these go next

Both links carry the numbers above, so nothing has to be retyped.

The Kα doublet

A Cu tube emits both Kα lines, in the 2:1 ratio of the degeneracies of the two 2p levels, at 1.540562 Å and 1.54439 Å. Every reflection therefore arrives twice, separated by 0.076° at 30° 2θ and 0.285° at 90° — a separation that grows with angle and is not a constant in d, which is why no one cell accounts for both members of every pair and why indexing an unstripped pattern usually indexes on nothing at all. Nothing has been stripped here. Tick the box to subtract the Kα2 half by Rachinger’s method and watch both the peak count and the wavelength the table is read at change.

The width was measured, not typed

Nobody typed that width in. The search starts at 1°, measures the widths it finds, takes the median and runs again: 1 → 0.318 → 0.18 → 0.081. The median rather than the mean, because a merged pair of lines is a large outlier and must not drag the estimate. The starting value is above any laboratory peak width and not far above: a start below the truth sticks, because a width below the truth finds the shoulders of real peaks and shoulders are narrow, which confirms the wrong answer — and a start several times too wide fails in the other direction, sometimes without saying so.

What a peak list is evidence of

A peak finder can be wrong in two ways and neither of them shows in its output: it can invent a peak out of noise, and it can report two reflections as one peak or lose one of them. This page is built against the first, and the numbers are measured rather than claimed — the panel “How it did” above scores this very run against every line that went into the scan. Against invention there are two tests and a peak has to pass both: it must be the tallest point within one peak width, and it must clear 5 times the local noise. Local matters — counting noise goes as the square root of the counts, so one number for a whole scan is too small on the baseline, and it is the baseline that manufactures peaks. Against merging and against a lost neighbour there is no defence, and the reach is wider than one peak width. Two lines of similar height closer than about one and a half widths come back as one row, wider than its neighbours, which is the only sign. A weaker line within about two widths of a stronger one is not reported at all, and there is no sign: the stronger peak keeps its ordinary width. That second case is a limit of this search and not of the scan — such a line can be plainly visible in the chart above, and a Kα2 partner at the angles where the doublet is split by less than two widths is the commonest example. Look at the chart before trusting the count.

Three things this page does not do, each for a reason rather than for want of code. It does not fit peak shapes — there is no least squares here and no eta. A fitted shape gives a better width on an isolated peak and a confidently wrong one on an overlapped pair, and nothing here could tell you which it had just done. It does not separate overlapping lines, and it does not report a weaker line standing within about two widths of a stronger one. And it stores nothing: your scan arrives in the request and leaves with the answer, so there is no file, no upload directory and no retention question to have an opinion about.

Where this comes from