autoemx.core.fitter.background module
Background model module for EDS spectrum fitting.
Handles calculation and fitting of X-ray background continuum, including absorption attenuation, backscattering correction, and generated background models.
- Main Class:
Background_Model: Comprehensive background modeling with multiple physics corrections
- class autoemx.core.fitter.background.Background_Model(is_particle: bool, sp_collection_time: float = None, tot_sp_counts: int = None, beam_energy: float = 15, emergence_angle: float = 28.5, els_w_fr: dict = None, meas_mode: str = 'point', energy_vals=None, free_background_params=None)[source]
Bases:
objectModel for calculating and fitting X-ray background in EDS spectra.
Handles background continuum generation, absorption attenuation corrections, detector efficiency, backscattering effects, and detector response.
Class Attributes
- cls_beam_efloat or None
Electron beam energy in keV, accessible by all instances and fitting routines.
- den_intany
Cached denominator integral for background calculation.
- num_intany
Cached numerator integral for background calculation.
- prev_xany
Cached previous energy values.
- prev_rhoz_par_offsetany
Cached previous absolute rho-z offset.
- prev_rhoz_par_slopeany
Cached previous rho-z offset slope.
- prev_rhoz_limitany
Cached previous rho-z z limit.
- prev_w_frsany
Cached previous weight fractions.
- rhoz_valuesany
rhoz_values computed for a given rhoz_limit.
Instance Attributes
- is_particlebool
If True, indicates the background is for a particle (affects fitting).
- sp_collection_timefloat or None
Spectrum collection time in seconds.
- tot_sp_countsint or None
Total counts in the spectrum.
- emergence_anglefloat
Detector emergence angle in degrees.
- energy_valsarray-like or None
Array of energy values for the spectrum.
- meas_modestr
EDS mode, e.g., ‘point’ or ‘map’.
- els_w_frdict
Elemental weight fractions.
- BACKGROUND_PARAMS = ('P', 'F', 'beta')
- cls_beam_e: float = None
- den_int = None
- num_int = None
- prev_x = None
- prev_rhoz_par_offset = None
- prev_rhoz_par_slope = None
- prev_rhoz_limit = None
- prev_w_frs = None
- rhoz_values = None
- static get_average_Z(els_symbols, method='Statham')[source]
Returns a symbolic formula string for the average atomic number (Z) of a sample.
- get_stopping_power_mod_pars()[source]
Returns an lmfit Model and Parameters for electron stopping power correction.
- get_abs_attenuation_mod_pars(model='phirho')[source]
Returns an lmfit Model and Parameters for background attenuation due to absorption.
- get_backscattering_correction_mod_pars()[source]
Returns an lmfit Model and Parameters for backscattering correction.
- static get_beta_expr(beta_expr, els_symbols)[source]
Returns a symbolic formula string for beta parameter from Duncumb model.
- get_generated_background_mod_pars(fr_pars, model='DuncumbMod')[source]
Returns an lmfit Model and Parameters for continuum X-ray background.
- get_detector_efficiency_mod_pars()[source]
Returns an lmfit Model and Parameters for EDS detector efficiency correction.