Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 15, 2024
1 parent dd8e963 commit 554c8d9
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions convert.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
"""Converts parameters.json to parameters.json and calibration.json
"""

import argparse
import ast
import json
from pathlib import Path
from typing import Optional

from pydantic import TypeAdapter
from qibolab._core.serialize import NdArray

Expand Down Expand Up @@ -181,17 +183,19 @@ def upgrade(o: dict) -> dict:
"native_gates": natives(o["native_gates"]),
}


def single_qubits_cal(o: dict) -> dict:
return { q: {
return {
q: {
"resonator": {
"bare_frequency": k["bare_resonator_frequency"],
"dressed_frequency": k["readout_frequency"],
},
},
"qubit": {
"frequency_01": k["drive_frequency"],
"sweetspot": k["sweetspot"],
},
"readout":{
"readout": {
"fidelity": k["readout_fidelity"],
"ground_state": k["mean_gnd_states"],
"excited_state": k["mean_exc_states"],
Expand All @@ -200,23 +204,28 @@ def single_qubits_cal(o: dict) -> dict:
"t2": [k["T2"], None],
"t2_spin_echo": [k["T2_spin_echo"], None],
"rb_fidelity": [k["gate_fidelity"], None],
} for q, k in o.items()}
}
for q, k in o.items()
}


def two_qubits_cal(o:dict) -> dict:
return {qq :{
"rb_fidelity": [k["gate_fidelity"], None],
"cz_fidelity": [k["cz_fidelity"], None],
} for qq, k in o.items()}
def two_qubits_cal(o: dict) -> dict:
return {
qq: {
"rb_fidelity": [k["gate_fidelity"], None],
"cz_fidelity": [k["cz_fidelity"], None],
}
for qq, k in o.items()
}


def upgrade_cal(o: dict) -> dict:
return {
"single_qubits": single_qubits_cal(o["characterization"]["single_qubit"]
),
"single_qubits": single_qubits_cal(o["characterization"]["single_qubit"]),
"two_qubits": two_qubits_cal(o["characterization"]["two_qubit"]),
}


def convert(path: Path):
params = json.loads(path.read_text())
new = upgrade(params)
Expand Down

0 comments on commit 554c8d9

Please sign in to comment.