Plesty Documentation

Build a Device

What devices are in PLESTY, when to use them, and how they differ from experiments and analyzers.

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

Device
  • One instrument
  • Inherits BaseDeviceSyncModel
  • Params defined in JSON schema
  • Runs as ZMQ TCP server
  • Tested with DevicePipeline
Analyzer
  • Data processing logic
  • Connects to device clients
  • No hardware ownership
  • No TCP server (client-side only)
  • Unit testable without hardware
Experiment
  • 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

  1. Scaffold the projectplesty init device
  2. Implement the base classconnect, disconnect, _write_, _query_
  3. Define schemasparam_schema.json, op_schema.json
  4. Implement hardware communication — traffic manager + command solver
  5. Run as TCP serverbuild_server, build_client
  6. Pass Gate d1DevicePipeline mock tests