Skip to content

Commit

Permalink
Merge pull request #37 from tqsd/code-restructure
Browse files Browse the repository at this point in the history
Code restructure
  • Loading branch information
benjione authored Jun 15, 2020
2 parents 6ac22e7 + c8895f7 commit 4d07539
Show file tree
Hide file tree
Showing 184 changed files with 1,662 additions and 1,734 deletions.
12 changes: 6 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
.idea/*
protocol/__pycache__/__init__.cpython-37.pyc
protocol/__pycache__/protocols.cpython-37.pyc
components/__pycache__/
qunetsim/components/__pycache__/
tests/__pycache__/*
backends/__pycache__/*
objects/__pycache__/*
qunetsim/backends/__pycache__/*
qunetsim/objects/__pycache__/*
**/__pycache__/
build_docs.sh

venv/

venv2/
objects/__pycache__/
qunetsim/objects/__pycache__/
.project
.cproject
backends/__pycache__/
components/__init__.pyc
qunetsim/backends/__pycache__/
qunetsim/components/__init__.pyc
tests/backends/__pycache__/
integration_tests/__pycache__/test_multi_hop.cpython-36.pyc
integration_tests/__pycache__/test_single_hop.cpython-36.pyc
Empty file removed components/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion docs/_build/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 653c825270597944af704d1dc16a3da2
config: 5906c28230ec10a5e65a06a5cad72534
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file modified docs/_build/.doctrees/backends.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/components.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/components/host.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/components/network.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/components/protocols.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/design.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/_build/.doctrees/examples.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/examples/QKD.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/examples/anonymous_transfer.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/examples/chsh.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/examples/entanglement_routing.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/examples/packet_sniffing.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/examples/quantum_coin_flipping.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/examples/quantum_money.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/examples/send_data.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/examples/send_epr.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/index.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/install.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/install/linux_mac.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/install/windows.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/intro.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/objects.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/objects/classical_storage.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/objects/message.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/objects/packet.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/objects/quantum_storage.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/objects/qubit.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/objects/routing_packet.doctree
Binary file not shown.
Binary file modified docs/_build/.doctrees/quick_start.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/_build/_sources/backends.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ to chose the EQSN backend is shown in the code snippet below.
import numpy as np
# import the eqsn backend
from backends.eqsn_backend import EQSNBackend
from qunetsim.backends import EQSNBackend
# create the EQSN backend object
backend = EQSNBackend()
Expand Down
2 changes: 1 addition & 1 deletion docs/_build/_sources/components/host.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ The most commonly used methods for Hosts are:
* Run the function *protocol* with the parameters *protocol_params*.


.. automodule:: components.host
.. automodule:: qunetsim.components.host
:members:
2 changes: 1 addition & 1 deletion docs/_build/_sources/components/network.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ The most commonly used methods for Network are:
* Generate a depiction of the quantum network (via matplotlib)


.. automodule:: components.network
.. automodule:: qunetsim.components.network
:members:
2 changes: 1 addition & 1 deletion docs/_build/_sources/components/protocols.rst.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Protocols
==========

