Skip to main content

Remote control lab instruments

Project description

Lab Control

This repository contains classes to control lab equipment in a simple and unified way.

API Reference

Measurement Devices

Other Classes

Getting Started

Installation

Install the package directly from version control using pip:

pip install git+https://git.aei.mpg.de/quantum-control/software/lab_control.git/

Using Measurement Devices

All measurement devices inherit from the Device class. This means that they have at least three methods, __init__(), get_measurement(), and measure(), which always have the same basic signature except for some additional keyword arguments.

Some devices also have additional methods like saving a screenshot or automatically adjusting the range.

When creating and instance of a measurement device, you will need to provide the VISA address of the device and you can also provide a dictionary of default settings, more on the default mechanism later.

from lab_control import DSOX2024A

dev = DSOX2024A('USB0::0x0957::0x1796::MY60476362::0::INSTR', defaults={'time_points': 1000})

Measurements

get_measurement()

The get_measurement() method is used to get the current data from the device without changing any settings or explicitly starting a measurement. This is useful when you are mostly working on the device itself and only want to save measurement data.

You can pass a name, comment, and additional metadata about you experiment or the measurement that will be stored in the 'user' section of the metadata. If you do not specify a name the measurement will be named automatically based on the device, some of the parameters, and the current time.

measure()

To explicably start a measurement with specific parameters you should use the measure() method, in addition to the name, comment, and meta parameters that are available in the get_measurement() method, you can specify the measurement parameters. A list of the available parameters can be found in the documentation of the specific device. These parameters are generally not exhaustive as most devices have many more settings that are rarely used, the set of available parameters will be extended as needed. You can also set no_defaults=True to ignore all default settings and fall back to the current device settings. You will get a warning with a of all parameters that are not specified in the function call or defaults, this can be disabled with show_warnings=False.

The parameters are written to the device and read back, this will ensure, that parameters which were adjusted by the device to be within the allowed range are used.

Once the parameters are set, continuous measuring is suspended and the device will perform a single shot measurement as far as applicable for the device. This may also include multiple averaging cycles. Depending on the device, the measurement might take a while. After the measurement is done, the data is read from the device and the device is set back to continuous measuring if it was set to continuous measuring before.

Defaults

To avoid having to specify all parameters every time everywhere, default settings can be provided on different levels. The fallback order is the following:

  • Function parameters that are passed to the measure() method
  • Instance defaults that were specified in the constructor.
  • Class defaults that are sometimes specified in the class definition.
  • Current device settings

The higher levels override the lower levels. This means that if a parameter is specified in the measure() method, it will override the instance defaults, and so on. You should avoid relying on the class defaults or the current device settings, the class defaults are currently still subject to change and the current device settings depend on the prior usage of the device. If you expect you script to live longer than a day, you should always specify all parameters in the instance defaults or as function parameters to ensure consistency.

You can also explicitly ignore a default on any level by setting it to None, if this means that the parameters is not specified on any level the device settings will be used. You can use this for example to ignore the class defaults when initializing an instance. Or to use the current device settings when calling the measure() method.

You can also use the no_defaults parameter in the measure() method to ignore all defaults for a single measurement.

Measurement Objects

Both the get_measurement() and measure() methods return a Measurement object. A measurement has three members, df which contains tabular data as a pandas DataFrame, meta which contains metadata as a dictionary, and attachments which contains named binary attachments in a dictionary.

The Metadata always contains a 'file' which contains information about the file itself, like the name, delimiter and index column. The 'user' section contains user specified data. Finally the 'dev' section contains the parameters that were used for the measurement.

Measurements can be saved and loaded to and from disk with the save() and load() methods. If the measurement contains attachments it needs to be saved with save_zip() which will save the measurement and its attachments to a zip file. The zip file can be loaded with the normal load() method.

Measurements have a _repr_html_() method for a nicer display in Jupyter notebooks, they can also be plotted with the plot() convenience function. Measurements can also be combined by inserting one measurement into another with the insert() method.

Other Notes

The repository uses symlinks so that the example files can access the src directory. Git will only recreate the symlinks when symlinks are enables with

git config core.symlinks true

Or with --global to enable it for all repositories.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lab_control-0.3.0.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lab_control-0.3.0-py3-none-any.whl (25.0 kB view details)

Uploaded Python 3

File details

Details for the file lab_control-0.3.0.tar.gz.

File metadata

  • Download URL: lab_control-0.3.0.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.5 Windows/10

File hashes

Hashes for lab_control-0.3.0.tar.gz
Algorithm Hash digest
SHA256 7ffeed7f9439c468d805b96c3d64b0de7c4d01ab933059bc42fb361a8782af30
MD5 f4edd9180b4da83c880a4224b56effe2
BLAKE2b-256 b9a6f879ef086544f989bad4fb7ce56fd29f62c4114893610652fb0d5d24cd6c

See more details on using hashes here.

File details

Details for the file lab_control-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: lab_control-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 25.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.5 Windows/10

File hashes

Hashes for lab_control-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a30c6108e69cd513c672c63c32cd78f73ff80cc21367cbe90d052fd38137c22d
MD5 05859ab4d8a99ccc5c89b4f941be881f
BLAKE2b-256 d91845d4fc0d8e88d0dffa1aa619963d1df163ac94a481329e5878607bbec1f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page