From a1999258f35359920248e8a437caaa236960dede Mon Sep 17 00:00:00 2001 From: Pete Shadbolt Date: Fri, 6 May 2016 01:48:15 +0100 Subject: [PATCH] Test passing --- abp/make_tables.py | 5 ++--- abp/tables/by_name.json | 1 + abp/viz.py | 3 ++- tests/test_viz.py | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 abp/tables/by_name.json diff --git a/abp/make_tables.py b/abp/make_tables.py index bd34398..877a37a 100644 --- a/abp/make_tables.py +++ b/abp/make_tables.py @@ -103,7 +103,7 @@ if __name__ == "__main__": by_name = get_by_name(unitaries) conjugation_table = get_conjugation_table(unitaries) times_table = get_times_table(unitaries) - #cz_table = get_cz_table(unitaries) + # cz_table = get_cz_table(unitaries) # Write it all to disk directory = os.path.dirname(os.path.abspath(__file__)) @@ -112,8 +112,7 @@ if __name__ == "__main__": np.save("unitaries.npy", unitaries) np.save("conjugation_table.npy", conjugation_table) np.save("times_table.npy", times_table) - #np.save("cz_table.npy", cz_table) + # np.save("cz_table.npy", cz_table) with open("by_name.json", "wb") as f: json.dump(by_name, f) - diff --git a/abp/tables/by_name.json b/abp/tables/by_name.json new file mode 100644 index 0000000..f6cfcb7 --- /dev/null +++ b/abp/tables/by_name.json @@ -0,0 +1 @@ +{"sqz": 6, "sqy": 11, "sqx": 15, "pz": 3, "px": 1, "py": 2, "hadamard": 10, "phase": 5, "msqz": 5, "msqy": 9, "msqx": 14, "identity": 0} \ No newline at end of file diff --git a/abp/viz.py b/abp/viz.py index fe1d632..fb38462 100644 --- a/abp/viz.py +++ b/abp/viz.py @@ -17,7 +17,8 @@ def draw(state, filename="out.pdf", pos=None, ns=500): nx.draw_networkx_edges(graph, pos, edge_color="gray") nx.draw_networkx_labels(graph, pos, font_family="FreeSans") - labels = {i: tables.name_of(v) for i, v in state.vops.items()} + # tables.name_of(v) + labels = {i: "no name" for i, v in state.vops.items()} pos = {k: v + np.array([0, -.1]) for k, v in pos.items()} nx.draw_networkx_labels(graph, pos, labels, font_family="FreeSans") plt.axis('off') diff --git a/tests/test_viz.py b/tests/test_viz.py index a014713..fa08fdb 100644 --- a/tests/test_viz.py +++ b/tests/test_viz.py @@ -1,5 +1,5 @@ -from graph import GraphState -import viz +from abp.graph import GraphState +from abp import viz def test_viz():