spin_pulse.characterization.average_superop

Utilities to analyze and visualize quantum super-Operators.

Functions

compare_circuits(circ1, circ2)

Compare two quantum circuits by plotting the matrix elements of their

plot_chi_matrix(superop[, threshold])

Plot the chi-matrix elements for one or multiple quantum superop.

get_superop_from_paulidict(pauli_dict)

Return the SuperOp corresponding to a Pauli decomposition given as

Module Contents

spin_pulse.characterization.average_superop.compare_circuits(circ1, circ2)[source]

Compare two quantum circuits by plotting the matrix elements of their corresponding unitary operators.

This function converts both circuits into unitary matrices using qiskit.quantum_info.Operator. The global phase is removed before comparison. Three scatter plots are generated: real parts, imaginary parts, and absolute values of the matrix elements. A diagonal reference line is shown, and the squared distance between the two matrices is displayed.

Parameters:
  • circ1 (qiskit.QuantumCircuit) – First circuit to compare.

  • circ2 (qiskit.QuantumCircuit) – Second circuit to compare.

Notes

The global phase is aligned using the matrix element with maximum magnitude. This function is useful to visually validate the equivalence of two circuits after transformations such as transpilation or pulse compilation.

spin_pulse.characterization.average_superop.plot_chi_matrix(superop, threshold=None)[source]

Plot the chi-matrix elements for one or multiple quantum superop.

The chi-matrix is computed for each channel and plotted as bar plots (real and imaginary parts). If a threshold is provided, only elements with absolute value greater than the threshold (from the first channel) are shown.

Channels whose key contains the substring "analytical" are plotted with transparent bars and line styles, while the others are plotted as semi-transparent filled bars.

Parameters:
  • superop (dict[str, qiskit.quantum_info.SuperOp or qiskit.quantum_info.Channel]) – Dictionary mapping labels to quantum super-Operator. Each value must be compatible with qiskit.quantum_info.Choi/Chi so that Chi(superop[key]).data returns the chi-matrix.

  • threshold (float | None) – If not None, only chi-matrix elements with absolute value greater than threshold (as determined from the first channel in superop) are included in the plot.

Returns:

The figure object containing the chi-matrix plot.

Return type:

matplotlib.figure.Figure

spin_pulse.characterization.average_superop.get_superop_from_paulidict(pauli_dict)[source]

Return the SuperOp corresponding to a Pauli decomposition given as a dictionary.

The input is a mapping from tensor-product Pauli labels (e.g., “IXZ”, “ZZ”, “I”) to complex coefficients. For an n-qubit system, each label must be a string of length n, with characters drawn from {"I", "X", "Y", "Z"}.

The function builds the operator

\[O = \sum_{P} c_P P,\]

where \(P\) runs over Pauli strings and \(c_P\) are the provided coefficients, and then wraps it as a qiskit.quantum_info.SuperOp.

Parameters:

pauli_dict (dict[str, complex]) – Dictionary mapping Pauli labels (e.g., “IX”, “ZZI”) to complex coefficients.

Returns:

The resulting quantum channel represented as a SuperOp acting on the corresponding Hilbert space dimension.

Return type:

qiskit.quantum_info.SuperOp