Draft: Z stack without stopping!
This is a work-in-progress. Current version performs z-stacks in scans continuously using one motor move. Two subclasses for camera and autofocus implement new behaviour. This is a record to work on, still to add typehints, comments, and remove logging for debugging.
This MR contains the following
- New Subclass of StreamingPiCamera2 for the synced illumination camera (SyncedPiCameraV2)
- New Subclass of AutofocusThing for the continuous z-stack (ContinuousAutofocus)
- Subclass implementation of on_frame_complete() which saves images to memory buffer of max size 30 and appends StackCaptureInfo to list
- Event() is used to signal a new frame has arrived to the sharpness evaluation code
- Global lock is disabled to allow motor_thread to run concurrently with the sharpness evaluations
Bugs Still to Fix:
- Actual duration of one z-stack is longer than (steps/motor_speed). get_estimated_position() calculates incorrect z positions and truncates the position of later stack frames to the end z-position.
- Stitching fails due to saved images being deleted after scan cancelled/completed. Images exist in directory during scan, but are wiped afterwards. Not using correct metadata is possible cause.
- JPEGSharpnessMonitor.move_data() fails sometimes because jpeg_times are empty
Merge checklist:
-
All new/changed functions have up to date typehints and docstrings
Any UI updates have a before and after screenshot in the MR description -
Unit testing of new functionality has similar or better coverage than similar existing code
-
This code has been tested on a microscope
Webapp has been recompiled, with aesthetic changes checked in light and dark mode (if changed)- With updated settings JSON (if changed)
- SmartScan and live stitching work
Edited by Archie Nelson