.. automodule:: components.protocols
.. automodule:: qunetsim.components.protocols
:members:
8 changes: 4 additions & 4 deletions docs/_build/_sources/examples/QKD.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,10 @@ The full example is below:
import numpy as np
import random
from components.host import Host
from components.network import Network
from objects.qubit import Qubit
from components.logger import Logger
from qunetsim.components import Host
from qunetsim.components import Network
from qunetsim.objects import Qubit
from qunetsim.objects import Logger
Logger.DISABLED = True
Expand Down
6 changes: 3 additions & 3 deletions docs/_build/_sources/examples/anonymous_transfer.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ Full example:
import time
from components.host import Host
from components.network import Network
from qunetsim.components import Host
from qunetsim.components import Network
import random
from objects.qubit import Qubit
from qunetsim.objects import Qubit
def distribute(host, nodes):
Expand Down
21 changes: 7 additions & 14 deletions docs/_build/_sources/examples/chsh.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,9 @@ of those here. The full example is below, with the backends imported and set.
import math
import random
from components.host import Host
from components.network import Network
from components.logger import Logger
# We have to import the ProjectQ backend.
# One should ensure the python library "projectq" is installed.
from backends.projectq_backend import ProjectQBackend
from qunetsim.components import Host
from qunetsim.components import Network
from qunetsim.objects import Logger
# Disable QuNetSim logging
Logger.DISABLED = True
Expand Down Expand Up @@ -284,20 +280,17 @@ of those here. The full example is below, with the backends imported and set.
def main():
network = Network.get_instance()
backend = ProjectQBackend()
nodes = ['A', 'B', 'C']
network.delay = 0.1
network.start(nodes, backend)
network.start()
host_A = Host('A', backend)
host_A = Host('A')
host_A.add_c_connection('C')
host_A.start()
host_B = Host('B', backend)
host_B = Host('B')
host_B.add_c_connection('C')
host_B.start()
host_C = Host('C', backend)
host_C = Host('C')
host_C.add_c_connection('A')
host_C.add_c_connection('B')
host_C.start()
Expand Down
7 changes: 7 additions & 0 deletions docs/_build/_sources/examples/entanglement_routing.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,13 @@ The full example is below.
.. code-block:: python
:linenos:
from qunetsim.components import Host
from qunetsim.components import Network
from qunetsim.objects import Logger
import networkx
import time
def generate_entanglement(host):
"""
Generate entanglement if the host has nothing to process (i.e. is idle).
Expand Down
10 changes: 5 additions & 5 deletions docs/_build/_sources/examples/packet_sniffing.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ The full example is below.
.. code-block:: python
:linenos:
from components.host import Host
from components.network import Network
from objects.message import Message
from objects.qubit import Qubit
from components.logger import Logger
from qunetsim.components import Host
from qunetsim.components import Network
from qunetsim.objects import Message
from qunetsim.objects import Qubit
from qunetsim.objects import Logger
Logger.DISABLED = True
Expand Down
12 changes: 6 additions & 6 deletions docs/_build/_sources/examples/quantum_coin_flipping.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,12 @@ The full example is given below.
import numpy as np
from objects.qubit import Qubit
from components.host import Host
from components.network import Network
from backends.eqsn_backend import EQSNBackend
# from backends.cqc_backend import CQCBackend
# from backends.projectq_backend import ProjectQBackend
from qunetsim.objects import Qubit
from qunetsim.components import Host
from qunetsim.components import Network
from qunetsim.backends import EQSNBackend
# from qunetsim.backends import CQCBackend
# from qunetsim.backends import ProjectQBackend
def quantum_coin_flipping(host, m, n, partner_id, rot_angle):
Expand Down
10 changes: 5 additions & 5 deletions docs/_build/_sources/examples/quantum_money.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,12 @@ The full example is below:
.. code-block:: python
:linenos:
from components.host import Host
from components.network import Network
from objects.logger import Logger
from objects.qubit import Qubit
from qunetsim.components import Host
from qunetsim.components import Network
from qunetsim.objects import Logger
from qunetsim.objects import Qubit
from random import randint, random
from backends.projectq_backend import ProjectQBackend
from qunetsim.backends import ProjectQBackend
Logger.DISABLED = True
Expand Down
6 changes: 3 additions & 3 deletions docs/_build/_sources/examples/send_data.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ The full example is below:
.. code-block:: python
:linenos:
from components.host import Host
from components.network import Network
from objects.qubit import Qubit
from qunetsim.components import Host
from qunetsim.components import Network
from qunetsim.objects import Qubit
def main():
Expand Down
6 changes: 3 additions & 3 deletions docs/_build/_sources/examples/send_epr.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ The full example is below.
.. code-block:: python
:linenos:
from components.host import Host
from components.network import Network
from components.logger import Logger
from qunetsim.components import Host
from qunetsim.components import Network
from qunetsim.objects import Logger
Logger.DISABLED = True
Expand Down
2 changes: 1 addition & 1 deletion docs/_build/_sources/objects/classical_storage.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ Classical Storage

The *Classical Storage* object is a component of a Host used to store *message* objects.

.. automodule:: objects.classical_storage
.. automodule:: qunetsim.objects.classical_storage
:members:
2 changes: 1 addition & 1 deletion docs/_build/_sources/objects/message.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ Message
message is structured as a *message* object with some extra content. Acknowledgements in QuNetSim are also
send as classical messages and therefore will appear in the Host's classical storage.

.. automodule:: objects.message
.. automodule:: qunetsim.objects.message
:members:
2 changes: 1 addition & 1 deletion docs/_build/_sources/objects/packet.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ packets in the Internet. They encode the sender and receiver of the packet along
the other properties listed below. Generally, users will not need to interact with
*Packet* objects directly.

.. automodule:: objects.packet
.. automodule:: qunetsim.objects.packet
:members:
2 changes: 1 addition & 1 deletion docs/_build/_sources/objects/quantum_storage.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ one for EPR pairs and the other for data qubits, but in both cases, they store *
further iterations of QuNetSim are developed, we plan to add parameters such that we can better simulate
quantum memories.

.. automodule:: objects.quantum_storage
.. automodule:: qunetsim.objects.quantum_storage
:members:
2 changes: 1 addition & 1 deletion docs/_build/_sources/objects/qubit.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ The *Qubit* object is mainly a wrapper for the underlying qubit that is defined
our own properties such that we can better manage the qubits in the system, for example, *Qubits* have a unique
ID and they know which *Host* they belong to.

.. automodule:: objects.qubit
.. automodule:: qunetsim.objects.qubit
:members:
4 changes: 2 additions & 2 deletions docs/_build/_sources/objects/routing_packet.rst.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Routing Packet
==============

The *Routing Packet* object is simular to the *Packet* object with the difference that it is analogous
The *Routing Packet* object is similar to the *Packet* object with the difference that it is analogous
to a network layer packet from the Internet. The main difference in our implementation is that these
packets have a TTL (time to live) property such that they are eliminated from the network after
some number of relays or "hops" in the network.

.. automodule:: objects.routing_packet
.. automodule:: qunetsim.objects.routing_packet
:members:
8 changes: 4 additions & 4 deletions docs/_build/_sources/quick_start.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ of commands that are built into hosts, see the Design Overview section.
.. code-block:: python
:linenos:
from components.host import Host
from components.network import Network
from objects.qubit import Qubit
from components.logger import Logger
from qunetsim.components.host import Host
from qunetsim.components.network import Network
from qunetsim.objects import Qubit
from qunetsim.objects import Logger
Logger.DISABLED = True
Expand Down
4 changes: 0 additions & 4 deletions docs/_build/_static/basic.css
Original file line number Diff line number Diff line change
Expand Up @@ -672,10 +672,6 @@ div.code-block-caption + div > div.highlight > pre {
margin-top: 0;
}

div.doctest > div.highlight span.gp { /* gp: Generic.Prompt */
user-select: none;
}

div.code-block-caption span.caption-number {
padding: 0.1em 0.3em;
font-style: italic;
Expand Down
1 change: 0 additions & 1 deletion docs/_build/_static/documentation_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ var DOCUMENTATION_OPTIONS = {
VERSION: '',
LANGUAGE: 'None',
COLLAPSE_INDEX: false,
BUILDER: 'html',
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt',
Expand Down
6 changes: 3 additions & 3 deletions docs/_build/_static/searchtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ var Search = {
if (results.length) {
var item = results.pop();
var listItem = $('<li style="display:none"></li>');
if (DOCUMENTATION_OPTIONS.BUILDER === 'dirhtml') {
if (DOCUMENTATION_OPTIONS.FILE_SUFFIX === '') {
// dirhtml builder
var dirname = item[0] + '/';
if (dirname.match(/\/index\/$/)) {
Expand Down Expand Up @@ -424,15 +424,15 @@ var Search = {
for (j = 0; j < _files.length; j++) {
file = _files[j];
if (!(file in scoreMap))
scoreMap[file] = {};
scoreMap[file] = {}
scoreMap[file][word] = o.score;
}
});

// create the mapping
for (j = 0; j < files.length; j++) {
file = files[j];
if (file in fileMap && fileMap[file].indexOf(word) === -1)
if (file in fileMap)
fileMap[file].push(word);
else
fileMap[file] = [word];
Expand Down
4 changes: 2 additions & 2 deletions docs/_build/backends.html
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ <h1>Backends<a class="headerlink" href="#backends" title="Permalink to this head
33
34
35
36</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
36</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">as</span> <span class="nn">np</span>
<span class="c1"># import the eqsn backend</span>
<span class="kn">from</span> <span class="nn">backends.eqsn_backend</span> <span class="kn">import</span> <span class="n">EQSNBackend</span>
<span class="kn">from</span> <span class="nn">qunetsim.backends</span> <span class="kn">import</span> <span class="n">EQSNBackend</span>

<span class="c1"># create the EQSN backend object</span>
<span class="n">backend</span> <span class="o">=</span> <span class="n">EQSNBackend</span><span class="p">()</span>
Expand Down
Loading

0 comments on commit 4d07539

Please sign in to comment.