Skip to content

Circuit drawer issues when setting idle_wires=False #13422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
diemilio opened this issue Nov 11, 2024 · 3 comments
Closed

Circuit drawer issues when setting idle_wires=False #13422

diemilio opened this issue Nov 11, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@diemilio
Copy link
Contributor

diemilio commented Nov 11, 2024

Environment

  • Qiskit version: 1.2.0
  • Python version: 3.11.9
  • Operating system: MacOS

What is happening?

The circuit drawer does not display certain circuits correctly when the idle_wires option is set to False. For example, when a barrier is added, the drawer assumes there is no gates after the barrier, so it does not display those qubits (see below). This happens with all drawers (not just mpl).

How can we reproduce the issue?

Drawer behaves as expected when idle_wires=True:

from qiskit import QuantumCircuit

qc = QuantumCircuit(2)
qc.x(1)
qc.barrier()
qc.h(0)
qc.draw(idle_wires=True, style='bw')

Output:
Image

But ignores q0 when idle_wires=False:

qc = QuantumCircuit(2)
qc.x(1)
qc.barrier()
qc.h(0)
qc.draw(idle_wires=False, style='bw')

Output:
Image

It also has a strange behavior in the presence of 2-qubit gates:

qc = QuantumCircuit(2)
qc.x(1)
qc.barrier()
qc.cx(1,0)
qc.draw(idle_wires=False, style='bw')

Output:
Image

What should happen?

Drawer should only ignore qubits/cbits with no instructions associated with them.

Any suggestions?

No response

@diemilio diemilio added the bug Something isn't working label Nov 11, 2024
@t-imamichi
Copy link
Member

I think it's already fixed #13149. Could you try 1.2.4?

@diemilio
Copy link
Contributor Author

diemilio commented Nov 12, 2024

Yes. It works in 1.2.4. Apologies, I searched the closed issues on github before posting, but did not find the one you linked. Closing this now.

@t-imamichi
Copy link
Member

No problem. I think the relevant PR and issues to your issue are difficult to find. It took me a while to remember the PR though I was involved in the investigation. I appreciate your report. Don't hesitate to submit issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants