One experiment module can now measure in several setups — say, in place with four devices on one computer, or navigating to quantum dots with a camera bench as well — and the run's own configuration decides which. plesty-lib 0.6.0 adds the hook; PLESTY Bench 0.5.0 uses it to start only the devices a run needs.

The problem it removes

An experiment lists every device it can use in setup.yaml, together with the benches (lab computers) those devices run on. Until 0.6.0 every run took the whole list: the bench started every device, and the run refused to begin while any bench in the file had an unset address or token. A measurement that needed only the polarisation optics and the spectrometer still stopped on the camera bench nobody had configured.

Example: a module whose setup.yaml lists polarisation optics, a spectrometer and a power meter on one bench, and a camera and stage on another.

Measure in place — dots: []

devices served
hwpqwpspecpmcamstage

The camera bench need not be set up.

Navigate to dots — dots: [QD-1]

devices served
hwpqwpspecpmcamstage

Every device, as before.

For users: nothing new to learn

Pick the configuration as you always did. If the experiment module declares which devices each configuration uses, PLESTY Bench asks it before the run starts, then serves and share-checks only those devices and their benches. It no longer asks for the address of a device the run will not touch.

To see what a configuration will use without connecting anything:

python -m <module> --devices --config in-place.yaml
# {"devices": ["hwp", "qwp", "spec", "pm"]}

python -m <module> --devices --config navigate.yaml
# {"devices": null}      ← null means every device in setup.yaml
A run started by hand from a terminal follows the same rule: only the benches of the chosen devices must have their variables set in .env. The bench the run itself is on is always kept, because that is where the run finds the shared data disk.

For module developers: one decorator

An experiment module built on ExperimentCLI registers @cli.needs. It receives the run's loaded settings and returns the names of the setup.yaml devices they use, or None for all of them:

from plesty.lib.experiment import ExperimentCLI, Manifest

cli = ExperimentCLI(Manifest(module="my_experiment", title="My experiment"))

@cli.needs
def needs(config):
    # Measuring in place uses one bench; navigating to dots uses the camera bench too.
    return ["hwp", "qwp", "spec", "pm"] if not config.get("dots") else None

What registering it changes

WhereEffect
--manifestThe module's declaration gains "chooses_devices": true. This is how the bench knows to ask.
--devicesNew option: prints the chosen devices as JSON and exits, connecting nothing.
Starting a runapply_setup(devices=…) reduces the setup with Setup.only(…) to those devices, their benches and this machine, so only their variables are required.
A wrong nameA device that setup.yaml does not have is refused before anything connects: no device cam in setup.yaml (it has hwp, spec).
The hook is optional. A module without @cli.needs reports chooses_devices: false and --devices prints {"devices": null}, so it behaves exactly as before. Add it only when a module really has setups that use different devices.

Keep it cheap and pure

Upgrading to 0.6.0

@cli.needs is purely additive. The same release, though, opens a new line with breaking changes to where devices write data. Read these before raising the pin:

The plesty-lib CHANGELOG.md 0.6.0 entry gives the migration for each.

Also new in the viewer: pause a replay

A viewer replaying a finished run (monitor --replay, or viz.view of a run with replay rows) now has Replay ▸ Pause/Resume, also on the space bar. The plots stop where they are; panels can still be moved and closed. A live run has no such menu. Code that builds its own window calls the shell's pause(), resume() and paused, and offer_pause() adds the menu — so a module that reached into the shell's private timer for this can drop its copy.