Skip to content

Commit efb6477

Browse files
Stephanie Wehnerclaude
andcommitted
docs: overhaul Sphinx documentation, remove all CQC references, update to NetQASM SDK
- Rewrite index.rst with structured landing page (features, quick start, navigation) - Rewrite NetQASM.rst from scratch replacing obsolete CQC content with NetQASM SDK docs - Fix GettingStarted.rst: update code to conn/flush/close pattern, fix broken links and typos - Fix Overview.rst: replace CQC diagram reference, fix NetQASM capitalization - Fix ConfNodes.rst: cqc_socket -> qnodeos_socket, replace TODO warnings, add cross-refs - Update native-mode docs: add deprecation notes, fix JSON config format, fix file references Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c55f88f commit efb6477

9 files changed

Lines changed: 363 additions & 222 deletions

File tree

docs/ConfNodes.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Configuring the simulated network
22
=================================
33

4+
SimulaQron uses two configuration files:
5+
6+
* ``simulaqron_network.json`` — defines nodes, their socket ports, and network topology (described on this page)
7+
* ``simulaqron_settings.json`` — configures the simulation backend, timeouts, and other settings
8+
(see :ref:`settings` in :doc:`GettingStarted`)
9+
410
-------------------------------
511
Starting the SimulaQron backend
612
-------------------------------
@@ -114,7 +120,7 @@ nodes "Alice", "Bob" and "Test" respectively::
114120
"localhost",
115121
8031
116122
],
117-
"cqc_socket": [
123+
"qnodeos_socket": [
118124
"localhost",
119125
8043
120126
],
@@ -173,9 +179,8 @@ The options for the automatically generated topologies are currently:
173179
connected network on 10 nodes, can be specified as `random_connected_20`. Note that the number of edges for a network
174180
with :math:`n` nodes must be greater or equal to :math:`n-1` and less or equal to :math:`n(n-1)/1`.
175181

176-
.. warning:: Implement a command in the CLI to invoke the generation of topologies.
177-
178-
.. warning:: Document that CLI command.
182+
.. note:: Topology generation via the CLI is planned but not yet implemented. For now, specify topologies
183+
directly in the ``simulaqron_network.json`` file (see :ref:`network-topologies`).
179184

180185
Along with setting up the network with the specified topology a .png figure is also generated and stored as
181186
config/topology.png. This is useful if a random network is used, to easily visualize the network used.

docs/GettingStarted.rst

Lines changed: 55 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Getting started
55
Setup
66
-----
77

8-
SimulaQron requires `Python 3.12 <https://python.org/>`_ along with the packages *cqc*, *twisted*, *numpy*, *scipy*,
9-
*networkx*, *flake8*, *click* and *daemons*.
8+
SimulaQron requires `Python 3.12 <https://python.org/>`_ along with the packages *netqasm*, *twisted*, *numpy*, *scipy*,
9+
*networkx*, *click* and *daemons*.
1010

1111
^^^^^^^^^^^^^^^^^^^^^^
1212
Installation using pip
@@ -41,14 +41,13 @@ interactive python console by typing `python3` and the::
4141
Testing a simple example
4242
------------------------
4343

44-
Before delving into how to write any program yourself, let's first simply run one of the existing examples when
45-
programming SimulaQron through the Python library (see https://softwarequtech.github.io/CQC-Python/examples.html).
46-
Remember from the Overview that SimulaQron has two parts: the first are the virtual node servers that act simulate
44+
Before delving into how to write any program yourself, let's first simply run one of the existing examples.
45+
Remember from the Overview that SimulaQron has two parts: the first are the virtual node servers that simulate
4746
the hardware at each node as well as the quantum communication between them in a transparent manner.
48-
The second are the applications themselves which can be written in two ways, the direct way is to use the native
49-
mode using the Python Twisted framework connecting to the virtual node servers, see :doc:`Examples`.
50-
The recommended way however is the use the NetQASM library that calls the virtual nodes by making use of the
51-
çclassical/quantum combiner interface. We will here illustrate how to use SimulaQron with the NetQASM library.
47+
The second are the applications themselves which can be written in two ways: the direct way is to use the native
48+
mode using the Python Twisted framework connecting to the virtual node servers (see :doc:`Examples`),
49+
and the recommended way is to use the NetQASM library that calls the virtual nodes via the NetQASM interface.
50+
We will here illustrate how to use SimulaQron with the NetQASM library.
5251

5352
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5453
Starting the SimulaQron backend
@@ -94,18 +93,16 @@ Evidently, there would be classical means to achieve this trivial task chosen fo
9493

9594
* Both Alice and Bob measure their respective qubits to obtain a classical random number :math:`x \in \{0,1\}`.
9695

97-
.. warning:: Update the link references and the names of the examples (NetQASM vs pythonLib)
98-
99-
The examples can be found in the repo `pythonLib <https://github.com/SoftwareQuTech/CQC-Python>`_.
96+
The examples can be found in ``examples/new-sdk/`` (see :doc:`Examples` for the full list).
10097
Before seeing how this example works, let us simply run the code::
10198

102-
cd examples/nativeMode/corrRNG
99+
cd examples/new-sdk/corrRNG
103100
sh run.sh
104101

105102
You should be seeing the following two lines::
106103

107-
App Alice: Measurement outcome is: 0/1
108-
App Bob: Measurement outcome is: 0/1
104+
Alice: My Random Number is '0/1'
105+
Bob: My Random Number is '0/1'
109106

110107
Note that the order of these two lines may differ, as it does not matter who measures first. So what is actually
111108
going on here? Let us first look at how we will realize the example by making an additional step (3) explicit:
@@ -131,47 +128,49 @@ The script run.sh executes the following two python scripts::
131128

132129
Let us now look at the programs for Alice and Bob.
133130

134-
We first initialize an object of the class ``NetQASMConnection`` which will do all the communication to the virtual
135-
through the NetQASM interface.
136-
Qubits can then be created by initializing a qubit-object, which takes a ``NetQASMConnection`` as an input.
137-
On these qubits operations can be applied and they can also be sent to other nodes in the network by use of the
138-
``NetQASMConnection``. The full code in aliceTest.py is::
139-
140-
# Create an EPR Socket between "Alice" and "Bob"
141-
epr_socket = EPRSocket("Alice", "Bob")
142-
# Initialize the connection
143-
with NetQASMConnection("Alice", epr_sockets=[epr_socket]) as Alice:
144-
# Create an EPR pair
145-
q = epr_socker.create_keep("Bob", number=1)[0]
146-
147-
# Measure qubit
148-
m=q.measure()
149-
to_print="App {}: Measurement outcome is: {}".format(Alice.name,m)
150-
print("|"+"-"*(len(to_print)+2)+"|")
151-
print("| "+to_print+" |")
152-
print("|"+"-"*(len(to_print)+2)+"|")
153-
154-
Similarly the code in bobTest.py read::
155-
156-
# Create an EPR Socket between "Bob" and "Alice"
157-
epr_socket = EPRSocket("Bob", "Alice")
158-
# Initialize the connection
159-
with NetQASMConnection("Bob", epr_sockets=[epr_socket]) as Bob:
160-
161-
# Receive qubit
162-
q=epr_socker.receive_keep("Alice")[0]
163-
164-
# Measure qubit
165-
m=q.measure()
166-
to_print="App {}: Measurement outcome is: {}".format(Bob.name,m)
167-
print("|"+"-"*(len(to_print)+2)+"|")
168-
print("| "+to_print+" |")
169-
print("|"+"-"*(len(to_print)+2)+"|")
170-
171-
.. warning:: Update the link references and the names of the examples (NetQASM vs pythonLib)
172-
173-
For further examples, see the examples/ folder and for the docs of the Python library see
174-
https://softwarequtech.github.io/CQC-Python/index.html.
131+
We first create a ``NetQASMConnection`` which handles all communication with the local quantum backend.
132+
An ``EPRSocket`` is used to create or receive entangled qubit pairs with a remote node.
133+
The key pattern is: queue operations, call ``flush()`` to execute them, then read results with ``int(m)``.
134+
135+
The core of aliceTest.py is::
136+
137+
epr_socket = EPRSocket("Bob")
138+
139+
# sim_conn is our connection to the quantum backend (SimulaQron), not to Bob.
140+
sim_conn = NetQASMConnection("Alice", epr_sockets=[epr_socket])
141+
142+
# Create an entangled qubit
143+
epr = epr_socket.create_keep()[0]
144+
145+
# Measure it
146+
m1 = epr.measure()
147+
148+
# flush() executes all queued quantum operations and makes measurement
149+
# results available. Before flush(), m1 is just a future/promise.
150+
sim_conn.flush()
151+
152+
# int(m) extracts the measurement outcome — only valid after flush().
153+
m1_val = int(m1)
154+
sim_conn.close()
155+
156+
Similarly the core of bobTest.py is::
157+
158+
epr_socket = EPRSocket("Alice")
159+
160+
# sim_conn is our connection to the quantum backend (SimulaQron), not to Alice.
161+
sim_conn = NetQASMConnection("Bob", epr_sockets=[epr_socket])
162+
163+
# Receive an entangled qubit
164+
epr = epr_socket.recv_keep()[0]
165+
166+
# Measure it
167+
m1 = epr.measure()
168+
169+
sim_conn.flush()
170+
m1_val = int(m1)
171+
sim_conn.close()
172+
173+
For further examples, see :doc:`Examples` and :doc:`NetQASM` for the full SDK reference.
175174

176175
.. _settings:
177176

0 commit comments

Comments
 (0)