From 7c214ef62488cfc9e2b4cc13f8fbe6748309f710 Mon Sep 17 00:00:00 2001 From: Stavros Efthymiou <35475381+stavros11@users.noreply.github.com> Date: Mon, 16 Sep 2024 00:49:44 +0400 Subject: [PATCH 1/3] fix: offset sweeper for QM --- src/qibolab/_core/instruments/qm/controller.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qibolab/_core/instruments/qm/controller.py b/src/qibolab/_core/instruments/qm/controller.py index 32673058a..09a680bdf 100644 --- a/src/qibolab/_core/instruments/qm/controller.py +++ b/src/qibolab/_core/instruments/qm/controller.py @@ -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): From 74f1152bf30baed1daefb05e8529aafa8f1d4e80 Mon Sep 17 00:00:00 2001 From: Stavros Efthymiou <35475381+stavros11@users.noreply.github.com> Date: Tue, 17 Sep 2024 11:56:16 +0400 Subject: [PATCH 2/3] fix: convert duration sweep to int --- src/qibolab/_core/instruments/qm/controller.py | 2 +- src/qibolab/_core/instruments/qm/program/instructions.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/qibolab/_core/instruments/qm/controller.py b/src/qibolab/_core/instruments/qm/controller.py index 09a680bdf..34a8f5f53 100644 --- a/src/qibolab/_core/instruments/qm/controller.py +++ b/src/qibolab/_core/instruments/qm/controller.py @@ -343,7 +343,7 @@ def register_duration_sweeper_pulses( 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)) diff --git a/src/qibolab/_core/instruments/qm/program/instructions.py b/src/qibolab/_core/instruments/qm/program/instructions.py index b19333b0f..e66642eb6 100644 --- a/src/qibolab/_core/instruments/qm/program/instructions.py +++ b/src/qibolab/_core/instruments/qm/program/instructions.py @@ -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) From 7ff8cedd7370cbee2bceeb9be46a6930b167a61a Mon Sep 17 00:00:00 2001 From: Stavros Efthymiou <35475381+stavros11@users.noreply.github.com> Date: Tue, 17 Sep 2024 12:18:08 +0400 Subject: [PATCH 3/3] fix: use pulse.id instead of hash in pulse parameters to avoid unwanted duplications --- src/qibolab/_core/instruments/qm/controller.py | 6 +++--- src/qibolab/_core/instruments/qm/program/instructions.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/qibolab/_core/instruments/qm/controller.py b/src/qibolab/_core/instruments/qm/controller.py index 34a8f5f53..f8efb7a21 100644 --- a/src/qibolab/_core/instruments/qm/controller.py +++ b/src/qibolab/_core/instruments/qm/controller.py @@ -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 @@ -338,7 +338,7 @@ 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 @@ -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) diff --git a/src/qibolab/_core/instruments/qm/program/instructions.py b/src/qibolab/_core/instruments/qm/program/instructions.py index e66642eb6..f1dc1de50 100644 --- a/src/qibolab/_core/instruments/qm/program/instructions.py +++ b/src/qibolab/_core/instruments/qm/program/instructions.py @@ -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): @@ -153,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: