From 6c2ff78da4f74301d7d0dcee5c6ccd99d0e122f4 Mon Sep 17 00:00:00 2001 From: Stavros Efthymiou <35475381+stavros11@users.noreply.github.com> Date: Fri, 18 Oct 2024 15:12:39 +0400 Subject: [PATCH] chore: compatibility with OPX1000 --- src/qibocal/protocols/qua/rb_two_qubit.py | 19 ++++++++++++++++--- .../protocols/qua/two_qubit_rb/TwoQubitRB.py | 11 +++++++++-- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/qibocal/protocols/qua/rb_two_qubit.py b/src/qibocal/protocols/qua/rb_two_qubit.py index 9ea2a5616..d56c1837b 100644 --- a/src/qibocal/protocols/qua/rb_two_qubit.py +++ b/src/qibocal/protocols/qua/rb_two_qubit.py @@ -34,6 +34,11 @@ def _acquisition( ) -> QuaTwoQubitRbData: assert len(targets) == 1 qubit1, qubit2 = targets[0] + try: + qubit1 = int(qubit1) + qubit2 = int(qubit2) + except ValueError: + pass cz_sequence, phases = platform.pairs[(qubit1, qubit2)].native_gates.CZ.sequence() if cz_sequence[0].qubit != qubit1: @@ -125,10 +130,13 @@ def bake_cz(baker: Baking, q1, q2): # create RB experiment from configuration and defined functions config = generate_config(platform, platform.qubits.keys(), targets=[qubit1, qubit2]) + # for debugging when there is an error + # from qm import generate_qua_script + # from qm.qua import program # with open("rb2q_qua_config.py", "w") as file: - # with program() as prog: - # align() - # file.write(generate_qua_script(prog, config)) + # with program() as prog: + # align() + # file.write(generate_qua_script(prog, config)) rb = TwoQubitRb( config=config, @@ -148,6 +156,11 @@ def bake_cz(baker: Baking, q1, q2): circuit_depths=params.circuit_depths, num_circuits_per_depth=params.num_circuits_per_depth, num_shots_per_circuit=params.num_shots_per_circuit, + offsets=[ + (qb.flux.name, qb.sweetspot) + for qb in platform.qubits.values() + if qb.flux is not None + ], debug=params.debug, ) diff --git a/src/qibocal/protocols/qua/two_qubit_rb/TwoQubitRB.py b/src/qibocal/protocols/qua/two_qubit_rb/TwoQubitRB.py index c0dbc91cf..d074025b6 100644 --- a/src/qibocal/protocols/qua/two_qubit_rb/TwoQubitRB.py +++ b/src/qibocal/protocols/qua/two_qubit_rb/TwoQubitRB.py @@ -176,6 +176,7 @@ def _gen_qua_program( sequence_depths: list[int], num_repeats: int, num_averages: int, + offsets: list[tuple[str, float]], ): with program() as prog: sequence_depth = declare(int) @@ -192,6 +193,10 @@ def _gen_qua_program( for qe in self._rb_baker.all_elements } + # force offset setting due to bug in QOP320 + for qb, offset in offsets: + set_dc_offset(qb, "single", offset) + assign(progress, 0) with for_each_(sequence_depth, sequence_depths): with for_(repeat, 0, repeat < num_repeats, repeat + 1): @@ -249,6 +254,7 @@ def run( circuit_depths: List[int], num_circuits_per_depth: int, num_shots_per_circuit: int, + offsets: Optional[list[tuple[str, float]]] = None, debug: Optional[str] = None, **kwargs, ): @@ -264,9 +270,10 @@ def run( num_shots_per_circuit (int): The number of shots per particular circuit. debug (str): If not ``None`` it dumps the QUA script and config in a file with the given name. """ - + if offsets is None: + offsets = [] prog = self._gen_qua_program( - circuit_depths, num_circuits_per_depth, num_shots_per_circuit + circuit_depths, num_circuits_per_depth, num_shots_per_circuit, offsets ) if debug is not None: