xdart · Peak Fitter · physics and fitting guide

What a diffraction peak measures, and how the Peak Fitter fits it

A diffraction peak is the signature of one family of lattice planes. Its position gives their spacing, its width the size and strain of the crystallites, and its area how much of the phase is there. This guide starts with that physics, then shows how each number the Peak Fitter reports follows from it.

6 profilespseudo-Voigt, Gaussian, Lorentzian, Voigt, Pearson VII, split pseudo-Voigt
6 backgroundsnone, a polynomial or Chebyshev of a chosen degree, and three template backgrounds
1 to 12 peaksfound automatically, counted, or placed at typed centres
Notebook exporta fit exports to Jupyter and marimo, with its template once a fit has recorded the template's file
The physics

Where a peak comes from

lattice planes d incident beam, k scattered beam, k′ θ θ q = k′ − k Bragg's law λ = 2 d sin θ q = 4π sin θ / λ d = 2π / q A peak at q = 2.00 Å⁻¹ means planes 3.14 Å apart, whatever the wavelength.
Waves scattered by successive planes add up only when the path difference is a whole wavelength. Then the scattering vector q points along the planes' normal and its length is 2π/d. Working in q makes the peak a property of the sample alone: the same planes give the same q at any energy, while in 2θ the same peak moves with the wavelength.

What a peak measures

1.81.851.91.9522.052.12.152.20200400600q (Å⁻¹)Intensityposition q₀ → d = 2π/q₀width Δq → size and microstrainarea → amount, |F|², texture
Three numbers carry the physics. The position q₀ gives the plane spacing, and with the reflection's indices the lattice parameter. The width at half maximum grows as crystallites get smaller and as microstrain grows, on top of the instrument's own width. The area above the background grows with the amount of the phase, its structure factor |F|², the reflection's multiplicity, the Lorentz-polarization factor and any preferred orientation.
05101520253002468q² (Å⁻²)FWHM² (10⁻⁴ Å⁻²)intercept (2πK/D)²: size D = 40 nmslope (2ε)²: microstrain ε = 0.20 %
Size and strain broaden peaks differently, and a Williamson-Hall plot separates them. Small crystallites of size D add the same width to every peak, 2πK/D in q (K = 0.94, the Scherrer constant xdart uses), while microstrain ε adds a width that grows with q, 2εq. xdart adds the two in quadrature, FWHM² = (2πK/D)² + (2εq)², so FWHM² against q² is a straight line: the intercept gives the size and the slope the microstrain. The six widths here come from Phase Analysis's own Scherrer width model for D = 40 nm and ε = 0.2 %, with 2 % scatter, and the line through them recovers both. The classic Williamson-Hall plot adds the two widths linearly instead, as for Lorentzian broadening. Correct for the instrument's own width first, measured on a standard. The Peak Fitter reports each peak's width; Phase Analysis's Scherrer model fits D and ε across a whole pattern at once.

From fit to physics

Fitted valueWhat it measuresRead it as
Center, p0_centerposition in the displayed x unit; for total q, d = 2π/qspacing changes can show strain or thermal expansion; a 2θ centre needs the source wavelength in Bragg's law
FWHM, p0_fwhmsize and microstrain broadening, plus the instrument size from Scherrer, D ≈ 2πK/FWHMsize, with the size-only width in total-q units after instrument correction and negligible or separately resolved strain broadening
Amplitude, p0_amplitudethe peak's area, its integrated intensity phase amount × |F|² × multiplicity × texture: compare one reflection across frames
p0_fractionthe Lorentzian share of a pseudo-Voigtsize broadening tends to be Lorentzian, strain and instrument broadening Gaussian
bg_Athe template's scalerelative substrate scattering; thickness, absorption and intensity normalization can all change it
the trendany of these against frame or a scan columnin-situ change: expansion on heating, a phase growing
How the Peak Fitter fits

What a fit is made of

