Skip to content

Commit 7759a4b

Browse files
authored
Merge pull request #93 from QuTech-Delft/fix-qubits-not-active-epr-keep-min-fidelity
Bugfix QubitNotActiveError when using qubits after epr create with min_fidelity_all_at_end specified
2 parents d329f94 + 8f2ee25 commit 7759a4b

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

netqasm/sdk/builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2080,7 +2080,7 @@ def cleanup(_: BaseNetQASMConnection):
20802080
# Otherwise: free the qubits.
20812081
if not params.sequential:
20822082
for q in qubits:
2083-
q.free()
2083+
q.free(deactivate=False)
20842084

20852085
loop.set_cleanup_code(cleanup)
20862086

tests/test_builder.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,15 @@ def test_create_epr_min_fidelity_all():
753753
epr_socket = EPRSocket("Bob")
754754

755755
with DebugConnection("Alice", epr_sockets=[epr_socket]) as conn:
756-
epr_socket.create_keep(number=2, min_fidelity_all_at_end=80, max_tries=100)
756+
qubits = epr_socket.create_keep(
757+
number=2, min_fidelity_all_at_end=80, max_tries=100
758+
)
759+
760+
# Check that qubits can be used for following instructions
761+
q1, q2 = qubits
762+
q1.cnot(q2)
763+
q1.measure()
764+
q2.measure()
757765

758766
subroutine = conn._builder.subrt_pop_pending_subroutine()
759767
print(subroutine)
@@ -779,6 +787,14 @@ def test_create_epr_min_fidelity_all():
779787
PatternWildcard.ANY_ZERO_OR_MORE,
780788
GenericInstr.JMP,
781789
PatternWildcard.BRANCH_LABEL,
790+
PatternWildcard.ANY_ZERO_OR_MORE,
791+
GenericInstr.CNOT,
792+
PatternWildcard.ANY_ZERO_OR_MORE,
793+
GenericInstr.MEAS,
794+
PatternWildcard.ANY_ZERO_OR_MORE,
795+
GenericInstr.MEAS,
796+
PatternWildcard.ANY_ZERO_OR_MORE,
797+
GenericInstr.RET_ARR,
782798
]
783799
)
784800

0 commit comments

Comments
 (0)