qcmet.benchmarks.CliffordRB#

class qcmet.benchmarks.CliffordRB(m_list, circs_per_m=5, qubits=1, target_clifford=None, save_path=None)[source]#

Implements Clifford Randomised Benchmarking Average Gate Error Metric.

This class generates circuits with a sequence of Clifford gates, measures the output, and computes the average gate error of the device.

__init__(m_list, circs_per_m=5, qubits=1, target_clifford=None, save_path=None)[source]#

Initialize the Clifford randomised benchmark.

Parameters:
  • m_list (List[int]) – The list of sequence lengths to run the benchmark on.

  • circs_per_m (int) – The number of circuits generated for a given sequence length m.

  • qubits (int | List[int]) – The number of qubits as either a list of qubit indices or int specifying number of qubits.

  • target_clifford (QuantumCircuit, optional) – QuantumCircuit containing only the target Clifford gate. This is utilised for Interleaved Clifford Randomised Benchmarking. To run Interleaved Clifford Randomised Benchmarking, use ‘InterleavedRB’ Class.

  • save_path (str | Path | FileManager | None, optional) – Directory path to save results. Defaults to None.

Methods

__init__(m_list[, circs_per_m, qubits, ...])

Initialize the Clifford randomised benchmark.

analyze()

Analyze measurements to return benchmark results.

fit_func(m, alpha, a0, b0)

Exponential decay fit function.

generate_circuits()

Generate benchmark circuits, user facing.

has_plotting()

Check if _plot function is implemented in benchmark.

load_circuit_measurements(circuit_measurements)

Load measurement counts into the experiment_data DataFrame.

measurements_to_probabilities()

Convert raw measurement counts to normalized probabilities.

plot([axes])

Plot benchmark result, user facing.

run([device, num_shots, max_circs_per_job])

Run benchmark.

save()

Save benchmark current state.

set_save_path(save_path)

Set benchmark save path if not set in class constructor.

Attributes

circuits

Gets all benchmark circuits.

experiment_data

Getter for experiment_data dataframe.

num_qubits

Number of qubits in this benchmark.

static fit_func(m, alpha, a0, b0)[source]#

Exponential decay fit function.

This is used for calculating the average gate error.

Parameters:
  • m (series) – sequence length.

  • alpha (float) – decay fitting parameter.

  • a0 (float) – amplitude fitting parameter.

  • b0 (float) – baseline fitting parameter.

Returns:

fitting function datapoints.

Return type:

ndarray