Skip to content

fix: drain live preview buffer#160

Merged
tlambert03 merged 1 commit into
pymmcore-plus:mainfrom
gcharvin:codex/mr-live-preview-buffer
Apr 7, 2026
Merged

fix: drain live preview buffer#160
tlambert03 merged 1 commit into
pymmcore-plus:mainfrom
gcharvin:codex/mr-live-preview-buffer

Conversation

@gcharvin

@gcharvin gcharvin commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Summary

This keeps the live image preview from accumulating stale frames during continuous acquisition:

  • drain the Micro-Manager live-preview queue on each timer tick
  • display only the most recent frame
  • reduce the local NDV live-preview ring buffer to one frame

Background

This came from testing pymmcore-gui on a Nikon TiEclipse setup with a high-resolution camera, where the live preview could lag and the viewer buffer could grow unnecessarily for a workflow that only needs the latest live frame.

Validation

  • python -m ruff check src/pymmcore_gui/widgets/image_preview/_preview_base.py src/pymmcore_gui/widgets/image_preview/_ndv_preview.py
  • python -m compileall -q src/pymmcore_gui/widgets/image_preview/_preview_base.py src/pymmcore_gui/widgets/image_preview/_ndv_preview.py

@codecov

codecov Bot commented Apr 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.09%. Comparing base (76024ca) to head (e42eef7).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #160      +/-   ##
==========================================
+ Coverage   81.84%   82.09%   +0.25%     
==========================================
  Files          29       29              
  Lines        1807     1810       +3     
==========================================
+ Hits         1479     1486       +7     
+ Misses        328      324       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gcharvin gcharvin changed the title Fix live preview buffer draining fix: drain live preview buffer Apr 7, 2026
@gcharvin gcharvin force-pushed the codex/mr-live-preview-buffer branch from c84f6ad to e42eef7 Compare April 7, 2026 11:29
@tlambert03

Copy link
Copy Markdown
Member

Hello @gcharvin! It's nice to make your acquaintance, and thanks for all your PRs across these two repos! I'm very happy to see a new eager (and clearly quite capable 😄) contributor, and I hope we can ultimately accommodate all of your needs here. I'll get to all of your PRs over the next couple days (we're away teaching a course at the moment, so might be slightly slow). There will likely be some discussion points, but in general: please do feel free to open PRs for anything that would make your life easier. (and also: know that it's still early days for the GUI, so things will be changing fast: for any software you're using to actually drive scopes in the lab, I encourage you to use lock-files to pin specific versions of pymmcore-gui)

This specific PR is fine with me. The live preview functionality is all still work-in-progress and I think there are known issues about the buffering (size of buffer aside). Ultimately, I think this should probably be a user preference, since the previous behavior of having a buffer size > 1 lets the user either do a little live burst, or snap a handful of times, and review the most recently snapped images, which some people like to do. But if/when we add back that recent review functionality, we'll try to do so with user configurability

@tlambert03 tlambert03 merged commit b2368fa into pymmcore-plus:main Apr 7, 2026
15 checks passed
@gcharvin

gcharvin commented Apr 7, 2026 via email

Copy link
Copy Markdown
Contributor Author

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.

2 participants