Skip to content

Commit

Permalink
Fix incorrect stop time bug Qiskit#8729
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinWoodring committed Oct 24, 2023
1 parent 81e28dc commit dd91195
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion qiskit/circuit/quantumcircuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -5551,7 +5551,10 @@ def qubit_stop_time(self, *qubits: Union[Qubit, int]) -> float:
if len(qubits) == len([done for done in dones.values() if done]): # all done
return max(stop for stop in stops.values())

return 0 # If there are no instructions over bits
if len(stops) > 0:
return max(stop for stop in stops.values())
else:
return 0 # If there are no instructions over bits


# isometry is an alias for iso
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
fixes:
- |
This addresses the incorrect stop time bug #8729. See the linked issue here
<https://github.com/Qiskit/qiskit/issues/8729>. Also added an extra test to
ensure consistent functionality moving forward.
1 change: 1 addition & 0 deletions test/python/circuit/test_scheduled_circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ def test_per_qubit_durations(self):
self.assertEqual(sc.qubit_stop_time(2), 0)
self.assertEqual(sc.qubit_start_time(0, 1), 300)
self.assertEqual(sc.qubit_stop_time(0, 1), 1400)
self.assertEqual(sc.qubit_stop_time(0, 1, 2), 1400)

qc.measure_all()
sc = transpile(
Expand Down

0 comments on commit dd91195

Please sign in to comment.