This document describes the planned evolution of ScanFlow beyond the current phase. Each phase has a clear goal, exit criteria, and concrete tasks.
The current state (post-refactor) covers:
- New
setp/getpAPI with SI units - Coarse approach + Z-limit + slider panels
- Scan control panel with channel selector
- Lock-in + I/V point spectroscopy
- Cryo temperature readout
- Drift detection + correction during automation
- Overnight-safe recipes (DST suppression, configurable save folder)
Goal: the user can see what the STM is doing without leaving ScanFlow.
- Embed a
pyqtgraph.ImageViewin a new Live View tab. - After each scan saves, load the
.datviacreatec.Createc_pyFile.DAT_IMGand update the viewer. - Add a channel selector (TOPOGRAPHY / CURRENT / DF / Lock-in X) and an auto-clip percentile slider.
- Overlay the cumulative drift trail.
scanflow/notify/module with three back-ends:sound,email,desktop.- Trigger on: scan finished, recipe finished, error, drift confidence < threshold.
- Configurable per recipe.
- Couple the approach result back to the Scan Control tab — auto-refresh parameters when the tip enters tunnelling.
- Disable scan controls while approach is in progress.
Exit criteria: a user can run an overnight recipe, watch scans appear in real time, and get a phone notification when the run finishes or errors out.
Goal: ScanFlow can drive every spectroscopy mode the CreaTec supports,
saving raw .VERT plus a sidecar JSON with metadata + lock-in state.
- Wrap
btn_vertspec_multandbtn_vertspec_linein dedicated panels. - Pick positions visually on the live image (click to add a marker).
- Export marker lists as YAML, alongside the recipe.
- Wrap
btn_spectraongridwith a UI for defining the grid (origin, spacing, N×M). - Auto-name files:
<datestamp>_grid_<i>_<j>.VERT.
- Extend
MeasurementRecipewith aSpectroscopySteptype. - Allow mixed image+spectroscopy recipes (e.g. "scan, then grid-spec, then scan again").
- Add a panel that runs a normal scan with
Lock-in Xas a recorded channel, with the lock-in configured for bias modulation.
Exit criteria: a user can define a recipe that runs an overview scan, records dI/dV grid spectroscopy at picked points, and returns to image scanning — all unattended.
Goal: the AFM Mode in stmafm.ini is fully usable from ScanFlow.
- Wrap
AFMController.find_resonancein a wizard:- Broad scan → display amplitude vs frequency curve
- Auto-fit + zoom in
- Apply → set centre frequency, enable amplitude control
- Tune controller bandwidth sliders.
- A clearly labelled toggle between STM (current) and AFM (Δf) feedback, with safety prompts (Z-limit on/off, ramp setpoint slowly).
- New spec mode in the spectroscopy panel: ramp Z while logging Δf.
Exit criteria: the existing manufacturer STM_AFM_operation.py and
AFM_STM_operation.py example scripts can both be expressed entirely through
ScanFlow.
Goal: track where the tip has been on the sample, and let the user revisit previous locations.
- A 2-D view of all scans taken in a session, plotted by their absolute offsets (slider position + scan-frame offset).
- Click a scan → reload its parameters into the Scan Control tab.
- Add an
XYPositionaccumulator that integrates slider pulses (with the user supplying a per-pulse nm calibration). - Save the position log to disk so it survives restarts.
- One-click reverse of slider motion to a prior bookmark.
Exit criteria: after moving across the sample for two hours, a user can visually identify and re-approach to any earlier scan area.
Goal: ScanFlow can be developed and tested without the instrument, and gracefully handles real-world failures.
scanflow.core.mock.MockSTMClientthat simulates the COM API.- Generates synthetic images (with controllable drift, noise, atomic lattice).
- Used by tests and as an offline-mode toggle in the GUI.
pytest-qtintegration to test GUI panels with the mock client.- Property-based tests for the recipe builders.
- Smoke test for every panel (boot, click around, no exceptions).
- Per-call retry policy for COM operations (transient errors are common).
- Recipe-level "on error" handler: stop / pause / retry / continue.
- Crash log with the last 1000 lines of the session log.
~/.scanflow/config.yamlwith all defaults user-tweakable.- Settings dialog in the GUI.
Exit criteria: the test suite covers every public method on every controller and every GUI panel, all using the mock client.
Goal: beat the current phase-cross-correlation approach on tricky surfaces.
- Optional ORB/SIFT feature matching path for highly textured surfaces.
- Compare cross-correlation vs feature shift; pick the higher-confidence.
- Fit drift rate per axis from the last N corrections.
- Predict the next drift instead of always doing an alignment scan.
- Skip alignment scans when prediction confidence is high.
- Wire
Drift_X[A./sec]andDrift_Y[A./sec]into the GUI. - Let ScanFlow estimate these and push them to the instrument so the DSP does the correction inline — eliminates the need for alignment scans.
- When the lattice is resolved, use lattice-vector tracking for sub-pixel
accuracy (interface with
AiSurffor lattice extraction).
Exit criteria: drift correction works on bias values where features are weak, and overnight runs need 30–50% fewer alignment scans.
Goal: ScanFlow feeds clean data into the existing lab tools without manual file shuffling.
- Optional folder-watcher that exports finished
.datfiles plus metadata as ProbeFlow-compatible JSON sidecars. - Single "Open last scan in ProbeFlow" button.
- Optional batch-export to the
.sxmformat used by SpmImageTycoon.
- Per-scan checkbox: "auto-analyse lattice with AiSurf" — runs the analysis
after each scan and writes the result alongside the
.dat.
Exit criteria: a user can run an overnight session and wake up to scans already lattice-analysed, organised by ProbeFlow, with the data ready for review.
- Documentation: every public method on a controller has a docstring; the README and ROADMAP are kept in sync with reality.
- Logging: every COM call logs at DEBUG; every user-visible action logs
at INFO. Daily rotating log file at
~/.scanflow/logs/. - Performance: keep the GUI responsive under 1-Hz scan completion rates. Use QThreads for any operation that can block.
- Versioning: SemVer; the recipe YAML format gets a
schema_versionfield before the first 1.0 release.