Skip to content

Cookbook camera recipe on the camera base class of pymodaq_plugins_utils - #28

Merged
seb5g merged 5 commits into
5.3.xfrom
feat/cookbook-camera-driver
Oct 28, 2026
Merged

seb5g merged 5 commits into
5.3.xfrom
feat/cookbook-camera-driver

Conversation

@seb5g

@seb5g seb5g commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Before: the camera recipe was BSCamera, which shows what a camera gives its plugin (ROI, binning, exposure, axes in µm) but does the readout inside the plugin. Nothing showed how a real driver integrates: a thread of its own filling a buffer, the plugin waiting for the frames, the ROI drawn in the viewer applied by the camera.

After: CookbookCamera is the camera plugin written on CameraBase of pymodaq_plugins_utils (PyMoDAQ/pymodaq_plugins_utils#11): it only creates its driver. MockCamera (hardware/mock_camera.py) follows the driver contract CameraDriverBase and behaves like a real one: its own acquisition thread, a ring buffer, wait_for_frame with a timeout, read_multiple_images, ROI and binning that cannot change while the acquisition runs, 16-bit counts with shot noise, a pixel size so the axes are in µm. Copy it to write the driver of a camera that pylablib does not drive. BSCamera and RoiStuff are kept.

What changes: the new plugin, driver and tests (tests/test_cookbook_camera.py, 17 tests: buffer semantics of the driver, snap, average, live, ROI from the viewer, binning, clear ROI, a ROI change during live, close), the README table and setups, CONTEXT.md, and the sentence of the cookbook intro saying each recipe is an actuator and a 0D detector. The package now depends on pymodaq_plugins_utils>=5.3.1.

How: the full suite passes locally (188 passed, 3 skipped) with the branch of pymodaq_plugins_utils#11 on the path, and check_plugin is ok. This PR is a draft until that PR is merged and released (the floor 5.3.1 has to be the release number). Everything is simulated: nothing was tried on a real camera.


Generated by Claude Code

CookbookCamera is the camera plugin written on CameraBase: it only creates its
driver, the base class does the acquisition thread, the ROI drawn in the viewer
applied by the camera, the binning, the exposure and the axes in um. The driver,
MockCamera, follows CameraDriverBase (the methods of the pylablib cameras) and
has its own thread and buffer like a real one, so it can be copied to write the
driver of a camera that pylablib does not drive.

The package depends on pymodaq_plugins_utils (the release that has CameraBase).
The README sentence that said each recipe is an actuator and a 0D detector is
corrected.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tdiso1u1ZhikSutj2Qs5Cg

seb5g commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

The red checks (tests / tests and the compatibility jobs) all stop at the install step: No matching distribution found for pymodaq-plugins-utils>=5.3.1 (PyPI has up to 5.3.0). The code of this PR is not what fails. They will pass once PyMoDAQ/pymodaq_plugins_utils#11 is merged and released, with the floor in pyproject.toml set to that release number. The PR stays a draft until then, and I will re-run the checks after the release.


Generated by Claude Code

@seb5g
seb5g marked this pull request as ready for review October 26, 2026 20:49
…s in the tests

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tdiso1u1ZhikSutj2Qs5Cg
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tdiso1u1ZhikSutj2Qs5Cg
…a no longer give a DataND)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tdiso1u1ZhikSutj2Qs5Cg
@seb5g
seb5g merged commit 050876a into 5.3.x Oct 28, 2026
10 of 12 checks passed
@seb5g
seb5g deleted the feat/cookbook-camera-driver branch October 28, 2026 21:58
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