autoemx.runners.calibrate_peak_weights_experimental_standard module

Calibrate relative X-ray line weights from repeated fits of an experimental standard.

Fits multiple spectra from one standard and records fitted peak areas for user-selected lines (free_area_el_lines). Computes per-line mean/std and pairwise area correlations, including a heuristic check for anti-correlated pairs with approximately constant area sum.

autoemx.runners.calibrate_peak_weights_experimental_standard.calibrate_peak_weights_experimental_standard(std_ID: str, free_area_el_lines: Sequence[str], spectrum_IDs_to_fit: Sequence[Any] | None = None, results_path: str | None = None, spectrum_lims: Tuple[int, int] | None = None, els_substrate: List[str] | None = None, is_particle: bool = True, use_instrument_background: bool = False, fit_tol: float = 0.0001, sum_cv_threshold: float = 0.12, n_sig_figs: int = 5, output_file_suffix: str = '') → Dict[str, Any][source]

Fit spectra of one standard and export free-peak area calibration tables.

Returns:

Contains output paths and generated DataFrames with keys: raw_path, summary_path, raw_df, summary_df

Return type:

dict

autoemx.runners.calibrate_peak_weights_experimental_standard.recompute_calibration(std_ID: str, free_area_el_lines: Sequence[str], spectrum_to_ignore: Sequence[Any] | None = None, spectrum_IDs_to_fit: Sequence[Any] | None = None, manual_groups: Sequence[Sequence[str]] | None = None, results_path: str | None = None, sum_cv_threshold: float = 0.12, n_sig_figs: int = 5) → Dict[str, Any][source]

Recompute calibration outputs excluding specific spectra, without refitting.

Absorption-correction factors are not recomputed (no refit occurs); they are loaded from the ‘ratios_abs_corrected’ table produced by the original calibration.

Parameters:
  • spectrum_to_ignore – Spectrum IDs to exclude before fitting. Matching is normalized so values like 3, 3.0, and “3” are treated as the same ID.

  • manual_groups – Optional user-defined groups of element-lines, each given as a sequence of element-line labels written like the entries of free_area_el_lines (e.g. [["Pr_Mz1", "Pr_Ma1"], ["La_Lb1", "La_Lb2"]]). Each provided group is taken verbatim as a Group in the correlated-peak adjustments table, and any line appearing in a manual group is excluded from the automated detection of sum-locked groups, so those peaks cannot be reassigned automatically.