autoemxsp.runners.batch_acquire_and_analyze module

Batch acquisition (and optional quantification) of X-ray spectra for a list of powder samples.

param samples:
List of sample definitions. Each dictionary must contain:
  • ‘ID’ (str): Sample identifier (SampleConfig.ID).

  • ‘els’ (list of str): List of expected element symbols (SampleConfig.elements).

  • ‘pos’ (tuple of float): (x, y) stage coordinates in mm (SampleConfig.center_pos).

  • ‘cnd’ (list of str, optional): Reference chemical formulae for known phases (ClusteringConfig.ref_formulae).

type samples:

list of dict

param microscope_ID:

Identifier for the microscope hardware. Must correspond to a calibration folder in ./XSp_calibs/Microscopes/<ID> (MicroscopeConfig.ID). Default is ‘PhenomXL’.

type microscope_ID:

str, optional

param microscope_type:

Type of microscope. Allowed: ‘SEM’ (implemented), ‘STEM’ (not implemented). Default is ‘SEM’ (MicroscopeConfig.type).

type microscope_type:

str, optional

param measurement_type:

Measurement type. Allowed: ‘EDS’ (implemented), ‘WDS’ (not implemented). Default is ‘EDS’ (MeasurementConfig.type).

type measurement_type:

str, optional

param measurement_mode:

Acquisition mode (e.g., ‘point’, ‘map’), defining beam/detector calibration settings. Default is ‘point’ (MeasurementConfig.mode).

type measurement_mode:

str, optional

param quantification_method:

Quantification method. Currently only ‘PB’ (Phi-Rho-Z) is implemented. Default is ‘PB’ (QuantConfig.method).

type quantification_method:

str, optional

param sample_type:

Sample type. Allowed: ‘powder’ (implemented), ‘bulk’, ‘film’ (not implemented). Default is ‘powder’ (SampleConfig.type).

type sample_type:

str, optional

param sample_halfwidth:

Half-width of the sample area in mm for mapping/acquisition. Default is 3.0 (SampleConfig.half_width_mm).

type sample_halfwidth:

float, optional

param sample_substrate_type:

Type of sample substrate. Allowed: ‘Ctape’, ‘None’. Default is ‘Ctape’ (SampleSubstrateConfig.type).

type sample_substrate_type:

str, optional

param sample_substrate_shape:

Shape of the substrate. Allowed: ‘circle’, ‘square’. Default is ‘circle’ (SampleSubstrateConfig.shape).

type sample_substrate_shape:

str, optional

param sample_substrate_width_mm:

Lateral dimension of substrate holder in mm (SampleSubstrateConfig.stub_w_mm).

type sample_substrate_width_mm:

float, optional

param working_distance:

Working distance in mm for acquisition. If None, taken from microscope driver. Default is 5.0 (MeasurementConfig.working_distance).

type working_distance:

float, optional

param working_distance_tolerance:
Defines maximum accepted deviation of working distance from its typical value, in mm.

Used to prevent gross mistakes from EM autofocus. Default: 1 mm.

type working_distance_tolerance:

float, optional

param beam_energy:

Electron beam energy in keV. Default is 15.0 (MeasurementConfig.beam_energy_keV).

type beam_energy:

float, optional

param spectrum_lims:

Lower and upper energy limits for spectrum fitting in eV. Default is (14, 1100) (QuantConfig.spectrum_lims).

type spectrum_lims:

tuple of float, optional

param use_instrument_background:

Whether to use instrument background files during fitting. If False, background is computed during fitting. Default is False (QuantConfig.use_instrument_background).

type use_instrument_background:

bool, optional

param use_project_specific_std_dict:

If True, loads standards from project folder (i.e. results_dir) during quantification. Default: False

type use_project_specific_std_dict:

bool, optional

param interrupt_fits_bad_spectra:

If True, fitting stops early for poor-quality spectra. Default is True (QuantConfig.interrupt_fits_bad_spectra).

type interrupt_fits_bad_spectra:

bool, optional

param max_analytical_error_percent:

