IQPY is a Python package for configuring laboratory devices with different APIs in a uniform declarative way.
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]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 theExpSetupclass.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 theExpSetupclass, which represents an experimental setup with a set of devices. The class supports configuration from JSON files.config_example.json5— Example configuration file forExpSetup. Contains all supported parameters with comments for each device.diode_watching.ipynb— Example Jupyter Notebook for monitoring signals from PIN diodes.
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:
- A correlator
correlatorof typelbus.Correlator. - An array of diodes
pin_diodesof typelist[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.
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.
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.