Skip to content

Commit

Permalink
Merge pull request #1438 from sergiomtzlosa/matplotlib-circuit-drawer
Browse files Browse the repository at this point in the history
Matplotlib drawer: fix bug #1437 and add tests
  • Loading branch information
MatteoRobbiati committed Sep 19, 2024
2 parents 2d4e077 + 51cd75d commit df709ce
Show file tree
Hide file tree
Showing 28 changed files with 407 additions and 9 deletions.
4 changes: 2 additions & 2 deletions examples/circuit-draw-mpl/qibo-draw-circuit-matplotlib.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 17,
"id": "916f7b83-1ad7-4984-8573-eb55dfeb125d",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -440,7 +440,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "fa46e167",
"id": "626f9d58",
"metadata": {},
"outputs": [],
"source": []
Expand Down
10 changes: 4 additions & 6 deletions src/qibo/ui/mpldrawer.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,12 +599,10 @@ def _process_gates(array_gates, nqubits):
item += ("q_" + str(qbit),)

for qbit in gate._control_qubits:
item_add = (
("q_" + str(qbit[0]),)
if isinstance(qbit, tuple)
else ("q_" + str(qbit),)
)
item += item_add
if type(qbit) is tuple:
item += ("q_" + str(qbit[0]),)
else:
item += ("q_" + str(qbit),)

gates_plot.append(item)

Expand Down
1 change: 0 additions & 1 deletion src/qibo/ui/symbols.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"NOP": "",
"CPHASE": "Z",
"ID": "I",
"CX": "X",
"CZ": "Z",
Expand Down
Binary file added tests/test_ui_array_images/test_align_gate.npy
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added tests/test_ui_array_images/test_empty_circuit.npy
Binary file not shown.
Binary file added tests/test_ui_array_images/test_fuse_cluster.npy
Binary file not shown.
Binary file added tests/test_ui_array_images/test_fused_gates.npy
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit df709ce

Please sign in to comment.