Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] fix: fix lag in live mode after mda acquisition #309

Closed
wants to merge 12 commits into from

Conversation

fdrgsp
Copy link
Contributor

@fdrgsp fdrgsp commented Feb 1, 2024

I've noticed that after opening napari-micromanager the live mode works well without any lag. However, after running a MDA acquisition, the live mode starts to lag. See video below to see this behavior.

As a proposed solution, I modified the CoreViewerLink class and use the same QTimer pattern that we use in the pymmcore-widgets ImagePreview widget (https://github.com/pymmcore-plus/pymmcore-widgets/blob/d5d38c9cc24bc2ac99b5921ac2593a4037d258fb/src/pymmcore_widgets/_image_widget.py#L18).


CURRENT

current.mp4

FIX

fix.mp4

@@ -32,42 +35,46 @@ def __init__(
self._mda_handler = _NapariMDAHandler(self._mmc, viewer)
self._live_timer_id: int | None = None

self.streaming_timer = QTimer(parent=self)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious if you determined that using an independent QTimer instead of self.startTimer was sufficient to resolve the slow down? I ask because this is a bit surprising to me. Before accepting this change, I'd prefer to know why it matters. Looking into the Qt docs for hints if need be. If true, it might have to do with threading or something... but lets figure out why we're doing it

Copy link

codecov bot commented Feb 2, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (41a9943) 78.92% compared to head (267fa38) 78.93%.

Files Patch % Lines
src/napari_micromanager/_core_link.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #309   +/-   ##
=======================================
  Coverage   78.92%   78.93%           
=======================================
  Files          15       15           
  Lines         688      693    +5     
=======================================
+ Hits          543      547    +4     
- Misses        145      146    +1     

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

@fdrgsp fdrgsp changed the title fix: fix lag in live mode after mda acquisition [WIP] fix: fix lag in live mode after mda acquisition Feb 3, 2024
@tlambert03
Copy link
Member

I think that ultimately, the problem here is the getExposure with a Hamamatsu camera is returning an artificially high exposure time as of December 14th 2023. See micro-manager/mmCoreAndDevices#442

So I think this can be closed.

@fdrgsp fdrgsp closed this Feb 6, 2024
@fdrgsp fdrgsp deleted the fix_snap_live branch May 27, 2024 18:54
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