class documentation

Data about a scan not including workflow specific data.

For including workflow specific data see also:

  • ActiveScanData which subclasses this including the BaseModel used by the
    ScanWorkflow
  • HistoricScanData which has the workflow specific data loaded as a dictionary.

Separating historic and active data allows workflows to use any BaseModel for its settings, but for the data to be reloaded even if that model has updated or is not available. Historic scan data loaded from disk is used for stitching and for creating a ScanInfo object for communicating with the UI. These uses are clearly typed by this model.

This serialises into a human readable format where possible with

timestamps in %Y-%m-%d_%H:%M:%S format timedeltas in %H:%M:%S format

Properties that are not known until the end have None serialised as "Unknown"

Class Method parse_timedelta Validate a timedelta that may be a string in Hrs:Min:Sec format or "Unknown".
Class Method parse_timestamp Validate a timestamp that may be a string in Year-Month-Day_Hrs:Min:Sec format.
Class Method parse_unknown_as_none Validate the string "Unknown" as None.
Method serialize_none_as_unknown Serialise None as "Unknown" for a more human readable result.
Method serialize_timedelta Serialise timedelta to Hrs:Min:Sec (or "Unknown" if None).
Method serialize_timestamp Serialise timestamp to Year-Month-Day_Hrs:Min:Sec format.
Method validate_schema_version Validate the schema version is as the current one.
Class Variable duration The duration of the scan.
Class Variable image_count The number of images taken.
Class Variable model_config Undocumented
Class Variable save_resolution The resolution that scan images are saved at.
Class Variable scan_name The name of the scan i.e. scan_0001
Class Variable scan_result The result of the scan.
Class Variable start_time The time the scan started.
Class Variable starting_position The starting position in dictionary format.
Class Variable stitch_automatically Whether the scan is set to automatically stitch when complete.
Class Variable stitching_settings The data needed to stitch a scan.
Class Variable workflow The class name of the workflow Thing.
@field_validator('duration', mode='before')
@classmethod
def parse_timedelta(cls, value: str | timedelta | None) -> timedelta | None: (source)

Validate a timedelta that may be a string in Hrs:Min:Sec format or "Unknown".

@field_validator('start_time', mode='before')
@classmethod
def parse_timestamp(cls, value: str | datetime) -> datetime: (source)

Validate a timestamp that may be a string in Year-Month-Day_Hrs:Min:Sec format.

@field_validator('scan_result', mode='before')
@classmethod
def parse_unknown_as_none(cls, value: str | int | None) -> str | int | None: (source)

Validate the string "Unknown" as None.

@field_serializer('scan_result')
def serialize_none_as_unknown(self, value: str | int | None) -> str | int: (source)

Serialise None as "Unknown" for a more human readable result.

@field_serializer('duration')
def serialize_timedelta(self, value: timedelta | None) -> str: (source)

Serialise timedelta to Hrs:Min:Sec (or "Unknown" if None).

@field_serializer('start_time')
def serialize_timestamp(self, value: datetime) -> str: (source)

Serialise timestamp to Year-Month-Day_Hrs:Min:Sec format.

@model_validator(mode='after')
def validate_schema_version(self) -> Self: (source)

Validate the schema version is as the current one.

duration: timedelta | None = (source)

The duration of the scan.

This is automatically set when set_final_data() is run.

image_count: int = (source)

The number of images taken.

model_config = (source)

Undocumented

save_resolution: tuple[int, int] = (source)

The resolution that scan images are saved at.

scan_name: str = (source)

The name of the scan i.e. scan_0001

scan_result: str | None = (source)

The result of the scan.

This should be set with set_final_data() to ensure duration is set.

start_time: datetime = (source)

The time the scan started.

starting_position: Mapping[str, int] = (source)

The starting position in dictionary format.

stitch_automatically: bool = (source)

Whether the scan is set to automatically stitch when complete.

stitching_settings: StitchingSettings | None = (source)

The data needed to stitch a scan.

Set to None for types of scan that cannot be stitched.

workflow: str = (source)

The class name of the workflow Thing.