Skip to content
qotlabsPublic

About

IQPY is a Python package for configuring laboratory devices with different APIs in a uniform declarative way.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

IQPY

IQPY is a Python package for configuring laboratory devices with different APIs in a uniform declarative way.

Installation

To install the package, execute the following commands from the repository directory:

export DEB_PYTHON_INSTALL_LAYOUT=deb_system
pip3 install .

The DEB_PYTHON_INSTALL_LAYOUT environment variable must be set on Ubuntu 22.04 due to a known issue in the system package python3-setuptools.

To install additional optional modules for device support (e.g., Toptica lasers), use:

pip3 install .[devices]

File Structure

  • src/iqpy/mocks/ — Mock classes for device emulation. Intended for use by developers during testing.
  • src/iqpy/models/ — Device model classes that describe the structure of the JSON configuration file. These are not used directly but are utilized in the implementation of the ExpSetup class.
  • src/iqpy/widgets/ — Various widgets for Jupyter Notebook.
  • src/iqpy/widgets/assets/ — JavaScript and CSS style files used by the widgets.
  • src/iqpy/exp_setup.py — Contains the ExpSetup class, which represents an experimental setup with a set of devices. The class supports configuration from JSON files.
  • config_example.json5 — Example configuration file for ExpSetup. Contains all supported parameters with comments for each device.
  • diode_watching.ipynb — Example Jupyter Notebook for monitoring signals from PIN diodes.

ExpSetup

In general, the ExpSetup class contains fields that are device objects. For example, consider an instance setup of the ExpSetup class with the following fields:

  1. A correlator correlator of type lbus.Correlator.
  2. An array of diodes pin_diodes of type list[lbus.PinDiode].

Standard operations can be performed with these fields as follows:

setup.correlator.set_exposure_time(100)
results = setup.pin_diodes[0].get_results()

The ExpSetup class simplifies the creation and initial configuration of laboratory devices by supporting configuration from files in JSON or JSON5 format. The constructor of ExpSetup accepts the path to a JSON configuration file:

from exp_setup import ExpSetup
setup = ExpSetup('config_example.json5')

When creating an ExpSetup instance from JSON, the file is parsed first, then device objects are instantiated and their parameters are initialized according to the configuration.

Configuration File

The JSON configuration file for obtaining the setup from the example above would look like this:

{
  "correlator": {
    "type": "lbus.Correlator",
    "lbus": 1,
    "address": 1
  },
  "pin_diodes": [
    {
      "type": "lbus.PinDiode",
      "lbus": 1,
      "address": 1
    },
    {
      "type": "lbus.PinDiode",
      "lbus": 1,
      "address": 2
    }
  ]
}

The keys "correlator" and "pin_diodes" can be named arbitrarily at the user's discretion. They determine the field names in the ExpSetup class. The type of the object to be created is specified by the mandatory "type" parameter. It is also permissible to specify a field as an array, as shown for "pin_diodes". In Python code, such a field will be represented as a standard list.

License

Copyright © 2022-2026, Quantum Optical Technologies Laboratories.

IQPY is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

IQPY is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See COPYING and COPYING.LESSER for more details.

About

IQPY is a Python package for configuring laboratory devices with different APIs in a uniform declarative way.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages