• Docs >
  • Saving and loading calibration data
Shortcuts

Saving and loading calibration dataΒΆ

It is possible to save calibration data and, optionally, re-load it at a later time. Let us generate some calibration data and save it.

from qiskit.test.mock.backends import FakeCasablanca
import mthree

backend = FakeCasablanca()

mit = mthree.M3Mitigation(backend)
mit.cals_from_system([1, 3, 5], cals_file='my_cals.json')
mit.single_qubit_cals
[None,
 array([[0.9913737 , 0.02205404],
        [0.0086263 , 0.97794596]]),
 None,
 array([[0.98661296, 0.01839193],
        [0.01338704, 0.98160807]]),
 None,
 array([[0.99283854, 0.02746582],
        [0.00716146, 0.97253418]]),
 None]

or,

mit = mthree.M3Mitigation(backend)
mit.cals_from_system([1, 3, 5])
mit.cals_to_file('my_cals.json')

We can then load this data at a later point in time using:

import mthree

mit2 = mthree.M3Mitigation()
mit2.cals_from_file('my_cals.json')
mit2.single_qubit_cals
[None,
 array([[0.99344889, 0.02351888],
        [0.00655111, 0.97648112]]),
 None,
 array([[0.98543294, 0.01761882],
        [0.01456706, 0.98238118]]),
 None,
 array([[0.99243164, 0.02860514],
        [0.00756836, 0.97139486]]),
 None]