pygsti.extras.paritybenchmarking.disturbancecalc.compute_disturbances_with_confidence#
- compute_disturbances_with_confidence(n_bits, data_ref, data_test, confidence_percent=68.0, max_weight=4, maxiters=20, search_tol=0.1, reltol=1e-05, abstol=1e-05, solver='CLARABEL', initial_treg_factor=0.001, verbosity=1)#
Compute the weight-X distrubances between two data sets (including error bars).
This function is computes the weight-X disturbance, defined as the difference between the weight-(X-1) and weight-X residual TVDs, (evaluated at the ML probability distributions implied by the data) for all weights up to max_weight. It also uses the data to compute `confidence_percent`% confidence intervals for each residualTVD and adds these in quadrature to arrive at error bars on each weight-X disturbance.
- Parameters:
n_bits (int) – The number of bits (qubits).
data_ref (numpy array) – Arrays of outcome counts from the reference and test experiments, respectively. Each array has one element per 2^n_bits bit string.
data_test (numpy array) – Arrays of outcome counts from the reference and test experiments, respectively. Each array has one element per 2^n_bits bit string.
confidence_percent (float or None, optional) – The confidence level desired for the computed error bars. Note that this number can range between 0 and 100, not 0 and 1. If None, then no error bars are computed.
max_weight (int, optional) – The maximum weight disturbance to compute. Typically this is the same as n_bits.
maxiters (int, optional) – The maximum number of alternating-minimization iterations to allow within the profile-loglikelihood computation before giving up and deeming the final result “ok”.
search_tol (float, optional) – The tolerance on the log-likelihood used when trying to locate the (residualTVD, logL) pair with logL at the edge of the confidence interval.
reltol (float, optional) – The relative tolerance used to within profile likelihood.
abstol (float, optional) – The absolute tolerance used to within profile likelihood.
solver (str, optional) – The name of the solver to used (see cvxpy.installed_solvers())
initial_treg_factor (float, optional) – The magnitude of an internal penalty factor on the off-diagonals of the T matrix (see
ResidualTVD).verbosity (int, optional) – Sets the level of detail for messages printed to the console (higher = more detail).
- Returns:
A list of the disturbances by weight. The lists i-th element is a (disturbance, errorbar_length) tuple for the weight (i+1) disturbance. That is, the weight (i+1) disturbance = disturbance +/- errorbar_length.
- Return type:
list