Repository navigation
Fix viewer grab loop: hardware_averaging and live_mode_available are independent - #1422
Merged
Merged
Conversation
…e_averaging With live_mode_available and hardware_averaging both True, the loop of DAQ_Viewer_hardware.grab_data never ended and called plugin.grab_data again after every received data, each call starting another acquisition loop. The two attributes are now independent: a plugin that streams is called once, the grab ends (grab_stopped) when it is stopped, and the software averaging is still done in data_ready when the plugin does not average itself. Closes #1421 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tdiso1u1ZhikSutj2Qs5Cg
This was referenced Oct 26, 2026
Contributor
Author
|
CI note: the red job is Generated by Claude Code |
This was referenced Oct 27, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before: with a plugin having both
live_mode_available = Trueandhardware_averaging = True, the grab loop of the viewer never ended.plugin.grab_datawas called again after every received data, each call starting another acquisition loop (stack overflow within seconds at 100 FPS, as reported by @rgeneaux in PyMoDAQ/pymodaq_plugins_utils#10). With software averaging andNaverage > 1, several streams were started, andgrab_stoppedwas emitted while the plugin still streamed.After: the two attributes are independent. A plugin that streams (
live_mode_available, live grab) is called once and emits until it is stopped;grab_stoppedis emitted then.hardware_averagingonly tells who averages: the plugin (each emitted data is already an average) or the viewer indata_ready, also while streaming. Single grabs and plugins that do not stream are unchanged.What changes:
DAQ_Viewer_hardware.grab_dataleaves the loop right after the first call for a streaming plugin (the old exit condition is removed),STOP_GRABemitsgrab_stoppedin that case, and the contract of both attributes is written inDAQ_Viewer_base.How: new
viewer_grab_loop_test.pydrives aDetectorWorkerwith a stub plugin counting the calls tograb_data, for streaming or not, hardware averaging or not, live or single. Four of its tests fail on the previous code (both flags True, andgrab_stoppedtoo early). The existing viewer and plugin error tests pass. Tested with stubs only, no real camera. It still has to be checked with a real streaming camera plugin (CameraBaseof pymodaq_plugins_utils withhardware_averaging = True).Closes #1421. Ports to
devand5.2.xfollow.Generated by Claude Code