Skip to content

Commit

Permalink
Do not count delay operations in final_measurement_mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
nonhermitian committed Aug 19, 2022
1 parent 423d7e8 commit 03ea16f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions mthree/test/test_meas_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,15 @@ def test_mapping_list():

maps = final_measurement_mapping(qc)
assert not isinstance(maps, list)


def test_mapping_w_delays():
"""Check that measurements followed by delays get in the mapping"""
qc = QuantumCircuit(2, 2)
qc.measure(0, 1)
qc.delay(10, 0)
qc.measure(1, 0)
qc.barrier()

maps = final_measurement_mapping(qc)
assert maps == {1: 0, 0: 1}
2 changes: 1 addition & 1 deletion mthree/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def _final_measurement_mapping(circuit):
cmap.append(cbit)
active_cbits.remove(cbit)
active_qubits.remove(qbit)
elif item[0].name != "barrier":
elif item[0].name not in ["barrier", "delay"]:
for qq in item[1]:
_temp_qubit = qint_map[qq]
if _temp_qubit in active_qubits:
Expand Down

0 comments on commit 03ea16f

Please sign in to comment.