Parcourir la source

Test passing

master
Pete Shadbolt il y a 8 ans
Parent
révision
a1999258f3
4 fichiers modifiés avec 7 ajouts et 6 suppressions
  1. +2
    -3
      abp/make_tables.py
  2. +1
    -0
      abp/tables/by_name.json
  3. +2
    -1
      abp/viz.py
  4. +2
    -2
      tests/test_viz.py

+ 2
- 3
abp/make_tables.py Voir le fichier

@@ -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)


+ 1
- 0
abp/tables/by_name.json Voir le fichier

@@ -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}

+ 2
- 1
abp/viz.py Voir le fichier

@@ -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')


+ 2
- 2
tests/test_viz.py Voir le fichier

@@ -1,5 +1,5 @@
from graph import GraphState
import viz
from abp.graph import GraphState
from abp import viz


def test_viz():


Chargement…
Annuler
Enregistrer