Skip to content

Commit

Permalink
Merge pull request #79 from qutech/bugfix/buffer_num_points
Browse files Browse the repository at this point in the history
Fixed issues with float64 number of points
  • Loading branch information
THuckemann authored Feb 14, 2024
2 parents 224ba24 + dda0a77 commit c73ea49
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
29 changes: 18 additions & 11 deletions src/examples/buffered_dummy_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
# trigger event for triggering.
import threading

import numpy as np
import yaml
from qcodes.dataset import (
Measurement,
Expand All @@ -41,8 +42,11 @@
from qumada.instrument.buffered_instruments import BufferedDummyDMM as DummyDmm
from qumada.instrument.buffers.buffer import map_buffers
from qumada.instrument.custom_drivers.Dummies.dummy_dac import DummyDac
from qumada.instrument.mapping import DUMMY_DMM_MAPPING, add_mapping_to_instrument
from qumada.instrument.mapping.base import map_gates_to_instruments
from qumada.instrument.mapping import (
DUMMY_DMM_MAPPING,
add_mapping_to_instrument,
map_terminals_gui,
)
from qumada.instrument.mapping.Dummies.DummyDac import DummyDacMapping
from qumada.measurement.scripts import (
Generic_1D_parallel_asymm_Sweep,
Expand All @@ -54,9 +58,10 @@
)
from qumada.utils.generate_sweeps import generate_sweep, replace_parameter_settings
from qumada.utils.GUI import open_web_gui
from qumada.utils.load_from_sqlite_db import load_db, pick_measurement
from qumada.utils.load_from_sqlite_db import load_db
from qumada.utils.ramp_parameter import *

# %%
trigger = threading.Event()

# Setup qcodes station
Expand All @@ -66,13 +71,16 @@
# the trigger inputs of real instruments.

dmm = DummyDmm("dmm", trigger_event=trigger)
add_mapping_to_instrument(dmm, path=DUMMY_DMM_MAPPING)
add_mapping_to_instrument(dmm, mapping=DUMMY_DMM_MAPPING)
station.add_component(dmm)

dac = DummyDac("dac", trigger_event=trigger)
add_mapping_to_instrument(dac, mapping=DummyDacMapping())
station.add_component(dac)

dac2 = DummyDac("dac2", trigger_event=trigger)
add_mapping_to_instrument(dac2, mapping=DummyDacMapping())
station.add_component(dac2)
# %% Load database for data storage
load_db()
# %% Setup measurement
Expand All @@ -87,13 +95,12 @@

# %% Measurement Setup
parameters = {
"dmm": {"voltage": {"type": "gettable"}},
"dac": {
"voltage": {
"type": "dynamic",
"setpoints": [0, 5],
}
"dmm": {
"voltage": {"type": "gettable"},
"current": {"type": "gettable"},
},
"dac": {"voltage": {"type": "dynamic", "setpoints": np.linspace(0, np.pi, 100), "value": 0}},
"dac2": {"voltage": {"type": "dynamic", "setpoints": np.linspace(0, np.pi, 100), "value": 0}},
}
# %%
script = Generic_1D_Sweep_buffered()
Expand All @@ -106,7 +113,7 @@
trigger_reset=trigger.clear,
)

map_gates_to_instruments(station.components, script.gate_parameters)
map_terminals_gui(station.components, script.gate_parameters)
map_buffers(station.components, script.properties, script.gate_parameters)

# %% Run measurement
Expand Down
14 changes: 7 additions & 7 deletions src/qumada/measurement/scripts/generic_measurement.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def run(self):
],
)
parameter_value = self.properties[parameter["gate"]][parameter["parameter"]]["value"]
static_gettables.append((channel, [parameter_value for _ in range(self.buffered_num_points)]))
static_gettables.append((channel, [parameter_value for _ in range(int(self.buffered_num_points))]))
for channel in del_channels:
self.gettable_channels.remove(channel)
for param in del_params:
Expand Down Expand Up @@ -455,7 +455,7 @@ def run(self):
elif channel in self.static_gettable_channels:
meas.register_parameter(channel, setpoints=[timer, dyn_channel])
parameter_value = self.properties[parameter["gate"]][parameter["parameter"]]["value"]
static_gettables.append((channel, [parameter_value for _ in range(self.buffered_num_points)]))
static_gettables.append((channel, [parameter_value for _ in range(int(self.buffered_num_points))]))
start = time()
with meas.run() as datasaver:
try:
Expand Down Expand Up @@ -589,7 +589,7 @@ def run(self):
elif channel in self.static_gettable_channels:
parameter_value = self.properties[parameter["gate"]][parameter["parameter"]]["value"]
parameter_value = channel.get()
static_gettables.append((channel, [parameter_value for _ in range(self.buffered_num_points)]))
static_gettables.append((channel, [parameter_value for _ in range(int(self.buffered_num_points))]))
for parameter, channel in zip(self.dynamic_parameters, self.dynamic_channels):
if channel != dynamic_param:
try:
Expand All @@ -600,7 +600,7 @@ def run(self):
and cannot be logged!"
)
break
static_gettables.append((channel, [parameter_value for _ in range(self.buffered_num_points)]))
static_gettables.append((channel, [parameter_value for _ in range(int(self.buffered_num_points))]))
for param in static_gettables:
meas.register_parameter(
param[0],
Expand Down Expand Up @@ -740,7 +740,7 @@ def run(self):
del_channels.append(channel)
del_params.append(parameter)
parameter_value = self.properties[parameter["gate"]][parameter["parameter"]]["value"]
static_gettables.append((channel, [parameter_value for _ in range(self.buffered_num_points)]))
static_gettables.append((channel, [parameter_value for _ in range(int(self.buffered_num_points))]))
for parameter, channel in zip(self.dynamic_parameters, self.dynamic_channels):
if channel != dynamic_param:
try:
Expand All @@ -751,7 +751,7 @@ def run(self):
and cannot be logged!"
)
break
static_gettables.append((channel, [parameter_value for _ in range(self.buffered_num_points)]))
static_gettables.append((channel, [parameter_value for _ in range(int(self.buffered_num_points))]))
for param in static_gettables:
meas.register_parameter(
param[0],
Expand Down Expand Up @@ -931,7 +931,7 @@ def run(self):
],
)
parameter_value = self.properties[parameter["gate"]][parameter["parameter"]]["value"]
static_gettables.append((channel, [parameter_value for _ in range(self.buffered_num_points)]))
static_gettables.append((channel, [parameter_value for _ in range(int(self.buffered_num_points))]))
for channel in del_channels:
self.gettable_channels.remove(channel)
for param in del_params:
Expand Down

0 comments on commit c73ea49

Please sign in to comment.