Maximum allowed analytical error (%) for compositions to be included in clustering. Default is 5 (ClusteringConfig.max_analytical_error_percent).

type max_analytical_error_percent:

float, optional

param min_bckgrnd_cnts:

Minimum background counts required for a spectrum not to be filtered out. Default is 5 (QuantConfig.min_bckgrnd_cnts).

type min_bckgrnd_cnts:

float, optional

param quant_flags_accepted:

List of acceptable quantification flags; others are filtered out before clustering. Default is [0, -1] (ClusteringConfig.quant_flags_accepted).

type quant_flags_accepted:

list of int, optional

param max_n_clusters:

Maximum number of clusters allowed in compositional clustering. Default is 6 (ClusteringConfig.max_k).

type max_n_clusters:

int, optional

param show_unused_comps_clust:

Whether to display unused compositions in clustering plots. Default is True (PlotConfig.show_unused_comps_clust).

type show_unused_comps_clust:

bool, optional

param is_manual_navigation:

If True, navigation to sample positions is manual. Default is False (MeasurementConfig.is_manual_navigation).

type is_manual_navigation:

bool, optional

param is_auto_substrate_detection:

If True, substrate elements are detected automatically. Implemented only for ‘Ctape’ substrates. Default is False (SampleSubstrateConfig.auto_detection).

type is_auto_substrate_detection:

bool, optional

param auto_adjust_brightness_contrast:

If True, brightness/contrast are set automatically. Default is True (MicroscopeConfig.is_auto_BC).

type auto_adjust_brightness_contrast:

bool, optional

param contrast:

Manual contrast setting (required if auto_adjust_brightness_contrast is False). Default is 4.3877 (MicroscopeConfig.contrast).

type contrast:

float, optional

param brightness:

Manual brightness setting (required if auto_adjust_brightness_contrast is False). Default is 0.4504 (MicroscopeConfig.brightness).

type brightness:

float, optional

param quantify_spectra:

If True, perform quantification after acquisition. Default is False.

type quantify_spectra:

bool, optional

param min_n_spectra:

Minimum number of spectra to acquire. Default is 50 (MeasurementConfig.min_n_spectra).

type min_n_spectra:

int, optional

param max_n_spectra:

Maximum number of spectra to acquire. Default is 100 (MeasurementConfig.max_n_spectra).

type max_n_spectra:

int, optional

param target_Xsp_counts:

Target counts for spectrum acquisition. Default is 50000 (MeasurementConfig.target_acquisition_counts).

type target_Xsp_counts:

int, optional

param max_XSp_acquisition_time:

Maximum acquisition time in seconds. If None, estimated from target counts. Default is None (MeasurementConfig.max_acquisition_time).

type max_XSp_acquisition_time:

float, optional

param els_substrate:

List of substrate element symbols. Default is [‘C’, ‘O’, ‘Al’] (SampleSubstrateConfig.elements).

type els_substrate:

list of str, optional

param powder_meas_cfg_kwargs:

Additional keyword arguments for PowderMeasurementConfig.

type powder_meas_cfg_kwargs:

dict, optional

param bulk_meas_cfg_kwargs:

Additional keyword arguments for BulkMeasurementConfig.

type bulk_meas_cfg_kwargs:

dict, optional

param standards_dict:

Dictionary of reference PB values from experimental standards. Default : None. If None, dictionary of standards is loaded from the XSp_calibs/Your_Microscope_ID directory. Provide standards_dict only when providing different standards from those normally used for quantification.

type standards_dict:

dict, optional

param output_filename_suffix:

String appended to output filenames. Default is ‘’.

type output_filename_suffix:

str, optional

param development_mode:

If True, enables development/debug features. Default is False.

type development_mode:

bool, optional

param verbose:

If True, print verbose output. Default is True.

type verbose:

bool, optional

param results_dir:

Directory where results are saved. Default is None.

type results_dir:

str, optional

returns:

comp_analyzer – The composition analysis object containing the results and methods for further analysis.

rtype:

EMXSp_Composition_Analyzer