Fitting an AllXY experiment
The AllXY experiment was introduced by M. Reed in “Entanglement and Quantum Error Correction with Superconducting Qubits”. It allows for a quick analysis of the power, frequency detuning of qubit gates.
[1]:
import numpy as np
import qtt
from qtt.algorithms.allxy import fit_allxy, plot_allxy, allxy_model
We define example data for an AllXY experiment and fit the data to the allxy_model
.
[2]:
dataset = qtt.data.makeDataSet1Dplain('index', np.arange(21), 'allxy', [0.12 , 0.16533333, 0.136 , 0.17066666, 0.20266667,
0.452 , 0.48133334, 0.58666666, 0.43199999, 0.52933334,
0.44533333, 0.51066667, 0.46 , 0.48133334, 0.47066667,
0.47333333, 0.488 , 0.80799999, 0.78933333, 0.788 ,
0.79333333])
result = fit_allxy(dataset)
plot_allxy(dataset, result, fig=1)
[3]:
print(result)
{'fitted_parameters': array([ 0.15893333, 0.01706667, 0.48422222, -0.00134266, 0.7924 ,
-0.00453333]), 'initial_parameters': array([0.15893333, 0. , 0.48422222, 0. , 0.79466666,
0. ]), 'reduced_chi_squared': 0.001369275257254969, 'type': 'Model(allxy_model)', 'fitted_parameter_dictionary': {'offset0': 0.158933332, 'slope0': 0.017066667, 'offset1': 0.4842222225, 'slope1': -0.0013426571678321682, 'offset2': 0.792399997, 'slope2': -0.004533331000000019}, 'fitted_parameters_covariance': array([2.73855051e-04, 1.36927526e-04, 1.14106271e-04, 9.57535145e-06,
4.10782577e-04, 2.73855051e-04]), 'description': 'allxy fit'}
The fitted_parameters
are the parameters of the allxy_model
function.
[4]:
help(allxy_model)
Help on function allxy_model in module qtt.algorithms.allxy:
allxy_model(indices:Union[float, numpy.ndarray], offset0:float, slope0:float, offset1:float, slope1:float, offset2:float, slope2:float) -> Union[float, numpy.ndarray]
Model for AllXY experiment
The model consists of three linear segments. The segments correspond to the pairs of gates that result in
fraction 0, 0.5 and 1 in the AllXY experiment.
Args:
index: Indices of the allxy pairs or a single index
offset0: Offset of first segment
slope0: Slope of first segment
offset1: Offset of second segment
slope1: Slope of second segment
offset2: Offset of last segment
slope2: Slope of last segment
Returns:
Fractions for the allxy pairs
[ ]: