What is a PLESTY device?
A device module wraps a single lab instrument and exposes a standardized Python API over TCP/IP. Once running as a server, any client — an experiment script, an analyzer, or an interactive notebook — can drive the instrument with the same interface.
Device vs Experiment vs Analyzer
- One instrument
- Inherits
BaseDeviceSyncModel - Params defined in JSON schema
- Runs as ZMQ TCP server
- Tested with
DevicePipeline
- Data processing logic
- Connects to device clients
- No hardware ownership
- No TCP server (client-side only)
- Unit testable without hardware
- Orchestrates devices + analyzers
- Uses
CompositeDevice - Defines measurement sequences
- Returns structured results
- Mocked without hardware in tests
When to build a device
Build a device module when you are wrapping a single physical instrument — a laser, a power meter, a rotation stage, a DAQ card. The device module's job is to make that instrument's capabilities available over the network using a consistent, validated API.
Build an experiment module when you need to coordinate multiple instruments for a measurement sequence (e.g., sweep laser wavelength while measuring power).
Steps to build a device
- Scaffold the project —
plesty init device - Implement the base class —
connect,disconnect,_write_,_query_ - Define schemas —
param_schema.json,op_schema.json - Implement hardware communication — traffic manager + command solver
- Run as TCP server —
build_server,build_client - Pass Gate d1 —
DevicePipelinemock tests