Skip to content

v1 CLARIOstar: simulated fluorescence and luminescence reads - #1530

Merged
BioCam merged 3 commits into
PyLabRobot:mainfrom
BioCam:bmg-clariostar-v1-simulated-fluorescence-luminescence
Oct 22, 2026
Merged

BioCam merged 3 commits into
PyLabRobot:mainfrom
BioCam:bmg-clariostar-v1-simulated-fluorescence-luminescence

Conversation

@BioCam

@BioCam BioCam commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

The Problem

A simulated v1 CLARIOstar sets up, moves its drawer, controls its temperature and reads absorbance, but has no fluorescence or luminescence (clariostar.fluorescence and clariostar.luminescence are None): a protocol that reads fluorescence or luminescence cannot be run, tested or demonstrated without the device. And nothing checks such a protocol's reads before hardware: a fluorescence channel, gain or focal height the device would refuse only shows up on the device.

PR Content

  • CLARIOstarPlus(simulation=True) reads fluorescence (one or several fluorescence channels, from the top or the bottom optic, in flying mode, with enhanced dynamic range, as a matrix scan) and luminescence. Every read is checked and encoded exactly as on the device (the same argument checks and the same RUN parameters), and nothing is sent.
  • Each measured well reads random counts within the detector's range, or the counts of an earlier result given as simulated_data (from the device or from simulation), so a protocol can be replayed with real data.
  • A read's checks and RUN parameters are now one method of each feature (_get_run_parameters), which the simulator calls; the device's reads send the same bytes as before.
  • Fluorescence spectra, filter detection and z-profiles raise NotImplementedError in simulation for now.
from pylabrobot.bmg_labtech.clariostar import CLARIOstarPlus
from pylabrobot.lib.fluorescence import FluorescenceChannel
from pylabrobot.resources import cor_96_wellplate_360uL_Fb

clariostar = CLARIOstarPlus(simulation=True)
await clariostar.setup()
plate = cor_96_wellplate_360uL_Fb("plate")
await clariostar.drawer.open()
clariostar.plate_holder.assign_child_resource(plate)
await clariostar.drawer.close()

fitc = FluorescenceChannel(
  excitation_wavelength=485,
  excitation_bandwidth=15,
  emission_wavelength=528,
  emission_bandwidth=20,
)
# random counts in column 1, every argument checked as on the device
result = await clariostar.fluorescence.measure(fitc, gain=1000, wells=plate.get_items("A1:H1"))
# the same wells again, replayed from the earlier result
again = await clariostar.fluorescence.measure(
  fitc, gain=1000, wells=plate.get_items("A1:H1"), simulated_data=[result]
)

# luminescence is simulated the same way, here in two wells
glow = await clariostar.luminescence.measure(
  emission_wavelength=580, emission_bandwidth=80, wells=[plate.get_well("A1"), plate.get_well("H12")]
)

🤖 Generated with Claude Code

BioCam and others added 3 commits October 22, 2026 18:22
- `Drawer.close()` checks the plate on the plate holder, its lid included, against
  `_maximum_plate_size_z` (20 mm) before anything is sent, and raises `ValueError` if it is
  taller; with no plate it closes as before.
- Placing a plate is not checked: a tall plate can stand on the open drawer.
- `stop()` raises the same error and leaves the drawer and the connection open.
- Quit codes 242 and 243 are named: the wellplate sensor failed, or no wellplate is inserted or
  the focal height is too low for the one detected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The simulated reader reads fluorescence (several fluorescence channels, matrix scans) and
  luminescence as random counts within the detector's range, or replays earlier results given
  as `simulated_data`; spectra, filter detection and z-profiles raise NotImplementedError.
- A read's checks and RUN parameters are in one method the simulator reuses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@BioCam
BioCam marked this pull request as ready for review October 22, 2026 19:00
@BioCam
BioCam merged commit b3d64ed into PyLabRobot:main Oct 22, 2026
27 checks passed
@BioCam
BioCam deleted the bmg-clariostar-v1-simulated-fluorescence-luminescence branch October 22, 2026 19:22
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.

1 participant