pygsti.algorithms.rbfit.std_least_squares_fit

pygsti.algorithms.rbfit.std_least_squares_fit#

std_least_squares_fit(lengths, asps, n, seed=None, asymptote=None, ftype='full', rtype='EI')#

Implements a “standard” least-squares fit of RB data.

Fits the average success probabilities to the exponential decay A + Bp^m, using least-squares fitting.

Parameters:
  • lengths (list) – The RB lengths to fit to (the ‘m’ values in A + Bp^m).

  • asps (list) – The average survival probabilities to fit (the observed P_m values to fit to P_m = A + Bp^m).

  • n (int) – The number of qubits the data was generated from.

  • seed (list, optional) – Seeds for the fit of B and p (A, if a variable, is seeded to the asymptote defined by asympote).

  • asymptote (float, optional) – If not None, the A value for the fitting to A + Bp^m with A fixed. Defaults to 1/2^n. Note that this value is used even when fitting A; in that case B and p are estimated with A fixed to this value, and then this A and the estimated B and p are seed for the full fit.

  • ftype ({'full','FA','full+FA'}, optional) – The fit type to implement. ‘full’ corresponds to fitting all of A, B and p. ‘FA’ corresponds to fixing ‘A’ to the value specified by asymptote. ‘full+FA’ returns the results of both fits.

  • rtype ({'EI','AGI'}, optional) – The RB error rate rescaling convention. ‘EI’ results in RB error rates that are associated with the entanglement infidelity, which is the error probability with stochastic errors (and is equal to the diamond distance). ‘AGI’ results in RB error rates that are associated with average gate infidelity.

Returns:

If ftype = ‘full’ or ftype = ‘FA’ then a dict containing the results of the relevant fit. If ftype = ‘full+FA’ then two dicts are returned. The first dict corresponds to the full fit and the second to the fixed-asymptote fit.

Return type:

Dict or Dicts