<jupyter_start><jupyter_text>UHFLIWe use the `ziqc.UHFLI` instrument driver for the UHFLI Lock-In amplifier.<jupyter_code>import numpy as np
import matplotlib.pyplot as plt

import qcodes as qc
import zhinst.qcodes as ziqc

uhfli = ziqc.UHFLI("uhf1", "dev2324", interface="1GbE", host="10.42.0.226")<jupyter_output>Successfully connected to data server at 10.42.0.2268004 api version: 6
Successfully connected to device DEV2324 on interface 1GBE
Connected to: Zurich Instruments UHFLI (serial:dev2324, firmware:65939) in 1.49s<jupyter_text>NodetreeAccess the UHFLI's nodetree:<jupyter_code>print([k for k in uhfli.submodules.keys()])
print([k for k in uhfli.parameters.keys()])<jupyter_output>['awg', 'daq', 'sweeper', 'stats', 'oscs', 'demods', 'extrefs', 'triggers', 'status', 'dios', 'auxins', 'system', 'sigins', 'sigouts', 'mods', 'boxcars', 'outputpwas', 'inputpwas', 'aucarts', 'aupolars', 'pids', 'features', 'auxouts', 'cnts']
['IDN', 'clockbase']<jupyter_text>The `Parameter` *sample* of the demodulators uses the `getSample(...)` method of the *ziPython* API to read the latest sample of the demodulator.<jupyter_code>uhfli.demods[0].sample()<jupyter_output><empty_output><jupyter_text>> ⚠️ Note that this parameter only returns a *single* sample. There is no guarantee for any precise time-relation between consecutive samples. For proper (triggered) data acquisition of signals aligned to a precise time-grid, please use the *Data Acquisition Module* (see below).  The *Data Acquisition Module* of the UHFLISimilarly to the MFLI, the UHFLI comes with a *Data Acquisition Module*. For more details, see the corresponding example about the *Data Acquisition Module*.<jupyter_code>print([k for k in uhfli.daq.parameters.keys()])<jupyter_output>['awgcontrol', 'bandwidth', 'bitmask', 'bits', 'buffercount', 'buffersize', 'clearhistory', 'count', 'delay', 'device', 'duration', 'edge', 'enable', 'endless', 'eventcount_mode', 'fft_absolute', 'fft_window', 'findlevel', 'flags', 'forcetrigger', 'grid_cols', 'grid_direction', 'grid_mode', 'grid_overwrite', 'grid_repetitions', 'grid_rowrepetition', 'grid_rows', 'grid_waterfall', 'historylength', 'holdoff_count', 'holdoff_time', 'hysteresis', 'level', 'preview', 'pulse_max', 'pulse_min', 'refreshrate', 'save_csvlocale', 'save_csvseparator', 'save_directory', 'save_fileformat', 'save_filename', 'save_save', 'save_saveonread', 'spectrum_autobandwidth', 'spectrum_enable', 'spectrum_frequencyspan', 'spectrum_overlapped', 'triggered', 'triggernode', 'type']<jupyter_text>The method `signals_list()` shows the available sources of streaming signals. Note that they differ with the installed options of the UHFLI.<jupyter_code>uhfli.daq.signals_list()<jupyter_output><empty_output><jupyter_text>Use the method `signals_add(..)` to specify which signals should be acquired during a measurement. The return value gives the exact node path that will be subscribed to before the measurement.<jupyter_code>demod_x = uhfli.daq.signals_add("demod0", "x")
demod_y = uhfli.daq.signals_add("demod0", "y")

# which signal nodes have been added?
print(uhfli.daq.signals)<jupyter_output>['/dev2324/demods/0/sample.x.avg', '/dev2324/demods/0/sample.y.avg']<jupyter_text>Use *trigger type*, *grid columns*, *grid rows* and other parameters to configure the measurement you want.<jupyter_code>uhfli.daq.type("continuous")
uhfli.daq.grid_cols(100)
uhfli.daq.grid_rows(100)<jupyter_output><empty_output><jupyter_text>The measurement routine is started using the `measure(...)` method. At first, the mdoule will subscribe to the signal nodes that were previously added to the measurement. Then the measurement is started. When it is finished, the results will be added to the `results` property of the `daq` Module.<jupyter_code>uhfli.daq.measure()<jupyter_output>subscribed to: /dev2324/demods/0/sample.x.avg
subscribed to: /dev2324/demods/0/sample.y.avg
Progress: 0.0%
Progress: 5.0%
Progress: 12.0%
Progress: 19.0%
Progress: 30.0%
Progress: 37.0%
Progress: 48.0%
Progress: 55.0%
Progress: 62.0%
Progress: 73.0%
Progress: 80.0%
Progress: 91.0%
Progress: 98.0%
Finished<jupyter_text>The results property is a dictionary with the exact signal node as its keys. The return value from `signals_add(..)` can be used to access the result of that signal. The value in the dictionary is a `DAQResult` object that contains all measurement information such as the measurement values, the time- or frequency-axis as well as meta-information.<jupyter_code>uhfli.daq.results[demod_x]
uhfli.daq.results[demod_y]
import matplotlib.pyplot as plt

