autoemx.config.schema_models.standards module

class autoemx.config.schema_models.standards.StandardMeanZ(*, Statham2016: float, Markowicz1984: float, mass_averaged: float, atomic_averaged: float)[source]

Bases: BaseModel

Mean atomic number metrics stored for one standard measurement.

statham2016: float
markowicz1984: float
mass_averaged: float
atomic_averaged: float
model_config = {'extra': 'forbid', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

classmethod round_to_2_decimals(value)[source]
class autoemx.config.schema_models.standards.StandardPbSummary(*, Corrected_PB: float, rel_stdev_pb_percent: float, Measured_PB: float | None = None, Stdev_PB: float)[source]

Bases: BaseModel

Shared PB summary fields used by fit results and persisted entries.

corrected_pb: float
rel_stdev_pb_percent: float
measured_pb: float | None
stdev_pb: float
model_config = {'extra': 'forbid', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

classmethod round_to_1_decimal(value)[source]
classmethod round_to_2_decimals(value)[source]
class autoemx.config.schema_models.standards.StandardEntry(*, Corrected_PB: float, rel_stdev_pb_percent: float, Measured_PB: float | None = None, Stdev_PB: float, ID: str, datetime: str, Formula: str | None = None, Std_type: str | None = None, Use_for_mean_calc: bool | None = False, Mean_Z: StandardMeanZ | None = None)[source]

Bases: StandardPbSummary

Single standards-library entry for one element reference line.

standard_id: str
datetime: str
formula: str | None
std_type: str | None
use_for_mean_calc: bool | None
mean_z: StandardMeanZ | None
model_config = {'extra': 'forbid', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

classmethod validate_non_empty_str(value: str) → str[source]
class autoemx.config.schema_models.standards.ReferenceMean(*, Corrected_PB: float, rel_stdev_pb_percent: float, Measured_PB: float | None = None, Stdev_PB: float, datetime: str | None = None)[source]

Bases: StandardPbSummary

Dedicated reference-mean values for one element reference line.

datetime: str | None
model_config = {'extra': 'forbid', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

classmethod validate_optional_datetime(value: str | None) → str | None[source]
class autoemx.config.schema_models.standards.StandardLine(*, entries: List[StandardEntry] = <factory>, reference_mean: ReferenceMean | None = None)[source]

Bases: BaseModel

Structured standards payload for one element reference line.

entries: List[StandardEntry]
reference_mean: ReferenceMean | None
model_config = {'extra': 'forbid', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

compute_reference_mean(datetime: str | None) → ReferenceMean | None[source]

Reference mean of the corrected P/B ratios of the entries used for the mean (None if there are none).

class autoemx.config.schema_models.standards.StandardFitLineResult(*, Corrected_PB: float, rel_stdev_pb_percent: float, Measured_PB: float | None = None, Stdev_PB: float, pb_ratios: List[float], peak_theoretical_energy_keV: float, n_spectra_used: int)[source]

Bases: StandardPbSummary

Computed standards-fit metrics for one element reference line.

pb_ratios: List[float]
peak_theoretical_energy_keV: float
n_spectra_used: int
model_config = {'extra': 'forbid', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

to_standard_entry(*, standard_id: str, datetime: str, formula: str | None = None, std_type: str | None = None, use_for_mean_calc: bool | None = False, mean_z: StandardMeanZ | None = None) → StandardEntry[source]
class autoemx.config.schema_models.standards.StandardsFitResults(*, lines: Dict[str, ~autoemx.config.schema_models.standards.StandardFitLineResult]=<factory>, mean_z: StandardMeanZ | None = None)[source]

Bases: BaseModel

Aggregate standards-fit output used for persistence and library updates.

lines: Dict[str, StandardFitLineResult]
mean_z: StandardMeanZ | None
model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class autoemx.config.schema_models.standards.EDSStandardsFile(*, schema_version: int = 1, measurement_type: str, beam_energy_keV: int, standards_by_mode: Dict[str, ~typing.Dict[str, ~autoemx.config.schema_models.standards.StandardLine]]=<factory>)[source]

Bases: BaseModel

Schema-backed representation of an EDS standards file for one beam energy.

schema_version: int
measurement_type: str
beam_energy_keV: int
standards_by_mode: Dict[str, Dict[str, StandardLine]]
model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

classmethod validate_schema_version(value: int) → int[source]
classmethod validate_measurement_type(value: str) → str[source]
classmethod validate_beam_energy(value: Any) → int[source]
classmethod normalize_standards_by_mode_payload(value: Any) → Any[source]
classmethod from_payload(payload: Dict[str, Any], meas_type: str, beam_energy_keV: int) → EDSStandardsFile[source]
classmethod from_standards_dict(standards_by_mode: Dict[str, Dict[str, List[Dict[str, Any]]]], meas_type: str, beam_energy_keV: int) → EDSStandardsFile[source]
classmethod from_json_file(file_path: str | Path, meas_type: str, beam_energy_keV: int) → EDSStandardsFile[source]
to_standards_dict() → Dict[str, Dict[str, List[Dict[str, Any]]]][source]

Return legacy-compatible per-mode dictionaries used by quantification code.

to_payload() → Dict[str, Any][source]
to_json_file(file_path: str | Path, indent: int = 2) → None[source]

Write the standards file to JSON, sorting el_line keys in each mode using el_line_sort_key logic.