-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The parameter
idle_wires
default flipped to False in all circuit …
…drawers (#13865) * The parameter ``idle_wires`` default flipped to False in all circuit drawers * reno * readjust tests * test.python.visualization.test_circuit_text_drawer * adjust visual tests * bug in the tests * adjust test * black * testing * adjust tests * revert test changes * new reno * fix layout-related plots there's some bloch sphere plot failure which likely shouldn't be related to this, let's see if it persists * top-level handling of "auto" handle "auto" at the circuit_drawer level and subsequently use on booleans in internal logic * Fix idle_wires None case Co-authored-by: Jake Lishman <jake@binhbar.com> --------- Co-authored-by: Julien Gacon <jules.gacon@googlemail.com> Co-authored-by: Julien Gacon <gaconju@gmail.com> Co-authored-by: Jake Lishman <jake@binhbar.com>
- Loading branch information
1 parent
519ce51
commit 2ec8f8f
Showing
12 changed files
with
166 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
upgrade_visualization: | ||
- | | ||
The ``idle_wires`` parameter in all circuit drawers has been extended with a new option, ``"auto"``, which is now | ||
the default behavior. If you still want to display wires without instructions, explicitly set ``idle_wires=True``. | ||
When set to ``"auto"``, the behavior is as follows: | ||
- If the circuit has a defined ``.layout`` attribute, ``idle_wires`` is automatically set to ``False`` (hiding idle wires). | ||
- Otherwise, ``idle_wires`` remains ``True`` (showing all wires, as previous default). | ||
Here an example. A circuit without a layout, using ``idle_wires="auto"``: | ||
.. code-block:: text | ||
qr_0: ──────── | ||
┌───┐┌─┐ | ||
qr_1: ┤ H ├┤M├ | ||
└───┘└╥┘ | ||
cr_0: ══════╬═ | ||
║ | ||
cr_1: ══════╩═ | ||
Once a layout is applied, ``idle_wires="auto"`` sets ``idle_wires`` to ``False``, hiding idle wires: | ||
.. code-block:: text | ||
┌───┐┌─┐ | ||
qr_1 -> 1 ┤ H ├┤M├ | ||
└───┘└╥┘ | ||
cr_1: ══════╩═ | ||
If you want to display all wires in a laid-out circuit, set ``idle_wires=True`` explicitly: | ||
.. code-block:: text | ||
qr_0 -> 0 ──────── | ||
┌───┐┌─┐ | ||
qr_1 -> 1 ┤ H ├┤M├ | ||
└───┘└╥┘ | ||
ancilla_0 -> 2 ──────╫─ | ||
║ | ||
cr_0: ══════╬═ | ||
║ | ||
cr_1: ══════╩═ | ||
As quantum computers scale to more qubits, even small circuits can produce large circuit representations after | ||
transpilation. The ``"auto"`` setting helps improve readability by hiding unnecessary wires when possible. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-15.5 KB
(74%)
test/visual/mpl/circuit/references/nested_layout_control_flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-7.78 KB
(64%)
test/visual/mpl/circuit/references/qreg_names_after_layout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters