From 2e5eca6129ecf9717345fe66d1db6456d81addf2 Mon Sep 17 00:00:00 2001 From: Jacfomg Date: Fri, 19 Jan 2024 21:45:24 +0400 Subject: [PATCH] fix: path with platform name for Kernels --- src/qibolab/qubits.py | 2 +- src/qibolab/serialize.py | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/qibolab/qubits.py b/src/qibolab/qubits.py index 952389936..0e3f9721f 100644 --- a/src/qibolab/qubits.py +++ b/src/qibolab/qubits.py @@ -15,7 +15,7 @@ Not all channels are required to operate a qubit. """ -EXCLUDED_FIELDS = CHANNEL_NAMES + ("name", "native_gates", "_flux") +EXCLUDED_FIELDS = CHANNEL_NAMES + ("name", "native_gates", "kernels", "_flux") """Qubit dataclass fields that are excluded by the ``characterization`` property.""" diff --git a/src/qibolab/serialize.py b/src/qibolab/serialize.py index 65cdc70a6..967b63979 100644 --- a/src/qibolab/serialize.py +++ b/src/qibolab/serialize.py @@ -138,11 +138,9 @@ def dump_qubits( } kernels = Kernels() - for q in qubits: - qubit = characterization["single_qubit"][q] - if qubit["kernel"] is not None: - kernel = qubit.pop("kernel") - kernels[q] = kernel + for qubit in qubits.values(): + if qubit.kernel is not None: + kernels[qubit.name] = qubit.kernel if couplers: characterization["coupler"] = { @@ -185,7 +183,10 @@ def dump_runcard(platform: Platform, path: Path): if qubit.kernel is not None: kernels[qubit.name] = qubit.kernel qubit.kernel = None - Kernels(kernels).dump(Path(__file__).parent / "dummy" / KERNELS_FILE) + name = platform.name + if platform.name == "dummy_couplers": + name = "dummy" + Kernels(kernels).dump(Path(__file__).parent / name / KERNELS_FILE) settings = { "nqubits": platform.nqubits,