Skip to content

Bug in the rendering of the process matrix #2400

@BoxiLi

Description

@BoxiLi

Bug Description

The rendering of the process matrix looks weird in qutip-v5, The bottom of the bars behind is on top of the lower bars in front of it. (This is a CNOT gate with some errors)
image

Maybe the order of the bar rendering is reversed during the last refactoring of the plotting library?

Code to Reproduce the Bug

import numpy as np
import qutip

# Create a noisy CNOT gate
IZ = qutip.tensor([qutip.qeye(2), qutip.sigmaz()])
gate = qutip.gates.cnot()
noisy_gate = (-2.j * np.pi*(IZ/8/20)).expm() @ gate
fid = qutip.average_gate_fidelity(noisy_gate, qutip.gates.cnot())
print(f"noisy CNOT fidelity {fid}")

# Plot process matrix
op_basis = [[qutip.qeye(2), qutip.sigmax(), qutip.sigmay(), qutip.sigmaz()]] * 2
chi = qutip.qpt(qutip.to_super(noisy_gate), op_basis)
qutip.qpt_plot_combined(
    chi, lbls_list=[["i", "x", "y", "z"]] * 2, title="Process Matrix"
)

Code Output

noisy CNOT fidelity 0.9987669334932512

image

Expected Behaviour

The bars should be rendered correctly.

Your Environment

QuTiP Version:      5.0.1
Numpy Version:      1.26.4
Scipy Version:      1.12.0
Cython Version:     None
Matplotlib Version: 3.8.3
Python Version:     3.11.8
Number of CPUs:     40
BLAS Info:          Generic
INTEL MKL Ext:      False
Platform Info:      Linux (x86_64)

Additional Context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions