Repository navigation
CameraBase: keep the newest frames when the camera kept several - #15
Merged
Merged
Conversation
…ead of adding an axis When the camera had kept more frames than the ones asked for (nobody reads while it acquires, so the second snap finds several), the frames were wrapped in an extra axis and the viewer switched to a DataND. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tdiso1u1ZhikSutj2Qs5Cg
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 camera that keeps its frames while nobody reads them (the cookbook camera, other cameras with a buffer), the second snap found several unread frames. The callback wrapped them in an extra axis, so the plugin emitted data of shape (1, H, W) and the viewer switched to a DataND, then showed nothing more. It depended on the time between two snaps, so it only showed up from time to time.
After: the callback keeps the newest frames that are still missing (one for a snap) and stores them without adding an axis, so a snap always gives a Data2D of the size of the ROI.
How: in
CameraCallback.wait_for_acquisitionthe frames read are cut to the number still missing (new_frames[-n_missing:]), the array of the frames is sized on them, and the counter advances by the number of frames kept (it used the number of frames the camera held). New testTestSeveralUnreadFrameswith a fake camera that returns three unread frames (it fails before the change). I also snapped eight times in aDAQ_Viewerwith its user interface and the cookbook camera ofpymodaq_plugins_mockexamples: the viewer stays 2D (it became ND on the second or third snap before). The suite passes (57 passed, 2 skipped; the package layout test fails locally only because the package is not installed). No real camera.Generated by Claude Code