uniqc.calibration.xeb.benchmarker module

XEB benchmarker: executes XEB circuits and fits fidelity curves.

The benchmarker integrates readout EM by optionally applying it to raw measurement counts before computing the linear XEB estimator against the noiseless ideal distribution.

class uniqc.calibration.xeb.benchmarker.XEBenchmarker(adapter, shots=1000, readout_em=None, cache_dir=None, seed=None)[source]

Bases: object

Cross-entropy benchmarking engine.

Executes random XEB circuits on a quantum adapter (or dummy backend), computes normalized linear XEB values against the noiseless ideal distribution, and fits an exponential decay model to extract the per-layer fidelity r.

Parameters:
  • adapter (QuantumAdapter) – A QuantumAdapter instance.

  • shots (int) – Number of measurement shots per circuit.

  • readout_em (Any) – Optional ReadoutEM instance. If provided, raw counts are corrected via readout EM before computing fidelity.

  • cache_dir (str | None) – Directory for saving XEB results.

  • seed (int | None) – Random seed for circuit generation.

run_1q(qubit, depths, n_circuits=50)[source]

Run 1-qubit XEB on a single qubit.

Parameters:
  • qubit (int) – Qubit index.

  • depths (list[int]) – List of circuit depths to sweep.

  • n_circuits (int) – Number of random circuits per depth.

Returns:

XEBResult with per-layer fidelity r.

Return type:

XEBResult

run_2q(qubit_u, qubit_v, depths, n_circuits=50, entangler_gate='CNOT')[source]

Run 2-qubit XEB on a single pair.

Parameters:
  • qubit_u (int) – First qubit index.

  • qubit_v (int) – Second qubit index.

  • depths (list[int]) – List of circuit depths.

  • n_circuits (int) – Number of circuits per depth.

  • entangler_gate (str) – 2-qubit gate name.

Returns:

XEBResult with per-layer fidelity r.

Return type:

XEBResult

run_parallel_2q(pairs, depth, n_circuits=50, entangler_gates=None)[source]

Run parallel 2-qubit XEB across multiple disjoint qubit pairs.

All pairs are executed simultaneously in one multi-qubit circuit, simulating full-chip parallel execution.

Parameters:
  • pairs (list[tuple[int, int]]) – List of (u, v) qubit pairs (must be qubit-disjoint).

  • depth (int) – Depth of each random circuit layer.

  • n_circuits (int) – Number of parallel circuits.

  • entangler_gates (dict[tuple[int, int], str] | None) – Per-pair entangler gate names.

Returns:

XEBResult with type="xeb_2q_parallel".

Return type:

XEBResult