• 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.99291992, 0.02148438],
        [0.00708008, 0.97851562]]),
 None,
 array([[0.98376465, 0.01721191],
        [0.01623535, 0.98278809]]),
 None,
 array([[0.99291992, 0.02587891],
        [0.00708008, 0.97412109]]),
 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.99267578, 0.02502441],
        [0.00732422, 0.97497559]]),
 None,
 array([[0.98632812, 0.01708984],
        [0.01367188, 0.98291016]]),
 None,
 array([[0.99047852, 0.02978516],
        [0.00952148, 0.97021484]]),
 None]