spin_pulse.characterization.average_superop¶
Utilities to analyze and visualize quantum super-Operators.
Functions¶
|
Compare two quantum circuits by plotting the matrix elements of their |
|
Plot the chi-matrix elements for one or multiple quantum superop. |
|
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/Chiso thatChi(superop[key]).datareturns the chi-matrix.threshold (float | None) – If not
None, only chi-matrix elements with absolute value greater thanthreshold(as determined from the first channel insuperop) 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.