<jupyter_start><jupyter_text>Back to MatPlot()<jupyter_code># multiple readout within the same graph
sweep_vals = dac.ch1.volt[0:0.2:0.01]

loop = qc.Loop(sweep_vals, delay=0.01).each(lockin.X, lockin.Y)
data = loop.get_data_set(name='testsweep')

plot_1d = qc.MatPlot()  # create a plot
plot_1d.add(data.lockin_X)  # add a graph to the plot
plot_1d.add(data.lockin_Y)  # add a graph to the plot

fig = plot_1d.fig
fig.subplots_adjust(left=0.2, bottom=0.2 )

_ = loop.with_bg_task(plot_1d.update).run()  # run the loop
# multiple readout in different subplots
sweep_vals = dac.ch1.volt[0:0.2:0.01]

loop = qc.Loop(sweep_vals, delay=0.01).each(lockin.X, lockin.Y)
data = loop.get_data_set(name='testsweep')

plot_1d = qc.MatPlot(subplots=2)  # create a plot

plot_1d.add(data.lockin_X,subplot=0)
plot_1d.add(data.lockin_Y,subplot=1)

fig = plot_1d.fig
fig.subplots_adjust(left=0.2,bottom=0.2,wspace = 0.3)

_ = loop.with_bg_task(plot_1d.update).run()  # run the loop
# 2 quantities as a function of each other

sweep_vals = dac.ch1.volt[0:0.2:0.01]

loop = qc.Loop(sweep_vals, delay=0.01).each(lockin.X, lockin.Y)
data = loop.get_data_set(name='testsweep')

plot_1d = qc.MatPlot()  # create a plot
plot_1d.add(data.lockin_X, data.lockin_Y)  # add a graph to the plot

fig = plot_1d.fig
fig.subplots_adjust(left=0.2, bottom=0.2 )

_ = loop.with_bg_task(plot_1d.update).run()  # run the loop
# read-out with scaling
# example: lock-in readout and conversion to conductance in units of 2e^2/h

class conductance_from_lockin(qc.MultiParameter):
    def __init__(self, scale_param):
        # only name, names, and shapes are required
        # this version returns two scalars (shape = `()`)
        super().__init__('conductance_from_lockin', names=('G', 'X'), shapes=((), ()),
                         labels=('Conductance', 'Raw voltage X'),
                         units=('2e^2/h', 'V'),
                         # including these setpoints is unnecessary here, but
                         # if you have a parameter that returns a scalar alongside
                         # an array you can represent the scalar as an empty sequence.
                         setpoints=((), ()),
                         docstring='Conductance converted from raw voltage measurement')
        self._scale_param = scale_param
    
    def get_raw(self):
        voltage = lockin.X.get()
        conductance = voltage * self._scale_param()
        return (conductance, voltage)

bias_voltage = qc.ManualParameter('bias voltage', initial_value=10e-6, units='V')
IVC_gain = qc.ManualParameter('IVC gain', initial_value=1e7)

scaler = 1/(bias_voltage*IVC_gain*75e-6)
conductance = conductance_from_lockin(scale_param=scaler)

my_station = qc.Station(bias_voltage, IVC_gain, lockin, dac)

conductance.get()
loop = qc.Loop(sweep_vals, delay=0.1, station = my_station).each(conductance)
data = loop.get_data_set(name='testsweep')

plot_1d = qc.MatPlot()  # create a plot
plot_1d.add(data.G)  # add a graph to the plot

fig = plot_1d.fig
fig.subplots_adjust(left=0.2, bottom=0.2)

_ = loop.with_bg_task(plot_1d.update).run()  # run the loop<jupyter_output><empty_output><jupyter_text>2D maps<jupyter_code>dac.ch1.name="gate_voltage"
dac.ch2.name="bias_voltage"

gate_voltage = dac.ch1.volt[0:0.2:0.01]
bias_voltage = dac.ch2.volt[0:0.2:0.01]

loop = qc.Loop(gate_voltage, delay=0.01).loop(bias_voltage,delay=0.01).each(lockin.X)

data = loop.get_data_set(name='testsweep')

plot = qc.MatPlot([*data.lockin_X],data.lockin_X,subplots=3) # create a plot
plot.add(data.lockin_X,subplot=1) # add a graph to the plot
#plot.add([*data.lockin_X],data.lockin_X,subplot=2) # add a graph to the plot
#plot.add([*np.transpose(data.lockin_X)],subplot=3) # add a graph to the plot

#plot.add(bias_voltage, [*data.lockin_X],subplot=1)  # add a graph to the plot

fig = plot.fig
fig.subplots_adjust(left=0.2, bottom=0.2 )

_ = loop.with_bg_task(plot.update).run()  # run the loop
data.bias_voltage_volt_set
[*data.lockin_X]
# todo:
# 2D maps
# force a wait at the beginning of a voltage bias slice
# fetch curves at once as the inner loop (e.g. from VNA)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13416988416988418, 'fraction_numerical': 0.028474903474903474, 'mean_word_length': 3.958133971291866, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '281304', 'license': 'MIT', 'n_tokens_mistral': 1649, 'n_tokens_neox': 1583, 'n_words': 324, 'path': 'docs/tutorial/QCoDeS Tutorial.ipynb', 'repo_name': 'simonzihlmann/Qcodes', 'size': '4144'}