mpylab.env.ui.emission_review_tui module¶
Terminal sweep review using PNG files and explicit operator decisions.
- class mpylab.env.ui.emission_review_tui.TerminalSweepReviewAdapter(output_dir=None, *, input_fn=None, output_fn=None)
Bases:
objectReview sweeps without Qt and keep their plots as PNG files.
- Parameters:
output_dir (path-like or None, optional) – Image directory; None derives it from the measurement autosave path.
input_fn (callable or None, optional) – Prompt callback returning text. None uses input from an interactive stdin. Explicit callbacks support application integration and tests.
output_fn (callable or None, optional) – Text output callback. None uses print.
- prepare(tem)
Check terminal input and image-directory access before acquisition.
- Parameters:
tem (TEMCell) – Measurement environment providing an optional autosave path.
- Raises:
RuntimeError – No interactive stdin or explicit input callback is available, or normal stdin review was requested from a worker thread.
OSError – Images cannot be written to the configured directory.
- review(tem, description, record)
Save the plot and ask for metadata and an explicit sweep decision.
- Parameters:
tem (TEMCell) – Measurement environment providing user-event hooks.
description (str) – Measurement description.
record (dict) – Detached retained-sweep snapshot.
- Returns:
Repeat, continue or finish-acquisition decision and metadata.
- Return type:
- Raises:
UserWarning – Save/exit, EOF, Ctrl-C or interruption was requested.
OSError – The PNG cannot be written.
- select(tem, raw, triplets)
Select complete orientation sets from the retained-sweep inventory.
- Parameters:
tem (TEMCell) – Measurement environment providing user-event hooks.
raw (dict) – Detached retained-sweep data.
triplets (sequence of sequence) – Canonical orthogonal orientation groups.
- Returns:
Explicit selections. Save/exit, EOF or Ctrl-C discards all newly staged selections and returns an empty list.
- Return type:
list of SweepEvaluationSelection