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

Breaking change in Qiskit 0.45 - Gate.duration setting #732

Merged
merged 2 commits into from
Sep 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading