autoemx.config.schema_models.frames module

Frames acquired on a sample (SampleLedger.frames): one record per frame, with its segmentation results.

autoemx.config.schema_models.frames.FramePurpose

searched for particles to measure by EDS, or by a particle size statistics measurement

Type:

Why a frame was acquired

alias of Literal[‘eds_search’, ‘size_stats’]

class autoemx.config.schema_models.frames.FrameRecord(*, frame_id: str, label: str, purpose: ~typing.Literal['eds_search', 'size_stats'], measurement_id: int | None = None, datetime: str | None = <factory>, center_mm: ~autoemx.config.schema_models.acquisition.Coordinate2D | None = None, frame_width_um: float, pixel_size_um: float, area_um2: float, search_window_um: ~typing.Tuple[float, float], image_file: str | None = None, segmentations: ~typing.List[~autoemx.config.schema_models.segmentation.FrameSegmentation] = <factory>)[source]

Bases: BaseModel

A frame acquired on the sample: what the acquisition fixed (position of its centre on the stage, if known, frame width, pixel size, area and saved image), and the particles found in it by each segmentation (never replaced: segmenting it again adds a result).

frame_id is unique in the ledger and names the image file (<sample>_fr<frame_id>_particles); label is the label of the frame navigation (A0, A0_a0), as in AcquisitionDetails.frame_id of the spectra acquired in it. search_window_um are the particle diameters searched (particle area limits of the acquisition); measurement_id is the particle size statistics measurement that acquired it.

frame_id: str
label: str
purpose: Literal['eds_search', 'size_stats']
measurement_id: int | None
datetime: str | None
center_mm: Coordinate2D | None
frame_width_um: float
pixel_size_um: float
area_um2: float
search_window_um: Tuple[float, float]
image_file: str | None
segmentations: List[FrameSegmentation]
model_config = {'extra': 'forbid'}

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

classmethod validate_positive(v: float) → float[source]
validate_record() → FrameRecord[source]
segmentation(segmentation_id: int | None) → FrameSegmentation | None[source]

Result of a segmentation of the frame, or None if not segmented with it.

add_segmentation(result: FrameSegmentation) → None[source]

Add the result of a segmentation (one per segmentation id).