Skip to content

Device Driver Development

sinus edited this page Jan 8, 2025 · 4 revisions

If your configuration of qkit sets the user_instrument_dir qkit-cfg option, you can place instrument drivers in that directory and load them in your notebooks. The Default Configuration currently sets it to a instruments folder next to your current notebook. Please add the file to mainline qkit for distribution when you're done.

A basic device driver looks like this:

from qkit.core.instrument_base import Instrument

class testinstrument(Instrument):

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        pass

It extends Instrument and must call its super-constructor.

In order to add a property, write functions called something like do_set_<paramname> and do_get_<paramname> to create the device specific getter and setter implementations. By calling

self.add_parameter('startfreq', type=float,
            flags=Instrument.FLAG_GETSET,
            minval=0, maxval=20e9,
            units='Hz', tags=['sweep'])  

in the constructor, the parameter is added. This wraps your implementation as set_<paramname> and get_<paramname>, with some validation. Also, the values are available in your measurement file, when the device is used.

Typically, a get_all(self) function is defined and called at the end of the constructor to load all values from the device.

Compatibility to measurement classes

Measurement classes have implicit interfaces to their corresponding device drivers. It is thus recommended to copy a driver for an existing device and then modify it to fit the new device.

Devices

  • VNA

Clone this wiki locally