-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Saving and loading calibrations data (#1120)
### Summary This PR adds support for full roundtrip of `Calibrations` instance through JSON file format. Even though this PR is blocked by the following PR, this branch is ready to streamline calibration tasks. This is blocked by Qiskit/qiskit#9890 ### Details and comments - Update JSON Encoder and Decoder to support ScheduleBlock and datetime object - Add save utils that provides a standard data model for calibration. Note that this offers portability of calibration data across different versions, platforms, etc.. - Deprecate conventional csv format that only supports calibration table and bit complicated. ### Sample code for testing Checkout my Terra folk https://github.com/nkanazawa1989/qiskit-terra/tree/feature/qpy-schedule-reference ```python from qiskit_experiments.calibration_management import Calibrations from qiskit import pulse from qiskit.circuit import Parameter cals = Calibrations( coupling_map=[[0, 1]], control_channel_map={(0, 1): [pulse.ControlChannel(0)], (1, 0): [pulse.ControlChannel(1)]}, ) with pulse.build(name="my_gate") as sched: pulse.play( pulse.Constant(Parameter("duration"), Parameter("amp")), pulse.ControlChannel(Parameter("ch0.1")), ) cals.add_schedule(sched, qubits=(0, 1)) cals.add_parameter_value(100, "duration", qubits=(0, 1), schedule="my_gate") cals.add_parameter_value(0.123, "amp", qubits=(0, 1), schedule="my_gate") cals.save(file_prefix="data", overwrite=True) roundtrip = Calibrations.load("./data.json") sched = cals.get_schedule("my_gate", (0, 1)) roundtrip_sched = roundtrip.get_schedule("my_gate", (0, 1)) assert sched == roundtrip_sched ``` --------- Co-authored-by: Daniel Egger <[email protected]> Co-authored-by: Daniel J. Egger <[email protected]>
- Loading branch information
1 parent
ba7f9db
commit 5b6fa06
Showing
5 changed files
with
637 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.