|
32 | 32 |
|
33 | 33 | from simulaqron.local.setup import setup_local, assemble_qubit |
34 | 34 | from simulaqron.general.host_config import SocketsConfig |
| 35 | +from simulaqron.settings.network_config import NodeConfigType |
35 | 36 | from simulaqron.toolbox.stabilizer_states import StabilizerState |
36 | | -from simulaqron.settings import simulaqron_settings |
| 37 | +from simulaqron.settings import simulaqron_settings, network_config, LOCAL_SIMULAQRON_SETTINGS, LOCAL_NETWORK_SETTINGS |
37 | 38 | from twisted.internet.defer import inlineCallbacks |
38 | 39 | from twisted.spread import pb |
39 | 40 | from twisted.internet import reactor |
@@ -73,7 +74,7 @@ def runClientNode(qReg, virtRoot, myName, classicalNet): |
73 | 74 | realRho, imagRho = yield q1.callRemote("get_qubit") |
74 | 75 | state = np.array(assemble_qubit(realRho, imagRho), dtype=complex) |
75 | 76 | elif simulaqron_settings.sim_backend.value == "projectq": |
76 | | - realvec, imagvec = yield virtRoot.callRemote("get_register_RI", q1) |
| 77 | + _, (realvec, imagvec) = yield virtRoot.callRemote("get_register_RI", q1) |
77 | 78 | state = [r + (1j * j) for r, j in zip(realvec, imagvec)] |
78 | 79 | elif simulaqron_settings.sim_backend.value == "stabilizer": |
79 | 80 | array, _ = yield virtRoot.callRemote("get_register_RI", q1) |
@@ -148,14 +149,20 @@ def main(): |
148 | 149 | myName = "Alice" |
149 | 150 |
|
150 | 151 | # This file defines the network of virtual quantum nodes |
151 | | - network_file = simulaqron_settings.network_config_file |
| 152 | + # network_file = simulaqron_settings.network_config_file |
| 153 | + # virtualNet = SocketsConfig(network_file) |
152 | 154 |
|
153 | 155 | # This file defines the nodes acting as servers in the classical communication network |
154 | | - classicalFile = "classicalNet.cfg" |
| 156 | + # classicalFile = "classicalNet.cfg" |
| 157 | + # classicalNet = SocketsConfig(classicalFile) |
| 158 | + |
| 159 | + # We load the local configuration files |
| 160 | + simulaqron_settings.load_from_file(LOCAL_SIMULAQRON_SETTINGS) |
| 161 | + network_config.read_from_file(LOCAL_NETWORK_SETTINGS) |
155 | 162 |
|
156 | 163 | # Read configuration files for the virtual quantum, as well as the classical network |
157 | | - virtualNet = SocketsConfig(network_file) |
158 | | - classicalNet = SocketsConfig(classicalFile) |
| 164 | + virtualNet = SocketsConfig(network_config, config_type=NodeConfigType.VNODE) |
| 165 | + classicalNet = SocketsConfig(network_config, config_type=NodeConfigType.APP) |
159 | 166 |
|
160 | 167 | # Check if we should run a local classical server. If so, initialize the code |
161 | 168 | # to handle remote connections on the classical communication network |
|
0 commit comments