소스 검색

Update server, some small docs

master
Pete Shadbolt 8 년 전
부모
커밋
9f715aa713
3개의 변경된 파일12개의 추가작업 그리고 7개의 파일을 삭제
  1. +4
    -4
      abp/clifford.py
  2. +6
    -2
      bin/abpserver
  3. +2
    -1
      doc/index.rst

+ 4
- 4
abp/clifford.py 파일 보기

@@ -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 파일 보기

@@ -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 파일 보기

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



불러오는 중...
취소
저장