Skip to content

Commit

Permalink
chore: compatibility with OPX1000
Browse files Browse the repository at this point in the history
  • Loading branch information
stavros11 committed Oct 18, 2024
1 parent ec47b52 commit 6c2ff78
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
19 changes: 16 additions & 3 deletions src/qibocal/protocols/qua/rb_two_qubit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand All @@ -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,
)

Expand Down
11 changes: 9 additions & 2 deletions src/qibocal/protocols/qua/two_qubit_rb/TwoQubitRB.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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):
Expand Down Expand Up @@ -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,
):
Expand All @@ -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:
Expand Down

0 comments on commit 6c2ff78

Please sign in to comment.