Skip to content

Commit

Permalink
Merge branch 'main' into bounds_settings
Browse files Browse the repository at this point in the history
  • Loading branch information
stavros11 committed Mar 19, 2024
2 parents f125403 + 926104e commit 4946322
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
5 changes: 5 additions & 0 deletions src/qibolab/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ def execute_circuit(self, circuit, initial_state=None, nshots=1000):
sequence,
ExecutionParameters(nshots=nshots),
)

self.platform.disconnect()

result = MeasurementOutcomes(circuit.measurements, self, nshots=nshots)
self.assign_measurements(measurement_map, readout)
return result
Expand Down Expand Up @@ -149,6 +152,8 @@ def execute_circuits(self, circuits, initial_state=None, nshots=1000):
ExecutionParameters(nshots=nshots),
)

self.platform.disconnect()

results = []
readout = {k: deque(v) for k, v in readout.items()}
for circuit, measurement_map in zip(circuits, measurement_maps):
Expand Down
3 changes: 0 additions & 3 deletions src/qibolab/instruments/erasynth.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,3 @@ def create(self):
return ERASynthEthernet(self.name, self.address)
else:
return ERASynthPlusPlus(f"{self.name}", f"TCPIP::{self.address}::INSTR")

def __del__(self):
self.disconnect()
3 changes: 2 additions & 1 deletion src/qibolab/instruments/qm/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,11 @@ def connect(self):
self.manager = QuantumMachinesManager(
host=host, port=int(port), octave=octave, credentials=credentials
)
self.is_connected = True

def disconnect(self):
"""Disconnect from QM manager."""
if self.is_connected:
if self.manager is not None:
self.manager.close_all_quantum_machines()
self.manager.close()
self.is_connected = False
Expand Down
13 changes: 7 additions & 6 deletions src/qibolab/instruments/qm/sweepers.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,12 @@ def _sweep_duration(sweepers, qubits, qmsequence, relaxation_time):
qmpulse = qmsequence.pulse_to_qmpulse[pulse.serial]
qmpulse.swept_duration = dur
# find all pulses that are connected to ``qmpulse`` and align them
to_process = set(qmpulse.next_)
while to_process:
next_qmpulse = to_process.pop()
to_process |= next_qmpulse.next_
qmpulse.elements_to_align.add(next_qmpulse.element)
next_qmpulse.wait_time -= qmpulse.wait_time + qmpulse.duration // 4
if not isinstance(qmpulse, BakedPulse):
to_process = set(qmpulse.next_)
while to_process:
next_qmpulse = to_process.pop()
to_process |= next_qmpulse.next_
qmpulse.elements_to_align.add(next_qmpulse.element)
next_qmpulse.wait_time -= qmpulse.wait_time + qmpulse.duration // 4

_sweep_recursion(sweepers[1:], qubits, qmsequence, relaxation_time)
3 changes: 0 additions & 3 deletions src/qibolab/instruments/rohde_schwarz.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,3 @@ def create(self):
return LO_SGS100A.RohdeSchwarz_SGS100A(
self.name, f"TCPIP0::{self.address}::5025::SOCKET"
)

def __del__(self):
self.disconnect()

0 comments on commit 4946322

Please sign in to comment.