Sweeper Module

class zhinst.toolkit.control.drivers.base.SweeperModule(parent: zhinst.toolkit.control.drivers.base.base.BaseInstrument, clk_rate: float = 60000000.0)

Implements a base Sweeper Module for Lock-In instruments.

The Sweeper Module allows for simple and efficient parameter sweeps while acquiring data streams from mutiple different signal sources. The module supports well defined sweeps of various parameters as well as application specific measurement presets. For more information on how to use the Sweeper Module, have a look at the LabOne Programming Manual.

This base class is overwritten by device specific Sweeper Modules with additional signal sources and types. After setup, the nodetree of the module is retrieved from the API and added to the Sweeper object attributes as zhinst-toolkit Parameters.

For a list of device parameters that support sweeping, use the sweep_parameter_list() method.

>>> mfli.sweeper.sweep_parameter_list()
['auxout0offset',
'auxout1offset',
'auxout2offset',
'auxout3offset',
'demdod0phase',
'demdod1phase',
'frequency',
'output0amp',
'output0offset']

A typical measurement configuration for a simple frequency sweep would look like this:

>>> mfli.sweeper.start(1e3)
>>> mfli.sweeper.stop(510e3)
>>> mfli.sweeper.samplecount(100)
>>> mfli.sweeper.sweep_parameter("frequency")
set sweep parameter to 'frequency': 'oscs/0/freq'

Similarly to the DAQModule, signals can be listed with signals_list() and added to the measurement with signals_add(…).

>>> mf.sweeper.signals_list()
['auxin0', 'demod0', 'demod1', 'imp0']
>>> signal = mfli.sweeper.signals_add("demod0")

The sweep is performed and the measurement result for the acquired signal is added as an entry in the results dictionary of the Sweeper Module.

>>> mfli.sweeper.measure()
Subscribed to: '/dev3337/demods/0/sample'
Sweeping 'oscs/0/freq' from 1000.0 to 510000.0
Progress: 0.0%
Progress: 6.0%
Progress: 12.0%
...
>>> result = mfli.sweeper.results[signal]

For more information on the results object, see the documentation for zhinst.toolkit.control.drivers.base.sweeper.SweeperResult below.

signals

A list of node strings of signals that are added to the measurement and will be subscribed to before data acquisition.

Type

list

results

A dictionary with signal strings as keys and zhinst.toolkit.control.drivers.base.daq.SweeperResult objects as values that hold all the data of the measurement result.

Type

dict

application(application: str) → None

Sets one of the available application presets.

The applications are defined in the global variable APPLICATIONS. They include parameter_sweep, noise_amplitude_sweep, frequency_response_analyzer and more.

Parameters

application (str) – The keyword for the application. See available applications with application_list().

application_list() → List

Lists the availbale application presets.

Returns

A list of keywprd strings with the available applications.

measure(verbose: bool = True, timeout: bool = 20) → None

Performs the measurement.

Starts a measurement and stores the result in sweeper.results. This method subscribes to all the paths previously added to sweeper.signals, then starts the measurement, waits until the measurement is finished and eventually reads the result.

Keyword Arguments
  • verbose (bool) – A flag to enable or disable output on the console. (default: True)

  • timeout (int) – The measurement will be stopped after timeout. The value is given in seconds. (default: 20)

signals_add(signal_source: str) → str

Adds a signal to the measurement.

The according signal node path will be generated and added to the module’s signal list attribute. The signal node will be subscribed to before measurement and the SweeperResult for this signal will be added as an item in the results attribute after measurement. Available signal sources can be listed using signals_list().

Parameters

signal_source (str) – A keyword string that specifies the source of the signal, e.g. “demod1”.

Returns

The exact node string that will be subscribed to, can be used as a key in the results dict to get the measurement result to this signal.

signals_clear() → None

Resets the signal list attribute to an empty list.

signals_list() → List

Lists the keywords for available signals that can be added to the measurement.

Returns

A list of the available signals.

sweep_parameter(param: str) → None

Sets the sweep parameter.

The parameter to sweep should be given by a keyword string. The available parameters can be listed with sweep_parameter_list().

Parameters

param (str) – The string corresponding to the parameter to sweep during measurement.

sweep_parameter_list() → List

Lists the keywords for available parameters that can be swept during the measurement.

Returns

A list with keywords of the available sweep parameters.

Result class for the Sweeper Module

class zhinst.toolkit.control.drivers.base.sweeper.SweeperResult(path: str, result_dict: Dict)

A wrapper class around the result of a SweeperModule measurement.

Adds all the items of the dictionary returned from the API as attributes to the class, e.g. attributes like value, grid, etc.

attributes

A list of all the attributes that were returned from the API as a measurement result.

Type

list