autoemxsp.runners.collect_particle_statistics module
Created on Thu Oct 9 10:14:12 2025
@author: Andrea
- autoemxsp.runners.collect_particle_statistics.collect_particle_statistics(samples: List[Dict[str, Any]], n_par_target: int, microscope_ID: str = 'PhenomXL', microscope_type: str = 'SEM', detector_type: str = 'BSD', sample_halfwidth: float = 3.0, sample_substrate_type: str = 'Ctape', sample_substrate_shape: str = 'circle', sample_substrate_width_mm: float = 12, working_distance: float = 5, is_manual_navigation: bool = False, is_auto_substrate_detection: bool = False, auto_adjust_brightness_contrast: bool = True, contrast: float = 4.3877, brightness: float = 0.4504, powder_meas_cfg_kwargs: Dict[str, Any] = None, output_filename_suffix: str = '', development_mode: bool = False, verbose: bool = True, results_dir: str = None) None[source]
Batch acquisition (and optional quantification) of X-ray spectra for a list of powder samples.
- Parameters:
samples (list of dict) –
- List of sample definitions. Each dictionary must contain:
’ID’ (str): Sample identifier (SampleConfig.ID).
’pos’ (tuple of float): (x, y) stage coordinates in mm (SampleConfig.center_pos).
n_par_target (int) – Target amount of particles to analyse
microscope_ID (str, optional) – Identifier for the microscope hardware. Must correspond to a calibration folder in ./XSp_calibs/Microscopes/<ID> (MicroscopeConfig.ID). Default is ‘PhenomXL’.
microscope_type (str, optional) – Type of microscope. Allowed: ‘SEM’ (implemented), ‘STEM’ (not implemented). Default is ‘SEM’ (MicroscopeConfig.type).
detector_type (str, optional) – Default : BSD
sample_halfwidth (float, optional) – Half-width of the sample area in mm for mapping/acquisition. Default is 3.0 (SampleConfig.half_width_mm).
sample_substrate_type (str, optional) – Type of sample substrate. Allowed: ‘Ctape’, ‘None’. Default is ‘Ctape’ (SampleSubstrateConfig.type).
sample_substrate_shape (str, optional) – Shape of the substrate. Allowed: ‘circle’, ‘square’. Default is ‘circle’ (SampleSubstrateConfig.shape).
sample_substrate_width_mm (float, optional) – Lateral dimension of substrate holder in mm (SampleSubstrateConfig.stub_w_mm).
working_distance (float, optional) – Working distance in mm for acquisition. If None, taken from microscope driver. Default is 5.0 (MeasurementConfig.working_distance).
is_manual_navigation (bool, optional) – If True, navigation to sample positions is manual. Default is False (MeasurementConfig.is_manual_navigation).
is_auto_substrate_detection (bool, optional) – If True, substrate elements are detected automatically. Implemented only for ‘Ctape’ substrates. Default is False (SampleSubstrateConfig.auto_detection).
auto_adjust_brightness_contrast (bool, optional) – If True, brightness/contrast are set automatically. Default is True (MicroscopeConfig.is_auto_BC).
contrast (float, optional) – Manual contrast setting (required if auto_adjust_brightness_contrast is False). Default is 4.3877 (MicroscopeConfig.contrast).
brightness (float, optional) – Manual brightness setting (required if auto_adjust_brightness_contrast is False). Default is 0.4504 (MicroscopeConfig.brightness).
powder_meas_cfg_kwargs (dict, optional) – Additional keyword arguments for PowderMeasurementConfig.
output_filename_suffix (str, optional) – String appended to output filenames. Default is ‘’.
development_mode (bool, optional) – If True, enables development/debug features. Default is False.
verbose (bool, optional) – If True, print verbose output. Default is True.
results_dir (str, optional) – Directory where results are saved. Default is None.
- Returns:
comp_analyzer – The composition analysis object containing the results and methods for further analysis.
- Return type: