Skip to content

feat(events): instrument plate readers, imagers, and thermocyclers - #1229

Merged
rickwierenga merged 5 commits into
PyLabRobot:mainfrom
VivienP:feat/measurement-thermal-events
Sep 1, 2026
Merged

feat(events): instrument plate readers, imagers, and thermocyclers#1229
rickwierenga merged 5 commits into
PyLabRobot:mainfrom
VivienP:feat/measurement-thermal-events

Conversation

@VivienP

@VivienP VivienP commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Extends PyLabRobot's structured EventBus coverage to measurement and thermal frontends.

  • adds semantic lifecycle events for PlateReader open/close and luminescence, absorbance, and fluorescence reads
  • adds one imager.capture lifecycle per public capture request, including autofocus and auto-exposure workflows without exposing their internal attempts as event storms
  • adds lifecycle events for stable Thermocycler lid, temperature, deactivation, and protocol operations
  • preserves ImageReader composition without duplicate instrumentation
  • adds canonical schemas, user references, and focused regression coverage

Event semantics

The new events follow the existing EventBus contract:

  • started / completed / failed lifecycle records share one operation_id
  • normal return values and original exceptions are preserved
  • events identify direct PLR resources
  • event construction remains lazy when no interested subscriber exists
  • measurement matrices, image data, callback objects, backend kwargs, and full protocol objects are deliberately excluded from payloads

For imaging, autofocus and auto-exposure may perform multiple internal hardware captures, but one public capture() request produces one semantic imager.capture lifecycle.

For thermocycling, thermocycler.run_protocol.completed means that the backend coroutine returned successfully. It does not claim independent physical verification that the protocol finished on the instrument.

Intentionally out of scope

  • run_pcr_profile as a separate lifecycle: it remains a composite of existing instrumented operations
  • thermocycler wait/status polling
  • parent/child or causal operation correlation
  • persistence or transport of EventBus records
  • hardware-state normalization
  • raw measurement or image artifact capture

These can be addressed separately without expanding the EventBus contract in this PR.

Validation

  • 226 passed, plus 29 subtests passed, across EventBus, plate-reading/imaging, and thermocycling suites
  • python -m mypy pylabrobot — success across 729 source files
  • python -m ruff check pylabrobot — passed
  • python -m ruff format --check pylabrobot — passed
  • git diff --check — passed
  • documentation Sphinx build with warnings treated as errors — passed
  • pip check — passed

No physical hardware was driven during validation.

Add structured EventBus lifecycles for plate reader operations and imager capture while preserving existing frontend behavior.

Keep measurement and image payloads bounded, and emit one public capture lifecycle across autofocus and auto-exposure internals.
Add structured EventBus lifecycles for stable protocol-facing thermocycler operations without changing backend execution semantics.

Leave composite profile orchestration, waits, and status polling outside this event contract.
Document the canonical EventBus schemas, resource semantics, bounded completion metadata, and intentionally excluded composite operations for plate reading, imaging, and thermocycling.
Use the standard-library math implementation for the scalar golden-ratio calculation so autofocus does not fail when the optional NumPy dependency is absent.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file duplicates what's already documented in the event schemas file.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i.d.

@rickwierenga

Copy link
Copy Markdown
Member

thanks for the PR! tiny comment above

@VivienP

VivienP commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Good catch, I fixed that. No code changes.

@rickwierenga
rickwierenga merged commit d0a806c into PyLabRobot:main Sep 1, 2026
21 checks passed
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