autoemx.runners.calibrate_peak_sigma_params module
Runner: Calibrate the Peak Width (Sigma) Parameters of the Detector Model
The Gaussian sigma of the X-ray peaks depends on the energy E (keV) as
sigma = conv_eff * sqrt(elec_noise**2 + E * F / conv_eff)
(see DetectorResponseFunction.det_sigma), with conv_eff the energy per electron-hole pair (keV), elec_noise the electronic noise (electrons) and F the Fano factor (fixed, from the detector model). Equivalently, sigma**2 = (conv_eff * elec_noise)**2 + conv_eff * F * E, the form of J. Osán et al., X-Ray Spectrom. 30 (2001) 419–426. https://doi.org/10.1002/xrs.523.
This runner fits conv_eff and elec_noise to the peak sigmas fitted in spectra of standards (read from their ledgers) and/or to sigmas given directly, and compares them with the values of the detector model of the microscope.
Use high-count spectra of bulk standards, ideally pure elements, with well-separated lines spanning the energy range. Only reference lines are used (Ka1, La1, Ma1 by default): the sigmas of the other lines of an element are tied to them, and small peaks have their sigma fixed during fitting. Since fitted sigmas are bounded to 0.93-1.1 times the value of the detector model, sigmas at these bounds are reported: update the detector model, refit the spectra, and calibrate again.
Created on Mon Oct 12 2026 @author: Andrea
- autoemx.runners.calibrate_peak_sigma_params.calibrate_peak_sigma_params(samples: Dict[str, List[str] | None] | None = None, measured_sigmas: Dict[str, Tuple[float, float]] | None = None, microscope_ID: str | None = None, plot: bool = True) Dict[str, Any][source]
Fit conv_eff and elec_noise of the detector model to measured peak sigmas.
- Parameters:
samples (dict, optional) – {path of a fitted sample folder (with ledger.json): el_lines to use, or None for its Ka1, La1, Ma1 lines}. Sigmas are read from the active quantification of each sample, for accepted spectra (quant_flag 0).
measured_sigmas (dict, optional) – Sigmas measured otherwise, as {label: (energy in keV, sigma in keV)}.
microscope_ID (str, optional) – Microscope whose detector model is compared (and whose Fano factor is used). Default: that of the samples.
plot (bool, optional) – If True (default), plots the measured sigmas with the fitted and current model.
- Returns:
conv_eff, elec_noise (fitted), current_conv_eff, current_elec_noise, F, microscope_ID, and points: a list of {label, energy, sigma, stdev, n, current_ratio, at_fit_bound}.
- Return type:
dict