0250500750Intensityfit range: drag it on the plot, or type it1.41.61.822.22.42.62.833.23.43.6-50050q (Å⁻¹)residual
datafit backgroundpeak 1 peak 2peak 3residual
The fit is the background plus one profile per peak, solved only inside the fit range. This one is a real fit by xdart's fitter: three pseudo-Voigt peaks on a sloped background. The dotted lines mark the fitted centres, and the residual below is the data minus the fit: a good fit leaves only noise. Turn on Components in the trend's header to draw each peak on its own; Log in the bar above the plot draws data and fit on a log scale while the residual stays linear.

Choosing a peak profile

-2.5-2-1.5-1-0.500.511.522.500.51distance from the centre, in widths at half maximumheight, scaled to 1half maximum
GaussianLorentzian pseudo-Voigt, fraction 0.5Pearson VII, m = 1.5 split pseudo-Voigt
All five have the same height and the same width at half maximum; they differ in their tails and symmetry. A Lorentzian has the heaviest tails and a Gaussian the lightest. The pseudo-Voigt mixes the two by its fraction (PV fraction in Peak parameters gives its start), and Pearson VII sits between them by its exponent m: m = 1 is a Lorentzian, and a large m approaches a Gaussian. The split pseudo-Voigt has its own width on each side, for peaks that lean, such as a strained film's reflection. Voigt, the exact convolution of a Gaussian and a Lorentzian, lies close to the pseudo-Voigt and is not drawn.

A measured background: the template

11.522.533.544.550100200300q (Å⁻¹)Intensitymeasured substrate (the template)template × bg_A = 1.61
measured substrate (template) template × bg_Asample data fit
This synthetic example simulates a substrate pattern, sample peaks and counting noise. When the background has a shape of its own, such as a glass substrate's broad hump, measure the bare substrate and use its pattern as the template. The fit scales it by one amplitude, bg_A (never below 0), and adds the peaks; here the fitted bg_A comes out close to the 1.6 the sample was made with. Template + polynomial or Template + Chebyshev add a small correction, of the degree in the box beside the choice, under bgx_ names. Beyond the template's own range, its value is held flat.

Where a template comes from

Use displayedthe trace on screen Choose file…NeXus result or .xye Named sourceNeXus: file, frame, mode .xye: file and x unit(you choose the unit) First fitreads the file on the fit's worker, and checksa displayed trace Recordedthe content's identity(SHA-256) Saved, exportedsettings, notebooks File changedrefused by name; choose it again Not reproducedfitted as captured, not saved or exported file differs later edits
A template needs a reproducible file source to be saved or exported. Use displayed proposes the trace's own file, frame and 1-D mode when available, and the first fit checks that the file holds that curve, within one part in a million; if it does not, or the trace has no reproducible source, the capture still fits but stays unnamed. Choose file… takes a NeXus result, with its frame and mode, or an .xye file, whose unit you choose. A chosen file's descriptor can be kept with Save settings… before fitting. The first fit records the file's content; notebook export carries that identity, and a file changed since then is refused until you choose it again.

Units that convert

Template unitFit unitResultWhy
q (nm⁻¹)q (Å⁻¹)convertsthe same axis, a factor of 10
2θ (rad)2θ (°)convertsthe same angle
2θqrefusedit needs a wavelength the template does not record
q_ip or q_oopqrefuseddifferent axes of a grazing-incidence pattern

An .xye file's name only suggests its unit. xdart writes iq_ for q in Å⁻¹ and in nm⁻¹ alike, so the Peak Fitter waits for you to choose the unit before it reads the file.

Range, uncertainties and weights

1.61.71.81.922.12.22.32.40200400q (Å⁻¹)Intensity
With Use uncertainties (Peak parameters ▸ Solver) each point counts by 1/σ, its measured uncertainty, so noisy points pull less on the fit. It is available only when the trace carries measured σ; none is inferred from the counts. Fit uncertainties are conditional on the template: a template's own noise is not propagated.