No project description provided
Project description
cerillo
cerillo
Cerillo python API for control of Cerillo devices
Table of Contents
Installation
pip install cerillo
Usage
Below are concrete examples showing how to instantiate, connect, control, and disconnect StratusReader and RayoReader. These examples use the real public APIs implemented in cerillo.base_plate_reader and the reader modules.
StratusReader
The StratusReader extends CerilloBasePlateReader. Key methods on the base class include connect(), disconnect(), and read_absorbance(...).
Example (safe local test using simulation):
from cerillo.stratus import StratusReader
# Create a reader. Use simulate=True for local testing without hardware.
reader = StratusReader(port="/dev/ttyUSB0", simulate=True)
# Connect (in simulation this will set up simulated device fields)
reader.connect()
# Print a quick summary populated by connect()/initialize()
print(reader)
# Read absorbance: wavelength (int), interval (seconds), duration (seconds)
# This method blocks and reads CDCL data until data transmission is received.
# The wavelength must be present on the device for it to work properly
try:
data = reader.read_absorbance(wavelength=600, interval=60, duration=3600)
print("Absorbance data:", data)
finally:
# Always disconnect to clean up
reader.disconnect()
Notes:
- Use
simulate=Truewhen developing without hardware. Whensimulate=False(default) the reader will open a serial port. read_absorbanceuses the CDCL protocol and returns the parsed data transmission response when available.
RayoReader
RayoReader also extends CerilloBasePlateReader and adds motor control utilities. The constructor accepts has_motor to enable motor operations and simulate for dry runs.
Example (motor commands + simulation):
from cerillo.rayo import RayoReader, MotorStepCommand, MotorNamedCommand
# Create a Rayo reader. Enable simulate for dry-run and has_motor if device has a motor.
reader = RayoReader(port="/dev/ttyUSB0", has_motor=True, simulate=True)
# Connect (simulation will populate device info)
reader.connect()
print(reader)
# read absorbance
# The wavelength must be present on the device for this to work
data = reader.read_absorbance(wavelength=590)
# Move motor by a number of steps (positive/negative). If simulate=True this will print simulated responses.
step_cmd = MotorStepCommand(steps=100)
ok = reader.move_motor(step_cmd)
print("Motor step result:", ok)
# Use named commands for common operations: 'c' (close) and 'o' (open) are provided helpers.
close_ok = reader.close_lid()
open_ok = reader.open_lid()
print("Close lid result:", close_ok, "Open lid result:", open_ok)
# When done
reader.disconnect()
Notes:
- If
move_motoris called on a reader constructed withouthas_motor=True, it will return False and print a helpful message. - Motor commands are represented by
MotorStepCommand(step count) andMotorNamedCommand(string commands). Both inherit the CDCL command base and are sent withsend_commandinternally.RayoReader::open_lid()andRayoReader::close_lid()use theMotorNamedCommand.
Basic experiment setup (CDCL ExperimentBuilder)
A minimal flow to create an experiment and start it with the reader:
from cerillo.cdcl.experiment_builder import ExperimentBuilder
from cerillo.stratus import StratusReader
# Build an experiment configuration
builder = FullExperimentBuilder()
builder.experiment().set_name("example_experiment").set_interval(60).set_duration(3600)
builder.plate().set_manufacturer("corning")
# add plates, templates, etc. via builder API
# builder.set_interval(...)
# Create reader and start the experiment
reader = StratusReader(simulate=True)
reader.connect()
try:
# Use start_experiment if you want the reader to send the builder messages and collect data
data = reader.start_experiment(builder)
print("Experiment data:", data)
finally:
reader.disconnect()
License
cerillo is distributed under the terms of the GPLv3 license.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cerillo-0.0.3.tar.gz.
File metadata
- Download URL: cerillo-0.0.3.tar.gz
- Upload date:
- Size: 29.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4768b93932a4143202966f740492157b2266c3eeb8771a37b8a4bd69d0f35bd9
|
|
| MD5 |
bc85d43138a5c8664529401270fffb1f
|
|
| BLAKE2b-256 |
58eb24f38e5d24ca0ceecc6910a76c49b1b859ab7944c8114cd9d0c23e2775e1
|
File details
Details for the file cerillo-0.0.3-py3-none-any.whl.
File metadata
- Download URL: cerillo-0.0.3-py3-none-any.whl
- Upload date:
- Size: 29.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b6f37709f3027e81e9d90b30584d74060f722f59ee61dc9f6f10afe3537bd9e
|
|
| MD5 |
0ccbe399376e43e1912683fb41bfa948
|
|
| BLAKE2b-256 |
acd392eb1061a144fcc63b2ff98816e49691dfc46c921e39aa13bf33e5080542
|