Skip to content

feat: Add acquisition state machine for pause/resume/retake functionality#496

Draft
Alpaca233 wants to merge 2 commits intoCephla-Lab:masterfrom
Alpaca233:feature/acquisition-state-machine
Draft

feat: Add acquisition state machine for pause/resume/retake functionality#496
Alpaca233 wants to merge 2 commits intoCephla-Lab:masterfrom
Alpaca233:feature/acquisition-state-machine

Conversation

@Alpaca233
Copy link
Collaborator

Summary

  • Implements timepoint-level state machine enabling pause/resume/retake functionality during acquisition
  • Allows users to pause mid-acquisition, review captured images, and retake specific FOVs before proceeding
  • Thread-safe design for concurrent UI and worker thread access

Changes

New files:

  • control/core/state_machine.py - Core state machine with TimepointStateMachine class and FOVIdentifier dataclass
  • tests/control/test_state_machine.py - 28 unit tests covering state transitions, thread safety, and abort behavior

Modified files:

  • control/core/multi_point_utils.py - Added signals for state changes, pause, resume, and retake events
  • control/core/multi_point_worker.py - Integrated state machine into acquisition loop with pause checks and retake support
  • control/core/multi_point_controller.py - Exposes request_pause(), request_resume(), request_retake(), abort_retake() methods

State Machine Design

States: ACQUIRINGPAUSEDRETAKINGCAPTURED

  • Pause is graceful: completes current FOV before pausing
  • Retake always returns to PAUSED for review
  • Abort from RETAKING only aborts retake, not entire acquisition

Test plan

  • Unit tests pass (28/28)
  • Existing multi_point_controller tests pass (no regressions)
  • Manual test with --simulation mode
  • UI integration for triggering pause/resume/retake

🤖 Generated with Claude Code

Alpaca233 and others added 2 commits February 20, 2026 00:35
Design documents for:
- Timepoint-level state machine for pause/resume/retake workflow
- QC system with per-FOV metrics collection and timepoint-end policy checks

Key design decisions:
- No acquisition-level state machine, just tracking variables
- Four timepoint states: ACQUIRING, PAUSED, RETAKING, CAPTURED
- QC runs as Job in subprocess for parallel execution
- QC policy evaluates metrics at timepoint end, flags FOVs for review
- Extensible for future immediate per-FOV pause

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…lity

Implement timepoint-level state machine enabling users to pause mid-acquisition,
review captured images, and retake specific FOVs before proceeding.

New components:
- TimepointStateMachine: Thread-safe state machine with states ACQUIRING,
  PAUSED, RETAKING, and CAPTURED
- FOVIdentifier: Immutable dataclass for identifying FOVs by region and index

Integration:
- MultiPointWorker checks for pause requests at FOV boundaries
- MultiPointWorker stores FOV coordinates for retake support
- MultiPointController exposes request_pause(), request_resume(),
  request_retake(), and abort_retake() methods
- New signals: signal_state_changed, signal_paused, signal_resumed,
  signal_retake_started, signal_retakes_complete

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant