Skip to content

Cookbook lot 3: camera ROI/binning/exposure and spectrometer recipe - #26

Merged
seb5g merged 3 commits into
5.3.xfrom
feat/cookbook-camera-spectrometer
Oct 25, 2026
Merged

seb5g merged 3 commits into
5.3.xfrom
feat/cookbook-camera-spectrometer

Conversation

@seb5g

@seb5g seb5g commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Before: the cookbook had no camera or spectrometer recipe. BSCamera only gave pixel axes, and the README noted that binning and exposure time of a camera were not shown. Two spectrometer plugins existed side by side (Mock_spectro, and the teaching one elsewhere).

After: BSCamera also shows what a camera driver gives its plugin, and CookbookSpectrometer replaces Mock_spectro as the one spectrometer, with the interface of the spectrometer extension.

What changes:

  • BSCamera (and hardware/beam_steering.py): a hardware ROI and a binning applied by the camera (smaller image), an exposure time that scales the signal, and axes in um (pixel size) that follow the ROI and the binning. Defaults give the same image as before (full sensor, 100 ms), except that the axes are now in um. BSPhotodiode still reads the whole sensor. RoiStuff keeps the software ROI example and follows the hardware ROI.
  • New CookbookSpectrometer: 1D detector with a wavelength axis in nm asked to the instrument at every grab, laser line, exposure time, and get/set_spectro_wl, get/set_laser_wl, get/set_exposure_ms for the spectrometer extension; plus an actuator for the central wavelength that is a slave of the detector (shared instrument, homing that waits for its end and calls move_done). The simulated spectrometer (hardware/spectrometer.py) is adapted from pymodaq_plugins_teaching.
  • Mock_spectro is removed, without alias (a note in the README). A saved preset using it must pick CookbookSpectrometer. MockSpectroErrors now builds on CookbookSpectrometer: one line instead of two gaussians.
  • README cookbook table and CONTEXT.md vocabulary (hardware ROI, calibrated axis).

How: new tests in tests/test_bs_camera.py (shape, axes after ROI and binning, exposure) and tests/test_cookbook_spectrometer.py (axis centred on the central wavelength, line at the right place, master/slave, extension interface, errors variant). Full suite: 143 passed, 3 skipped, run locally with the offscreen platform. Nothing was tested on real hardware, the recipes run on simulated devices.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Tdiso1u1ZhikSutj2Qs5Cg

…rometer recipe

BSCamera now applies a ROI and a binning like a camera does, scales the signal by the exposure time and sends axes in
um that follow them (the photodiode still reads the whole sensor). RoiStuff keeps the software ROI example.
New CookbookSpectrometer (1D detector and central wavelength actuator): a calibrated wavelength axis that changes,
and an actuator that is a slave of the detector. The simulated spectrometer is adapted from pymodaq_plugins_teaching.

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

CookbookSpectrometer gets the laser line, the exposure time and get/set_spectro_wl, get/set_laser_wl,
get/set_exposure_ms. Mock_spectro is removed (no alias, noted in the README); MockSpectroErrors now builds on
CookbookSpectrometer.

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

Same calculation as PyMoDAQ PR 1401 (sigma / sqrt(N), ddof=1) for the plugin that averages itself, with n_averaged set.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tdiso1u1ZhikSutj2Qs5Cg
@seb5g
seb5g merged commit 798ba7a into 5.3.x Oct 25, 2026
6 of 7 checks passed
@seb5g
seb5g deleted the feat/cookbook-camera-spectrometer branch October 25, 2026 21:11
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