About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
DynamicCircuitInstructionDurations
class DynamicCircuitInstructionDurations(instruction_durations=None, dt=None, enable_patching=True)
Bases: InstructionDurations
For dynamic circuits the IBM Qiskit backend currently reports instruction durations that differ compared with those required for the legacy Qobj-based path. For now we use this class to report updated InstructionDurations. TODO: This would be mitigated by a specialized Backend/Target for dynamic circuit backends.
Dynamic circuit instruction durations.
Attributes
Parameters
- instruction_durations (List[Tuple[str, Iterable[int] | None, float, Iterable[float] | None, str]] | List[Tuple[str, Iterable[int] | None, float, Iterable[float] | None]] | List[Tuple[str, Iterable[int] | None, float, str]] | List[Tuple[str, Iterable[int] | None, float]] | InstructionDurations | None)
- dt (float)
- enable_patching (bool)
MEASURE_PATCH_CYCLES
Default value: 160
MEASURE_PATCH_ODD_OFFSET
Default value: 64
Methods
from_backend
classmethod from_backend(backend)
Construct a DynamicInstructionDurations
object from the backend. :param backend: backend from which durations (gate lengths) and dt are extracted.
Returns
The InstructionDurations constructed from backend.
Return type
DynamicInstructionDurations
Parameters
backend (Backend)
from_target
classmethod from_target(target)
Construct a DynamicInstructionDurations
object from the target. :param target: target from which durations (gate lengths) and dt are extracted.
Returns
The InstructionDurations constructed from backend.
Return type
DynamicInstructionDurations
Parameters
target (Target)
get
get(inst, qubits, unit='dt', parameters=None)
Get the duration of the instruction with the name, qubits, and parameters.
Some instructions may have a parameter dependent duration.
Parameters
- inst (str | qiskit.circuit.Instruction) – An instruction or its name to be queried.
- qubits (int | list[int]) – Qubit indices that the instruction acts on.
- unit (str) – The unit of duration to be returned. It must be ‘s’ or ‘dt’.
- parameters (list[float] | None) – The value of the parameters of the desired instruction.
Returns
The duration of the instruction on the qubits.
Return type
float|int
Raises
TranspilerError – No duration is defined for the instruction.
units_used
units_used()
Get the set of all units used in this instruction durations.
Returns
Set of units used in this instruction durations.
Return type
set[str]
update
update(inst_durations, dt=None)
Update self with inst_durations (inst_durations overwrite self). Overrides the default durations for certain hardcoded instructions.
Parameters
- inst_durations (List[Tuple[str, Iterable[int] | None, float, Iterable[float] | None, str]] | List[Tuple[str, Iterable[int] | None, float, Iterable[float] | None]] | List[Tuple[str, Iterable[int] | None, float, str]] | List[Tuple[str, Iterable[int] | None, float]] | InstructionDurations | None) – Instruction durations to be merged into self (overwriting self).
- dt (float | None) – Sampling duration in seconds of the target backend.
Returns
The updated InstructionDurations.
Return type
InstructionDurations
Raises
TranspilerError – If the format of instruction_durations is invalid.
Was this page helpful?
Report a bug or request content on GitHub.