Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QM driver fixes #1046

Merged
merged 3 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/qibolab/_core/instruments/qm/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from qibolab._core.unrolling import Bounds, unroll_sequences

from .components import OpxOutputConfig, QmAcquisitionConfig
from .config import SAMPLING_RATE, Configuration, operation
from .config import SAMPLING_RATE, Configuration
from .program import ExecutionArguments, create_acquisition, program
from .program.sweepers import find_lo_frequencies, sweeper_amplitude

Expand Down Expand Up @@ -338,12 +338,12 @@ def register_duration_sweeper_pulses(
if isinstance(pulse, (Align, Delay)):
continue

params = args.parameters[operation(pulse)]
params = args.parameters[pulse.id]
ids = args.sequence.pulse_channels(pulse.id)
original_pulse = (
pulse if params.amplitude_pulse is None else params.amplitude_pulse
)
for value in sweeper.values:
for value in sweeper.values.astype(int):
sweep_pulse = original_pulse.model_copy(update={"duration": value})
sweep_op = self.register_pulse(ids[0], sweep_pulse)
params.duration_ops.append((value, sweep_op))
Expand All @@ -360,7 +360,7 @@ def register_amplitude_sweeper_pulses(
for pulse in sweeper.pulses:
sweep_pulse = pulse.model_copy(update={"amplitude": amplitude})
ids = args.sequence.pulse_channels(pulse.id)
params = args.parameters[operation(pulse)]
params = args.parameters[pulse.id]
params.amplitude_pulse = sweep_pulse
params.amplitude_op = self.register_pulse(ids[0], sweep_pulse)

Expand Down Expand Up @@ -418,6 +418,9 @@ def preprocess_sweeps(
find_lo_frequencies(args, channels, configs, sweeper.values)
for id in sweeper.channels:
args.parameters[id].element = probe_map.get(id, id)
for sweeper in find_sweepers(sweepers, Parameter.offset):
for id in sweeper.channels:
args.parameters[id].element = id
for sweeper in find_sweepers(sweepers, Parameter.amplitude):
self.register_amplitude_sweeper_pulses(args, sweeper)
for sweeper in find_sweepers(sweepers, Parameter.duration):
Expand Down
13 changes: 9 additions & 4 deletions src/qibolab/_core/instruments/qm/program/instructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def play(args: ExecutionArguments):
for channel_id, pulse in args.sequence:
element = str(channel_id)
op = operation(pulse)
params = args.parameters[op]
params = args.parameters[pulse.id]
if isinstance(pulse, Delay):
_delay(pulse, element, params)
elif isinstance(pulse, Pulse):
Expand All @@ -111,8 +111,13 @@ def _process_sweeper(sweeper: Sweeper, args: ExecutionArguments):
if parameter not in SWEEPER_METHODS:
raise NotImplementedError(f"Sweeper for {parameter} is not implemented.")

variable = declare(int) if parameter in INT_TYPE else declare(fixed)
values = sweeper.values
if parameter in INT_TYPE:
variable = declare(int)
values = sweeper.values.astype(int)
else:
variable = declare(fixed)
values = sweeper.values

if parameter is Parameter.frequency:
lo_frequency = args.parameters[sweeper.channels[0]].lo_frequency
values = NORMALIZERS[parameter](values, lo_frequency)
Expand Down Expand Up @@ -148,7 +153,7 @@ def sweep(
method = SWEEPER_METHODS[sweeper.parameter]
if sweeper.pulses is not None:
for pulse in sweeper.pulses:
params = args.parameters[operation(pulse)]
params = args.parameters[pulse.id]
method(variable, params)
else:
for channel in sweeper.channels:
Expand Down