Skip to content
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

Matplotlib drawer: fix bug #1437 and add tests #1438

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
0f9e89a
fix bug #1437
sergiomtzlosa Sep 5, 2024
511d399
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 6, 2024
fbe4569
removed inline matplotlib from docs
sergiomtzlosa Sep 7, 2024
34e942d
Merge branch 'matplotlib-circuit-drawer' of https://github.com/sergio…
sergiomtzlosa Sep 7, 2024
a60f4b7
first test for ui
sergiomtzlosa Sep 8, 2024
b14cf28
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 8, 2024
27f48b4
dummy test for ui
sergiomtzlosa Sep 9, 2024
e8e06c5
more test for ui
sergiomtzlosa Sep 9, 2024
732baf9
review test for UI
sergiomtzlosa Sep 9, 2024
24a403b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 9, 2024
a50663e
fixed test
sergiomtzlosa Sep 9, 2024
2708076
created test for gates barrier cluster
sergiomtzlosa Sep 9, 2024
115974b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 9, 2024
3468e77
added test comments
sergiomtzlosa Sep 9, 2024
3608d95
added more test for severael cases
sergiomtzlosa Sep 9, 2024
7038b5a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 9, 2024
b39b574
added more test for more cases
sergiomtzlosa Sep 9, 2024
35ed0e4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 9, 2024
b5bca09
edition of test
sergiomtzlosa Sep 9, 2024
6728184
test for a bigger circuit
sergiomtzlosa Sep 9, 2024
dea7bb8
test for layered circuit
sergiomtzlosa Sep 9, 2024
2d9ce54
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 9, 2024
e7d7914
test for layered circuit
sergiomtzlosa Sep 9, 2024
91e21ec
Merge branch 'matplotlib-circuit-drawer' of https://github.com/sergio…
sergiomtzlosa Sep 9, 2024
4d4f55e
review check style and tests
sergiomtzlosa Sep 9, 2024
30ef970
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 9, 2024
58200dd
test review for input parameters
sergiomtzlosa Sep 9, 2024
3c4b2b8
test review for input parameters
sergiomtzlosa Sep 9, 2024
f129cc0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 9, 2024
f477992
test review for plotting function
sergiomtzlosa Sep 9, 2024
df196f0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 9, 2024
a99c8e7
test styles for plotting
sergiomtzlosa Sep 9, 2024
0af7fb9
code cleaning and new tests
sergiomtzlosa Sep 9, 2024
048f3ad
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 9, 2024
a66a33b
code cleaning for drawing functions
sergiomtzlosa Sep 9, 2024
6adae29
test for target and control qubits in gates
sergiomtzlosa Sep 9, 2024
19ae050
reformat code to check control and target qubits along new tests
sergiomtzlosa Sep 9, 2024
f61e340
test to cover label rendering
sergiomtzlosa Sep 10, 2024
6795aab
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 10, 2024
2d2c7d6
test to cover label rendering
sergiomtzlosa Sep 10, 2024
827dc96
better assertion clause for plots
sergiomtzlosa Sep 10, 2024
bb3e9f6
test update to check barrier gates
sergiomtzlosa Sep 10, 2024
f7b962b
Merge branch 'master' into matplotlib-circuit-drawer
scarrazza Sep 11, 2024
30e91b2
remove duplicated test
sergiomtzlosa Sep 12, 2024
0960ea5
new UI test based on matching matplotlib figures with images
sergiomtzlosa Sep 13, 2024
aef64b4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 13, 2024
d489a1a
set backend to matplotlib and save arrays to file for matching
sergiomtzlosa Sep 18, 2024
dee7157
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 18, 2024
51cd75d
set backend to matplotlib and save arrays to file for matching
sergiomtzlosa Sep 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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