Skip to content

laboneq_applications.analysis.two_qubit_irb

Analysis for a two-qubit interleaved randomized benchmarking experiment.

The experiment is defined in laboneq_applications.experiments.

The single-shot readout results of the two qubits of each pair give the probability P(00) that a sequence returns the pair to its initial state. A joint fit models the standard sequences with A α^m + B and the interleaved ones with A (α α_c)^m + B, sharing A and B. The decays give the error per Clifford, 3/4 (1 - α), and the error of the interleaved gate, 3/4 (1 - α_c), with the systematic bounds of Magesan et al., Phys. Rev. Lett. 109, 080505 (2012).

PlotIRBOptions

Options for the plot_irb task.

Attributes:

Name Type Description
interleaved_gate Literal['iswap', 'cz', 'cx']

The interleaved gate, which the plot title names. Default: "cz".

ProcessRawDataOptions

Options for the calculate_survival_probabilities task.

Attributes:

Name Type Description
averaging_mode AveragingMode

The averaging mode of the data. Only single-shot data can be analyzed. Default: AveragingMode.SINGLE_SHOT.

TwoQubitIRBTuneUpAnalysisWorkflowOptions

Options for the two-qubit interleaved RB analysis workflow.

Attributes:

Name Type Description
do_plotting bool

Whether to plot the data and the fit. Default: True.

analysis_workflow(result, qubit_pairs, length_cliffords, variations, options=None)

The two-qubit interleaved randomized benchmarking analysis workflow.

The workflow consists of the following steps:

Changed in version 27.1.0

The analysis moved out of contrib and fits the data itself instead of with Qiskit Experiments. It takes the qubit pairs as UIDs instead of the QPU and the pairs, and returns the errors of each pair. The workflow is named analysis_workflow instead of two qubit IRB analysis workflow.

Parameters:

Name Type Description Default
result RunExperimentResults

The experiment results returned by the run_experiment task.

required
qubit_pairs list[list[str]]

The qubit pairs the experiment was run on, passed by UID.

required
length_cliffords list

The Clifford-sequence lengths used in the experiment.

required
variations int

The number of random sequences per Clifford-sequence length.

required
options TwoQubitIRBTuneUpAnalysisWorkflowOptions | None

The options for building the workflow, passed as an instance of TwoQubitIRBTuneUpAnalysisWorkflowOptions. See the docstring of that class for more details.

None

Returns:

Name Type Description
WorkflowBuilder None

The builder for the analysis workflow. The workflow returns the errors of each pair, as extract_gate_errors returns them.

calculate_survival_probabilities(qubit_pairs, result, length_cliffords, variations, options=None)

Calculates the probability P(00) after each sequence from single-shot data.

Counts the shots in which both qubits of a pair end in their ground state.

Parameters:

Name Type Description Default
qubit_pairs list[list[str]]

The qubit pairs the experiment was run on, passed by UID.

required
result RunExperimentResults

The experiment results returned by the run_experiment task.

required
length_cliffords list

The Clifford-sequence lengths used in the experiment.

required
variations int

The number of random sequences per Clifford-sequence length.

required
options ProcessRawDataOptions | None

The options for this task, passed as an instance of ProcessRawDataOptions.

None

Returns:

Type Description
dict[str, dict[str, ndarray]]

Dictionary keyed by "q0_uid-q1_uid", holding for each pair:

  • "sweep_points": the sequence lengths, length_cliffords;
  • "standard": P(00) after the standard sequences, with one row per variation and one column per length;
  • "interleaved": P(00) after the interleaved sequences, in the same layout.

Raises:

Type Description
TypeError

If result is not an instance of RunExperimentResults.

ValueError

If the data is not single-shot.

extract_gate_errors(qubit_pairs, fit_results)

Extracts the error per Clifford and the error of the interleaved gate.

The error per Clifford is 3/4 (1 - α) and the error of the interleaved gate 3/4 (1 - α_c), where α and α_c are the fitted decays. The bounds of the interleaved-gate error follow Eq. (5) of Magesan et al., Phys. Rev. Lett. 109, 080505 (2012).

Parameters:

Name Type Description Default
qubit_pairs list[list[str]]

The qubit pairs the experiment was run on, passed by UID.

required
fit_results dict[str, ModelResult]

The fit results that fit_data returns.

required

Returns:

Type Description
dict[str, dict[str, float | tuple[float, float]]]

The errors of each pair whose fit succeeded, keyed by "q0_uid-q1_uid":

{
    "error_per_clifford": float,
    "error_per_clifford_stderr": float,
    "interleaved_gate_error": float,
    "interleaved_gate_error_stderr": float,
    "interleaved_gate_error_bounds": (float, float),
}

A standard error is NaN when the fit cannot estimate it.

fit_data(qubit_pairs, processed_data_dict)

Fits the standard and interleaved decays of each pair together.

Fits A α^m + B to the standard sequences and A (α α_c)^m + B to the interleaved ones, sharing the amplitude A and the offset B.

Parameters:

Name Type Description Default
qubit_pairs list[list[str]]

The qubit pairs the experiment was run on, passed by UID.

required
processed_data_dict dict[str, dict[str, ndarray]]

The probabilities that calculate_survival_probabilities returns.

required

Returns:

Type Description
dict[str, ModelResult]

The fit result of each pair whose fit succeeds, keyed by "q0_uid-q1_uid". Its parameters are amplitude, offset, alpha and alpha_c.

plot_irb(qubit_pairs, processed_data_dict, fit_results, gate_errors, options=None)

Plots P(00) of the standard and interleaved sequences of each pair.

Shows every sequence, the mean over the variations, the fit and the errors.

Parameters:

Name Type Description Default
qubit_pairs list[list[str]]

The qubit pairs the experiment was run on, passed by UID.

required
processed_data_dict dict[str, dict[str, ndarray]]

The probabilities that calculate_survival_probabilities returns.

required
fit_results dict[str, ModelResult]

The fit results that fit_data returns.

required
gate_errors dict[str, dict[str, float | tuple[float, float]]]

The errors that extract_gate_errors returns.

required
options PlotIRBOptions | None

The options for this task, passed as an instance of PlotIRBOptions.

None

Returns:

Type Description
dict[str, Figure]

The figure of each pair, keyed by "q0_uid-q1_uid".