Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
Breaking change in Qiskit 0.45 - Gate.duration setting (#732)
Browse files Browse the repository at this point in the history
* breaking change in Qiskit 0.45

* black
  • Loading branch information
1ucian0 authored Sep 20, 2023
1 parent a3d5518 commit 5018fa5
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def _pre_runhook(self, dag: DAGCircuit) -> None:
if self._qubits and physical_index not in self._qubits:
continue

for gate in seq:
for index, gate in enumerate(seq):
try:
# Check calibration.
gate_length = dag.calibrations[gate.name][
Expand All @@ -352,6 +352,12 @@ def _pre_runhook(self, dag: DAGCircuit) -> None:
seq_length_.append(gate_length)
# Update gate duration.
# This is necessary for current timeline drawer, i.e. scheduled.

if hasattr(
gate, "to_mutable"
): # TODO this check can be removed after Qiskit 1.0, as it is always True
gate = gate.to_mutable()
seq[index] = gate
gate.duration = gate_length
self._dd_sequence_lengths[qubit].append(seq_length_)

Expand Down

0 comments on commit 5018fa5

Please sign in to comment.