Skip to content

CameraBase: keep the newest frames when the camera kept several - #15

Merged
seb5g merged 1 commit into
5.3.xfrom
fix/camera-callback-frames
Oct 28, 2026
Merged

seb5g merged 1 commit into
5.3.xfrom
fix/camera-callback-frames

Conversation

@seb5g

@seb5g seb5g commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

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_acquisition the 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 test TestSeveralUnreadFrames with a fake camera that returns three unread frames (it fails before the change). I also snapped eight times in a DAQ_Viewer with its user interface and the cookbook camera of pymodaq_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

…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
@seb5g
seb5g merged commit e2f7e48 into 5.3.x Oct 28, 2026
6 of 7 checks passed
@seb5g
seb5g deleted the fix/camera-callback-frames branch October 28, 2026 21:09
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