pygsti.extras.paritybenchmarking.disturbancecalc.compute_disturbances

pygsti.extras.paritybenchmarking.disturbancecalc.compute_disturbances#

compute_disturbances(n_bits, data_ref, data_test, num_bootstrap_samples=20, max_weight=4, solver='CLARABEL', verbosity=1, add_one_to_data=True)#

Compute the weight-X disturbances 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 1-sigma error bar for each value using the boostrap method.

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.

  • num_bootstrap_samples (int) – The number of boostrap (re-)samples to use. If 0, then error bars are not computed.

  • max_weight (int, optional) – The maximum weight disturbance to compute. Typically this is the same as n_bits.

  • solver (str, optional) – The name of the solver to used (see cvxpy.installed_solvers())

  • verbosity (int, optional) – Sets the level of detail for messages printed to the console (higher = more detail).

  • add_one_to_data (bool, optional) – Sets whether the bootstrap should be calculated after adding a single fake count to every possible outcome.

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