pygsti.extras.paritybenchmarking.disturbancecalc.compute_disturbances_bootstrap_rawdata

pygsti.extras.paritybenchmarking.disturbancecalc.compute_disturbances_bootstrap_rawdata#

compute_disturbances_bootstrap_rawdata(n_bits, data_ref, data_test, num_bootstrap_samples=20, max_weight=4, solver='CLARABEL', verbosity=1, seed=0, return_resampled_data=False, add_one_to_data=True)#

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 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.

  • 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:

  • disturbance_by_weight_ML (numpy.ndarray) – The ML disturbances by weight (length max_weight)

  • bootstrap_disturbances_by_weight (numpy.ndarray) – A (max_weight, num_bootstrap_samples) sized array of each disturbance computed for each of the num_bootstrap_samples re-sampled data sets.