Bladeren bron

Update server, some small docs

master
Pete Shadbolt 7 jaren geleden
bovenliggende
commit
9f715aa713
3 gewijzigde bestanden met toevoegingen van 12 en 7 verwijderingen
  1. +4
    -4
      abp/clifford.py
  2. +6
    -2
      bin/abpserver
  3. +2
    -1
      doc/index.rst

+ 4
- 4
abp/clifford.py Bestand weergeven

@@ -13,9 +13,9 @@ The complete set of aliases for single-qubit Cliffords is as follows:
Index Aliases
======= =========================
0 ``IA, identity, identity_h``
1 ``px, XA, px_h``
2 ``py, YA, py_h``
3 ``pz, ZA, pz_h``
1 ``XA, px, px_h``
2 ``YA, py, py_h``
3 ``ZA, pz, pz_h``
4 ``IB``
5 ``XB, sqz, msqz_h, phase_h``
6 ``YB, msqz, sqz_h, phase``
@@ -61,7 +61,7 @@ def human_name(i):
return choices[-1]

def is_diagonal(v):
""" TODO: remove this. Checks if a VOP is diagonal or not """
""" Checks if a VOP is diagonal or not """
return v in {0, 3, 5, 6}




+ 6
- 2
bin/abpserver Bestand weergeven

@@ -1,4 +1,9 @@
#!/usr/bin/python
"""
This is a simple websocket relay server that facilitates realtime visualization of GraphStates.
It doesn't do much except echo websocket messages to all connected clients, and serve some static content over HTTP.
"""

from websocket_server import WebsocketServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
from BaseHTTPServer import HTTPServer
@@ -11,7 +16,6 @@ from pkg_resources import resource_filename

clients = []


def new_message(client, server, message):
print "Received update from client {}.".format(client["id"])
server.send_message_to_all(message)
@@ -29,7 +33,7 @@ class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):

if __name__ == '__main__':
parser = argparse.ArgumentParser(description = "ABP websocket server")
parser.add_argument("-v", action="store_false", help="Launch browser")
parser.add_argument("-v", action="store_true", help="Launch browser")
args = parser.parse_args()

# Change to the right working dir


+ 2
- 1
doc/index.rst Bestand weergeven

@@ -130,8 +130,9 @@ Now, in another terminal, use ``abp.fancy.GraphState`` to run a Clifford circuit
>>> g = GraphState(range(10))
>>> g.act_circuit([(i, "hadamard") for i in range(10)])
>>> g.act_circuit([((i, i+1), "cz") for i in range(9)])
>>> g.update()

And you should see a 3D visualization of the state.
And you should see a 3D visualization of the state. You can call ``update()`` in a loop to see an animation.

.. image:: ../examples/viz.png



Laden…
Annuleren
Opslaan