result_x = uhfli.daq.results[demod_x]

plt.imshow(result_x.value, extent=[result_x.time[0], result_x.time[-1], 0, 100], aspect="auto")
plt.show()<jupyter_output><empty_output><jupyter_text>The *Sweeper Module* of the UHFLIThe UHFLI also feeatures a *Sweeper Module* with all of the following *Parameters*:<jupyter_code>print([k for k in uhfli.sweeper.parameters.keys()])<jupyter_output>['averaging_sample', 'averaging_tc', 'averaging_time', 'awgcontrol', 'bandwidth', 'bandwidthcontrol', 'bandwidthoverlap', 'clearhistory', 'device', 'endless', 'gridnode', 'historylength', 'loopcount', 'maxbandwidth', 'omegasuppression', 'order', 'phaseunwrap', 'remainingtime', 'samplecount', 'save_csvlocale', 'save_csvseparator', 'save_directory', 'save_fileformat', 'save_filename', 'save_save', 'save_saveonread', 'scan', 'settling_inaccuracy', 'settling_tc', 'settling_time', 'sincfilter', 'start', 'stop', 'xmapping']<jupyter_text>As for the *Data Acquisition Module* the available signal sources can be shown with `signals_list(...)`. They can differ depending on the options installed in the instrument.<jupyter_code>uhfli.sweeper.signals_list()<jupyter_output><empty_output><jupyter_text>The *Parameters* that are available for sweeping can be listed with `sweep_parameter_list()`.<jupyter_code>uhfli.sweeper.sweep_parameter_list()<jupyter_output><empty_output><jupyter_text>A typical frequency sweep of the first oscillator frequency (*'frequency0'*) from 1-10 kHz and 100 steps is configured as follows. We add the signal from the first demodulator (*'demod0'*) to the measurement.<jupyter_code># turn singal output on
uhfli.sigouts[0].on(1)

# prepare a frequency sweep
uhfli.sweeper.start(1e3)
uhfli.sweeper.stop(10e3)
uhfli.sweeper.samplecount(100)
uhfli.sweeper.sweep_parameter("frequency0")

# add a singal source
demod = uhfli.sweeper.signals_add("demod0")
uhfli.sweeper.signals<jupyter_output><empty_output><jupyter_text>The measurement is simply started with the `measure()` method:<jupyter_code># perform measurement
uhfli.sweeper.measure()<jupyter_output>subscribed to: /dev2324/demods/0/sample
Sweeping oscs/0/freq from 1000.0 to 10000.0
Progress: 0.0%
Progress: 7.0%
Progress: 14.0%
Progress: 22.0%
Progress: 29.0%
Progress: 36.0%
Progress: 43.0%
Progress: 51.0%
Progress: 59.0%
Progress: 66.0%
Progress: 74.0%
Progress: 82.0%
Progress: 90.0%
Progress: 98.0%
Finished<jupyter_text>The results are stored in the `results` dictionary with the exact node path as the key. The value is a `DAQResults` object from the `zhinst-toolkit`. It contains all the data of the demodulator that has been returned by the Python API.<jupyter_code>result = uhfli.sweeper.results[demod]
result
import matplotlib.pyplot as plt

plt.plot(result.frequency, result.x)
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12898845892735913, 'fraction_numerical': 0.02620502376103191, 'mean_word_length': 7.103410341034103, 'pattern_counts': {'":': 0, '<': 54, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '15', 'dir': 'jupyter-structured-clean-dedup', 'id': '640117', 'license': 'MIT', 'n_tokens_mistral': 2687, 'n_tokens_neox': 2509, 'n_words': 705, 'path': 'examples/example2-4_UHFLI.ipynb', 'repo_name': 'FarBo/zhinst-qcodes', 'size': '7365'}