Skip to content

Intro to Labrad

Kyle Matsuda edited this page Nov 25, 2020 · 10 revisions

For more information see here:

This is a very brief introduction to how Labrad is used in our experiment control system.

Labrad (stylized "LabRAD", but we're lazy) is an "asynchronous client/server RPC system designed for scientific laboratories". Basically, it provides a protocol for different instruments on the experiment to talk to each other (asynchronously). Nearly all of the code that we interact with directly while running the experiment (GUI's, etc.) is independent from Labrad. Labrad just provides the backend for sending information between independent pieces of code.

The basic objects in Labrad are servers. Servers expose methods that can be run by clients to do things. In our experiment, servers range from very low-level (e.g., a server that sends GPIB commands) to more abstract (e.g., conductor, which tells the various parts of the experiment what to do on each run). Labrad simply provides a protocol for clients to interact with servers, and for servers to interact with each other.

A key feature of this protocol is that it's asynchronous. Usually, we're used to working with synchronous code, where lines of code execute in sequence, and each line only executes after the previous one has finished. Asynchronous code instead allows the next line to start executing even though the current line may not have finished (this is particularly helpful when working with hardware). For more information, see here for an introduction to asynchronous code using Twisted (which we use extensively via functions like twisted.internet.defer.yield and twisted.internet.defer.Deferred).

Table of contents

Intro

Getting started

Clone this wiki locally