From d459a7e3327eba3bc05a2eca52632bffbac6dd7f Mon Sep 17 00:00:00 2001 From: Alessandro Candido Date: Mon, 2 Dec 2024 12:50:55 +0100 Subject: [PATCH] fix: Make calibration converter compatible with qblox --- convert.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/convert.py b/convert.py index 3b947f03..19354966 100644 --- a/convert.py +++ b/convert.py @@ -123,7 +123,9 @@ def channel(qubit: str, type_: str, gate: Optional[str] = None) -> str: else ( "acquisition" if type_ == "ro" - else "drive12" if gate == "RX12" else "drive" + else "drive12" + if gate == "RX12" + else "drive" ) ) ) @@ -182,7 +184,9 @@ def pulse_like(o: dict, rescale: float) -> dict: return ( acquisition(o, rescale) if o["type"] == "ro" - else virtualz(o) if o["type"] == "virtual_z" else pulse(o, rescale) + else virtualz(o) + if o["type"] == "virtual_z" + else pulse(o, rescale) ) @@ -260,7 +264,7 @@ def single_qubits_cal(o: dict) -> dict: "t1": [k["T1"], None], "t2": [k["T2"], None], "t2_spin_echo": [k["T2_spin_echo"], None], - "rb_fidelity": [k["gate_fidelity"], None], + "rb_fidelity": [k["gate_fidelity"], None] if "gate_fidelity" in k else None, } for q, k in o.items() } @@ -279,7 +283,9 @@ def two_qubits_cal(o: dict) -> dict: def upgrade_cal(o: dict) -> dict: return { "single_qubits": single_qubits_cal(o["characterization"]["single_qubit"]), - "two_qubits": two_qubits_cal(o["characterization"]["two_qubit"]), + "two_qubits": two_qubits_cal(o["characterization"]["two_qubit"]) + if "two_qubit" in o["characterization"] + else {}, }