Quick Start

PLESTY is a platform for controlling laboratory instruments and running measurements with them. plesty-lib is the Python library at its centre: you write your own code on top of it, and it provides the parts every lab program needs, such as talking to an instrument, recording a measurement so that it survives a crash, and checking results.

The three things you build

Code written on plesty-lib comes in three kinds. The PLESTY platform calls each package of such code a module:

Kind

What it does

Example

Device

controls one instrument: reads and changes its settings, triggers its actions

a class for a power meter, with query("WAVELENGTH") and write("WAVELENGTH", 633)

Experiment

runs a measurement: a list of steps, each using one or more devices, with every result saved as it arrives

“set the wavelength to each of 500, 550 … 700 nm and read the power at each”

Analyzer

turns recorded data into a result, without touching an instrument

“find the wavelength where the power is largest”

The data flows in that order: devices produce data, experiments record it, analyzers interpret it.

What you will build

Follow the pages in order; each one uses what the previous one built.

Page

You end up with

A Device

a device for a real power meter, used from a script, from async code and from another computer

An Experiment

a wavelength scan that can be stopped and continued, with a command line

An Analyzer

an analyzer that finds the peak of the scan and writes a report

In a Terminal

all three running together from terminal windows on one computer

No instrument needed. You can follow every page without a real instrument. plesty-lib includes DemoDevice, a pretend power meter: it behaves like a real device, with settings such as wavelength and an action measure_power, but it keeps its settings in memory and makes up its readings instead of talking to hardware. The pages use it wherever an instrument would be. It is one of the stand-ins described in Simulation.

Install

plesty-lib needs Python 3.12 or later. Add it to your project with uv or pip:

uv add plesty-lib            # or: pip install plesty-lib

That is enough for the device, experiment and analyzer pages. Watching a measurement in a window needs more packages, which plesty-lib keeps out of the basic install so that a computer without a screen does not have to install a GUI toolkit. You ask for them by name, as an extra:

uv add "plesty-lib[gui]"     # windows, plots and control panels

Install lists every extra and what it adds.