fit_rabi_results¶
-
forest.benchmarking.qubit_spectroscopy.
fit_rabi_results
(angles: Sequence[float], z_expectations: Sequence[float], z_std_errs: Sequence[float] = None, param_guesses: tuple = (-0.5, 0, 0.5, 1.0)) → lmfit.model.ModelResult¶ Wrapper for fitting the results of a rabi experiment on a qubit; simply extracts key parameters and passes on to the standard fit.
Note the following interpretation of the model fit parameters
- x
- the independent variable is the angle that we specify when writing a gate instruction. If our gates are incorrectly calibrated then a given control angle will result in a different angle than intended by the multiplicative ‘frequency’ of the model
- amplitude
- this will have magnitude (p1_given_1 - p1_given_0) / 2 where p1_given_1 is the probability of measuring 1 when the qubit is in the |1> state. p1_given_0 is the probability of measuring 1 when the qubit is in the |0> state.
- offset
- this is the offset phase, in radians, with respect to the true rotation frequency. e.g. if our gate is mis-calibrated resulting in an offset ‘off’ then we require a control angle of RX(-off / frequency) to correct the offset
- baseline
- this is the amplitude + p1_given_0
- frequency
- the ratio of the actual angle rotated over the intended control angle e.g. If our gates are incorrectly calibrated to apply an over-rotation then frequency will be greater than 1; the intended control angle will be smaller than the true angle rotated.
Parameters: - angles – the angles at which the z_expectations were measured.
- z_expectations – expectation of Z at each angle for a qubit initialized to 0
- z_std_errs – std_err of the Z expectation, optionally used to weight the fit.
- param_guesses – guesses for the (amplitude, offset, baseline, frequency) parameters
Returns: a ModelResult fit with estimates of the Model parameters, including the frequency which gives the ratio of actual angle over intended control angle