autoemx.config.schema_models.quantification module
- class autoemx.config.schema_models.quantification.QuantificationDiagnostics(*, iterations_run: int | None = None, converged: bool | None = None, interrupted: bool | None = None, min_background_ref_lines: float | None = None, missing_reference_peaks: List[str] | None = None, added_elements: List[str] | None = None, added_unquantified_elements: List[str] | None = None, possible_elements: List[str] | None = None, identification_note: str | None = None)[source]
Bases:
BaseModelExecution diagnostics captured during iterative quantification.
- Variables:
iterations_run (int, optional) – Number of quantification iterations performed.
converged (bool, optional) – True if the iterative fit converged within the allowed iterations.
interrupted (bool, optional) – True when no composition result was produced, either because the spectrum failed a pre-fit validity check (insufficient counts, background too low, etc.) or because the iterative fit was aborted early after detecting signs of an unreliable result (poor fit quality, excessive analytical error, or excessive X-ray absorption) while
interrupt_fits_bad_spectra=True. Spectra withinterrupted=Trueare automatically re-quantified on the next run wheninterrupt_fits_bad_spectra=False.min_background_ref_lines (float, optional) – Minimum background counts under any reference peak used for quantification.
missing_reference_peaks (list of str, optional) – Reference peaks that were absent or below the minimum acceptable PB ratio.
added_elements (list of str, optional) – Elements found by the identification of missing elements, added to the fit and quantified.
added_unquantified_elements (list of str, optional) – Elements found by the identification of missing elements and added to the fit, but not quantified (no standard).
possible_elements (list of str, optional) – Elements whose presence is suggested by the identification of missing elements, but not confirmed by the fit (only reported, for manual checking).
identification_note (str, optional) – Note of the identification of missing elements (e.g. unreliable background of the starting fit).
- iterations_run: int | None
- converged: bool | None
- interrupted: bool | None
- min_background_ref_lines: float | None
- missing_reference_peaks: List[str] | None
- added_elements: List[str] | None
- added_unquantified_elements: List[str] | None
- possible_elements: List[str] | None
- identification_note: str | None
- model_config = {'extra': 'forbid'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class autoemx.config.schema_models.quantification.QuantificationConfig(*, quantification_id: int, label: str | None = None, autoemx_version: str = '<=1.4.0', sample_elements: List[str] = <factory>, substrate_elements: List[str] = <factory>, els_w_fr: Dict[str, float] | None=None, options: Dict[str, ~typing.Any]=<factory>, reference_values_by_el_line: Dict[str, ~typing.Any]=<factory>, reference_lines_by_element: Dict[str, str]=<factory>, active_clustering_analysis_index: int | None = None, clustering_analyses: List[ClusteringAnalysis] = <factory>)[source]
Bases:
BaseModelConfiguration descriptor for one full quantification run.
The options mapping stores quantification-method options used to decide whether a previous run can be resumed (for example use_project_specific_std_dict).
The reference_lines_by_element mapping records which spectral line was selected for each element during this quantification run. This enables comparison between runs to detect whether line selection changed, which would require requantification.
- NON_FINGERPRINT_OPTIONS: ClassVar[Tuple[str, ...]] = ('is_known_phase_mixture',)
- quantification_id: int
- label: str | None
- autoemx_version: str
- sample_elements: List[str]
- substrate_elements: List[str]
- els_w_fr: Dict[str, float] | None
- options: Dict[str, Any]
- reference_values_by_el_line: Dict[str, Any]
- reference_lines_by_element: Dict[str, str]
- active_clustering_analysis_index: int | None
- clustering_analyses: List[ClusteringAnalysis]
- model_config = {'extra': 'forbid'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod move_options_min_bckgrnd_cnts(data: Any) Any[source]
Legacy compatibility: runs saved by AutoEMX 1.4.1 stored min_bckgrnd_cnts in their options.
It is a clustering setting (ClusteringConfig.min_bckgrnd_cnts): the value is moved to the clustering configs of the run that do not store it, so that their fingerprint is unchanged.
- classmethod validate_reference_lines_by_element(v: Dict[str, str]) Dict[str, str][source]
Validate that element→line mapping contains no empty keys or values.
- validate_clustering_analysis_index() QuantificationConfig[source]
Ensure active clustering analysis index is valid and defaults to the last entry.
- get_active_clustering_analysis() ClusteringAnalysis | None[source]
Return the active clustering analysis, defaulting to the last one when available.
- set_active_clustering_result(result: ClusteringResult) None[source]
Attach a clustering result to the active clustering analysis.
- static derive_reference_lines_by_element(reference_values_by_el_line: Dict[str, Any], preferred_lines: Sequence[str] | None = None) Dict[str, str][source]
Build a deterministic element->line map from available reference values.
- fingerprint_payload() Dict[str, Any][source]
Return canonical scientific inputs used to decide quantification reuse.
reference_values_by_el_line/reference_lines_by_elementare scoped tosample_elementsonly (substrate reference lines are never part of the scientific signature and should not be stored).
- fingerprint() str[source]
Compute deterministic SHA-256 fingerprint for quantification scientific inputs.
- fingerprint_differences(other: QuantificationConfig) Dict[str, Dict[str, Any]][source]
Return a deterministic diff of scientific inputs against another config.
- class autoemx.config.schema_models.quantification.QuantificationResult(*, quantification_id: int, quant_flag: int | None = None, comment: str | None = None, composition_atomic_fractions: Dict[str, float] | None = None, composition_weight_fractions: Dict[str, float] | None = None, analytical_error: float | None = None, fit_result: FitResult | None = None, diagnostics: QuantificationDiagnostics | None = None)[source]
Bases:
BaseModelPersisted per-spectrum quantification output for a specific run/config.
- quantification_id: int
- quant_flag: int | None
- comment: str | None
- composition_atomic_fractions: Dict[str, float] | None
- composition_weight_fractions: Dict[str, float] | None
- analytical_error: float | None
- diagnostics: QuantificationDiagnostics | None
- model_config = {'extra': 'forbid'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].