<jupyter_start><jupyter_text>Buffered Messurenment SR830Example notebook of buffered measurement for a bundle of SR830 lock-ins. This notebook is shipped together with the file do2d_multi.py containing the function do2d_multi. The do2d_multi is just a function wrapping the QCoDeS Measurement context manager. The do2d_multi takes a list of SR830 lock-ins and perform a buffered measurement, of either channel 1, channel 2 or both. Optionally a list of non-buffered parameters can be provided to be measured on the same grid as the lock-ins. However, adding a nonbuffered parameter will slow the measurement down.<jupyter_code># IMPORTS

import qcodes as qc
import os
import numpy as np
from qcodes.instrument_drivers.stanford_research.SR830 import SR830
from qdev_wrappers.measurement_helpers.do2d_multi import do2d_multi
from qcodes.instrument.base import Instrument
from qcodes.utils.validators import Numbers, Arrays
import qcodes.instrument_drivers.agilent.Agilent_34400A as agi
from qcodes.dataset.plotting import plot_dataset<jupyter_output><empty_output><jupyter_text>Dummy GeneratorVirtual instrument to be used instead of af DAC or other external setting parameter<jupyter_code>class DummyGenerator(Instrument):

    def __init__(self, name, **kwargs):

        super().__init__(name, **kwargs)

        self.add_parameter('v_start',
                           initial_value=0,
                           unit='V',
                           label='v start',
                           vals=Numbers(0,1e3),
                           get_cmd=None,
                           set_cmd=None)

        self.add_parameter('v_stop',
                           initial_value=1,
                           unit='V',
                           label='v stop',
                           vals=Numbers(1,1e3),
                           get_cmd=None,
                           set_cmd=None)
        
        self.add_parameter('v_now',
                           initial_value=0,
                           unit='V',
                           label='v_now',
                           vals=Numbers(self.v_start(),self.v_stop()),
                           get_cmd=None,
                           set_cmd=None)
# The parameter to be set in the outer loop
slow = DummyGenerator('slow')

# The parameter to be set in the inner loop 
fast = DummyGenerator('fast')<jupyter_output><empty_output><jupyter_text>Connect to and Initialze the SR830s<jupyter_code>sr = SR830('lockin', 'GPIB0::2::INSTR')
sr2 = SR830('lockin2', 'GPIB0::1::INSTR')
a1 = agi.Agilent_34400A('Agilent1', 'GPIB0::4::INSTR')

sr.ch1_display('X')
sr.ch1_ratio('none')
sr2.ch1_display('X')
sr2.ch1_ratio('none')
sr.ch2_display('Y')
sr.ch2_ratio('none')
sr2.ch2_display('Y')
sr2.ch2_ratio('none')
a1.reset()
a1.NPLC.set(10)<jupyter_output>Connected to: Stanford_Research_Systems SR830 (serial:s/n70597, firmware:ver1.07) in 1.02s
Connected to: Stanford_Research_Systems SR830 (serial:s/n47762, firmware:ver1.07) in 0.13s
Connected to: HEWLETT-PACKARD 34401A (serial:0, firmware:10-5-2) in 0.11s<jupyter_text>Tuple of lock-ins<jupyter_code>lockins = (sr,sr2)<jupyter_output><empty_output><jupyter_text>do2d_multiThis is a do2d to be used for a collection of SR830. Args:*    param_slow: The QCoDeS parameter to sweep over in the outer loop*   start_slow: Starting point of sweep in outer loop*   stop_slow: End point of sweep in the outer loop*   num_points_slow: Number of points to measure in the outer loop*   delay_slow: Delay after setting parameter in the outer loop*   param_fast: The QCoDeS parameter to sweep over in the inner loop*   start_fast: Starting point of sweep in inner loop*   stop_fast: End point of sweep in the inner loop*   num_points_fast: Number of points to measure in the inner loop*   delay_fast: Delay after setting parameter before measurement is performed*   lockins: Tuple of lockins*   devices_no_buffer: Iterable of Parameters to be measured alongside the lockins*   write_period: The time after which the data is actually written to the database.*   threading: For each element which are True, write_in_background, buffer_reset, and send_trigger and get_trace will be threaded respectively*  channels: channels to get from the buffer. 0 gets both channels*   attempts_to_get: Maximum number of attempts to try to get the buffer if it fails*  delay_fast_increase: Amount to increase delay_fast if getting the buffer fails<jupyter_code>datatuple = do2d_multi(param_slow = slow.v_now,
           start_slow = 0,
           stop_slow = 0.5,
           num_points_slow = 10,
           delay_slow = 0.05,
           param_fast = fast.v_now,
           start_fast = 0,
           stop_fast = 0.5,
           num_points_fast = 10, 
           delay_fast = 0.07,
           lockins = lockins,
           write_period = 1,
           threading=[True,False,False,True],
           channels = 0,
           attempts_to_get=50,
           delay_fast_increase=0.00
              )
# ploting the data
plot_dataset(datatuple[0])<jupyter_output><empty_output><jupyter_text>Adding a non-buffered parameter to measure<jupyter_code>devices_no_buffer = (a1.volt,)
datatuple = do2d_multi(param_slow = slow.v_now,
           start_slow = 0,
           stop_slow = 0.5,
           num_points_slow = 10,
           delay_slow = 0.05,
           param_fast = fast.v_now,
           start_fast = 0,
           stop_fast = 0.5,
           num_points_fast = 10, 
           delay_fast = 0.07,
           lockins = lockins,
           devices_no_buffer = devices_no_buffer, 
           channels = 1,
           threading=[True,False,False,True],
           attempts_to_get=50,
           delay_fast_increase=0.00
              )
plot_dataset(datatuple[0])
plot_dataset(datatuple[1])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07870610620999827, 'fraction_numerical': 0.030444559764746585, 'mean_word_length': 2.7521090201168072, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '623719', 'license': 'MIT', 'n_tokens_mistral': 1887, 'n_tokens_neox': 1744, 'n_words': 495, 'path': 'examples/measuring/do2d_multi.ipynb', 'repo_name': 'RasmusBC59/qdev-wrappers', 'size': '5781'}