autoemx.core.em_runtime.xsp_spot_selection module

Programmatic X-ray spot selection on automatically navigated particles.

When PowderMeasurementConfig.par_spot_selection_mode is 'callback', the framework navigates to each particle automatically and invokes xsp_spot_selector repeatedly on the same particle until the callback returns an empty list.

class autoemx.core.em_runtime.xsp_spot_selection.XSpSpotSelectionContext(particle_id: int, n_tot_sp_collected: int, ref_image: Any, pixel_size_um: float, frame_label: str, im_width: int, im_height: int, particle_finder: EM_Particle_Finder)[source]

Bases: object

Context passed to xsp_spot_selector after automatic particle navigation.

The callback is invoked once per spot batch on the current particle. Return a non-empty list of pixel coordinates to measure, then wait for the next invocation to supply more spots. Return [] when finished with this particle (including to skip it without measuring).

ref_image is the frame captured at spot-selection time. It is the same image used as the drift-correction reference during subsequent acquisitions on this particle (see EM_Controller.ref_image).

particle_id: int
n_tot_sp_collected: int
ref_image: Any
pixel_size_um: float
frame_label: str
im_width: int
im_height: int
particle_finder: EM_Particle_Finder
autoemx.core.em_runtime.xsp_spot_selection.validate_xsp_spot_pixels(spots: Sequence[Tuple[int, int]], *, im_width: int, im_height: int) → List[Tuple[int, int]][source]

Validate and normalize programmatic spot pixel coordinates.

Raises:

ValueError – If a spot is outside the image bounds.