Logbook-driven planning and Bluesky plans for MOUSE. This repository provides:
- Bluesky plans: atomic measurement, public measurement wrapper, configuration application scaffold, and snapshotting.
- Protocol registry: map
protocolstrings to either single-plan or generator-style compilers. - Planner: compile logbook entries → schedule (barrier-aware collation) → insert config changes → validate → enqueue to Queue Server.
- Documentation under
design_documentation/.
- Single-plan protocols: queued as one Queue Server item; runnable interactively.
- Generator protocols: compile to many measurement runs; reorderable within contiguous
collate=ALLOWblocks. - One measurement = one run persisted to Tiled.
- apply_config only on change: planner inserts config changes as needed.
- Debug snapshot per measurement: emitted inside each measurement run (stream
snapshot). Baseline is configured at the RunEngine level.
src/mouse_bluesky/
plans/
protocols/
planner/
design_documentation/
tests/
- Create and activate a virtualenv, then install:
pip install -e .- Run unit tests:
pytest- Read design docs:
design_documentation/architecture.mddesign_documentation/design_decisions.mddesign_documentation/operations.mddesign_documentation/contracts.mddesign_documentation/testing.md
The core library remains deployment-agnostic, but this repository also ships a
reference Queue Server startup profile under
qserver_profile/profile_mouse/startup/.
Production beamlines may still keep their operational startup in a separate repository. In that case, this repo remains the source for plans, planner logic, and a working reference profile.
Interactive helpers are available in mouse_bluesky.interactive and are
designed for qserver-console / qserver-qtconsole workflows with live fits.
Available scans:
peak_scanvalley_scanedge_scancapillary_scan
All scans support a minimal call and a short extended call:
- Minimal:
scan_fn(motor, start, stop) - Extended:
scan_fn(motor, start, stop, num, exposure_time)
Examples:
from mouse_bluesky.interactive import peak_scan, edge_scan
# Minimal usage
res_peak = peak_scan(motor, -1.0, 1.0)
# Extended usage
res_edge = edge_scan(motor, -0.5, 0.5, 41, 0.2)src/mouse_bluesky/interactive/tests/unit/interactive_scans/tests/integration/interactive_scans/
num=10exposure_time=1.0- default detector resolved from interactive
eiger - default RunEngine resolved from interactive
RE - live table on by default
- live plot off by default
peak_scan/valley_scandefault model profile:gaussianedge_scandefault model: sigmoidal (StepModel)
- Scans run as standard Bluesky
scan(...)plans with callbacks (LiveFit, optionalLiveTable, optionalLivePlot). exposure_timesets detector timing before the scan; it is not an inter-step sleep.- Current exposure configuration is deterministic for Eiger-like detectors via:
det.cam.acquire_timedet.cam.acquire_period- Code marker:
TODO: checkininteractive/exposure.pyfor final IOC verification.
Each helper returns ScanResult with consistent fields:
uid,kind,detector_field,motor_field- fit status:
fit_success,fit_message - fit outputs:
fit_center,width - convenience stats where applicable:
com,cen - raw callback artifacts:
fit_result,peak_stats,livefit - extra metadata in
extra
For capillary scans, center is the fitted mid_center and width is
abs(left_center - right_center).
Interactive scans are imported in Queue Server startup:
qserver_profile/profile_mouse/startup/00_plans.py
This makes them available in both queue operations and interactive console sessions.
Add your preferred license file (e.g., BSD-3-Clause) and update this section.
This package reads default paths from environment variables:
MOUSE_DATA_ROOT→ defaultroot_pathfor measurement output (default:/data/mouse)MOUSE_CONFIG_ROOT→ defaultconfig_rootfor{config_id}.nxsfiles (default:/data/mouse_configs)
You can override both via CLI flags or by injecting measurement_extra_kwargs / apply_config_extra_kwargs when building PlanSpecs.
After installation, a small CLI is available:
- Validate planned queue (compile logbook → specs → static validation):
mouse-bluesky validate /path/to/logbook.xlsx /path/to/projects --root-path /data/mouse --config-root /data/mouse_configs- Enqueue into a running Queue Server (fails if validation issues exist):
mouse-bluesky enqueue /path/to/logbook.xlsx /path/to/projects --zmq tcp://127.0.0.1:60615 \
--root-path /data/mouse --config-root /data/mouse_configs \
--user mouse-bluesky --user-group primaryThe CLI now normalizes Queue Server responses before reporting failures, so tuple-
shaped replies (e.g. (success, message, traceback)) or objects with success
attributes are handled gracefully and their messages are surfaced when requests
fail.