Qualib provides automatic calibrations for experiments on superconducting quantum circuits, based on Exopy.
git clone https://github.com/bastienvoirin/qualib.git
pip install .
(orpip install <path to local Qualib repository>
)
calibration_scheme.py
defines the calibration sequence file to run.
python -m qualib.main calibration_scheme.py
from qualib.main import Qualib
qualib = Qualib()
qualib.run_all('calibration_scheme.py')
assumptions.py
should be a Python dictionary of depth 1 or 2.
calibration_scheme.py
should be a Python list. Each element of this list specifies a calibration to run.
Format:
[
{"name": "a_calibration"},
{"name": "another_calibration",
"substitutions": {"NAME": "variant_in_camel_case",
"A_SUBSTITUTION": "a_value",
"ANOTHER_SUBTITUTION": "another_value"}}
]
name
: the calibration namesubstitutions
: an optional dictionary of substitutions; if present,NAME
must be defined.
See https://qualib.readthedocs.io/en/latest/user_guide.html for further explanations.
- Placeholders format:
$parameter
or$section/parameter
, wheresection
andparameter
are alphanumeric strings (regex:[a-zA-Z0-9_]
) and support substitutions - Examples:
$averaging
,$twpa/freq
,$qubit/PULSE_LENGTH
- See
Calibration(DefaultCalibration).__init__
in{calib_name}_utils.py
Typical Jupyter Notebook template:
# Calibration name ({SUBSTITUTION})
## Result: {POST_PLACEHOLDER} unit
# load experimental data
file = h5py.File('HDF5_PATH', 'r', swmr=True)
xdata = file['data']['x'][()]
ydata = file['data']['y'][()];
# fit experimental data
popt, pcov = opt.curve_fit(function, xdata, ydata, guesses=(0, 1, 2))
f'a, b, c = {popt}'
# plot experimental data and curve fit(s)
fig, ax = plt.subplots()
ax.plot(xdata, ydata, '.-', label='Data')
ax.plot(xdata, function(xdata, *popt), label=f'Fit: a = {popt[0]:f}')
ax.legend();
# optional interfaces: raise an exception when any(np.sqrt(np.diag(_cov)) >= 0.05*_opt)
# where np.sqrt(np.diag(_cov)) gives the standard deviation on the optimized parameters
_opt = popt
_cov = pcov
# optional interface: raises an exception when a specific condition is met
_err = {'Custom error', _opt[0] < 0}
# mandatory interface
_results = {'a': popt[0]}
_results
This Jupyter notebook should be saved as calib_name_template.ipynb
under qualib/calibrations/calib_name
.