This page was generated from docs/examples/Parameters/Legacy_Parameters.ipynb. Interactive online version: Binder badge.

Legacy parameter examples

These are parameters which are no longer used in the modern implementations of QCoDeS but are kept here as examples for applications which still feature them.

ArrayParameter

Note: This is an older base class for array-valued parameters. For any new driver we strongly recommend using ParameterWithSetpoints class which is both more flexible and significantly easier to use. Refer to notebook on writing drivers with ParameterWithSetpoints.

We have kept the documentation shown below of ArrayParameter for the legacy purpose.

While storing the ArrayParameter data in the database using datasaver.add_result() , be informed that it is stored as BLOB in one row of sqlite database. Where the BLOB in sqlite has a default max length limit set at 1 billion (1,000,000,000) bytes.

ArrayParameter is, for now, only gettable.

[1]:
from qcodes.instrument import ArrayParameter


class ArrayCounter(ArrayParameter):
    def __init__(self):
        # only name and shape are required
        # the setpoints I'm giving here are identical to the defaults
        # this param would get but I'll give them anyway for
        # demonstration purposes
        super().__init__(
            "array_counter",
            shape=(3, 2),
            label="Total number of values provided",
            unit="",
            # first setpoint array is 1D, second is 2D, etc...
            setpoints=((0, 1, 2), ((0, 1), (0, 1), (0, 1))),
            setpoint_names=("index0", "index1"),
            setpoint_labels=("Outer param index", "Inner param index"),
            docstring="fills a 3x2 array with increasing integers",
        )
        self._val = 0

    def get_raw(self):
        # here I'm returning a nested list, but any sequence type will do.
        # tuple, np.array, DataArray...
        out = [[self._val + 2 * i + j for j in range(2)] for i in range(3)]
        self._val += 6
        return out


array_counter = ArrayCounter()

# simple get
print("first call:", array_counter())
Logging hadn't been started.
Activating auto-logging. Current session state plus future input saved.
Filename       : /home/runner/.qcodes/logs/command_history.log
Mode           : append
Output logging : True
Raw input log  : False
Timestamping   : True
State          : active
Qcodes Logfile : /home/runner/.qcodes/logs/241211-19207-qcodes.log
first call: [[0, 1], [2, 3], [4, 5]]
[ ]: