Measure without a Loop¶
If you have a parameter that returns a whole array at once, often you want to measure it directly into a DataSet.
This shows how that works in QCoDeS
[2]:
%matplotlib nbagg
import numpy as np
# import dummy driver for the tutorial
from qcodes.instrument_drivers.mock_instruments import (
DummyChannelInstrument,
DummyInstrument,
)
from qcodes.station import Station
from qcodes_loop.actions import Task
from qcodes_loop.measure import Measure
dac1 = DummyInstrument(name="dac")
dac2 = DummyChannelInstrument(name="dac2")
# the default dummy instrument returns always a constant value, in the following line we make it random
# just for the looks 💅
dac2.A.dummy_array_parameter.get = lambda: np.random.randint(0, 100, size=5)
# The station is a container for all instruments that makes it easy
# to log meta-data
station = Station(dac1, dac2)
2020-03-24 18:45:32,769 ¦ qcodes.instrument.base ¦ WARNING ¦ base ¦ snapshot_base ¦ 214 ¦ [dac2_ChanA(DummyChannel)] Snapshot: Could not update parameter: dummy_sp_axis
2020-03-24 18:45:32,798 ¦ qcodes.instrument.base ¦ WARNING ¦ base ¦ snapshot_base ¦ 214 ¦ [dac2_ChanB(DummyChannel)] Snapshot: Could not update parameter: dummy_sp_axis
2020-03-24 18:45:32,804 ¦ qcodes.instrument.base ¦ WARNING ¦ base ¦ snapshot_base ¦ 214 ¦ [dac2_ChanC(DummyChannel)] Snapshot: Could not update parameter: dummy_sp_axis
2020-03-24 18:45:32,807 ¦ qcodes.instrument.base ¦ WARNING ¦ base ¦ snapshot_base ¦ 214 ¦ [dac2_ChanD(DummyChannel)] Snapshot: Could not update parameter: dummy_sp_axis
2020-03-24 18:45:32,819 ¦ qcodes.instrument.base ¦ WARNING ¦ base ¦ snapshot_base ¦ 214 ¦ [dac2_ChanE(DummyChannel)] Snapshot: Could not update parameter: dummy_sp_axis
2020-03-24 18:45:32,838 ¦ qcodes.instrument.base ¦ WARNING ¦ base ¦ snapshot_base ¦ 214 ¦ [dac2_ChanF(DummyChannel)] Snapshot: Could not update parameter: dummy_sp_axis
Instantiates all the instruments needed for the demo¶
For this tutorial we’re going to use the regular parameters (c0, c1, c2, vsd) and ArrayGetter, which is just a way to construct a parameter that returns a whole array at once out of simple parameters, as well as AverageAndRaw, which returns a scalar and an array together.
Only array output¶
The arguments to Measure are all the same actions you use in a Loop. If they return only arrays, you will see exactly those arrays (with their setpoints) in the output DataSet
[4]:
data = Measure(
Task(dac1.dac1.set, 0),
dac2.A.dummy_array_parameter,
Task(dac1.dac1.set, 2),
dac2.A.dummy_array_parameter,
).run()
DataSet:
location = 'data/2020-03-24/#013_{name}_18-45-41'
<Type> | <array_id> | <array.name> | <array.shape>
Measured | dac2_ChanA_dummy_array_parameter_1 | dummy_array_parameter | (5,)
Measured | dac2_ChanA_dummy_array_parameter_3 | dummy_array_parameter | (5,)
acquired at 2020-03-24 18:45:41
[ ]: