Skip to content

Commit 83c20e9

Browse files
1ucian0ElePT
andauthored
add documentation about instruction duration (#13592)
* add docuemntation about instruction duration * more docs and some spelling * Apply suggestions from code review Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com> * Update qiskit/circuit/instruction.py * Fix black * Fix lint --------- Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com> Co-authored-by: Elena Peña Tapia <epenatap@gmail.com>
1 parent 34fa489 commit 83c20e9

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

qiskit/circuit/instruction.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,20 @@ class Instruction(Operation):
6363
def __init__(self, name, num_qubits, num_clbits, params, duration=None, unit="dt", label=None):
6464
"""Create a new instruction.
6565
66+
.. deprecated:: 1.3
67+
The parameters ``duration`` and ``unit`` are deprecated since
68+
Qiskit 1.3, and they will be removed in 2.0 or later.
69+
An instruction's duration is defined in a backend's Target object.
70+
6671
Args:
6772
name (str): instruction name
6873
num_qubits (int): instruction's qubit width
6974
num_clbits (int): instruction's clbit width
7075
params (list[int|float|complex|str|ndarray|list|ParameterExpression]):
7176
list of parameters
72-
duration (int or float): instruction's duration. it must be integer if ``unit`` is 'dt'
73-
unit (str): time unit of duration
77+
duration (int|float): (DEPRECATED) instruction's duration. it must be
78+
an integer if ``unit`` is ``'dt'``
79+
unit (str): (DEPRECATED) time unit of duration
7480
label (str or None): An optional label for identifying the instruction.
7581
7682
Raises:

qiskit/pulse/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def format_parameter_value(
5151
decimal: Number of digit to round returned value.
5252
5353
Returns:
54-
Value casted to non-parameter data type, when possible.
54+
Value cast to non-parameter data type, when possible.
5555
"""
5656
if isinstance(operand, ParameterExpression):
5757
try:

qiskit/visualization/timeline/core.py

+9
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,15 @@ def add_data(self, data: drawings.ElementaryData):
142142
def load_program(self, program: circuit.QuantumCircuit, target: Target | None = None):
143143
"""Load quantum circuit and create drawing..
144144
145+
.. deprecated:: 1.3
146+
Visualization of unscheduled circuits with the timeline drawer has been
147+
deprecated in Qiskit 1.3.
148+
This circuit should be transpiled with a scheduler, despite having instructions
149+
with explicit durations.
150+
151+
.. deprecated:: 1.3
152+
Targets with duration-less operations are going to error in Qiskit 2.0.
153+
145154
Args:
146155
program: Scheduled circuit object to draw.
147156
target: The target the circuit is scheduled for. This contains backend information

qiskit/visualization/timeline/interface.py

+4
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ def draw(
5252
):
5353
r"""Generate visualization data for scheduled circuit programs.
5454
55+
.. deprecated:: 1.3
56+
The ``target`` parameter needs to be specified in Qiskit 2.0 in order to get the
57+
instruction durations.
58+
5559
Args:
5660
program: Program to visualize. This program should be a `QuantumCircuit` which is
5761
transpiled with a scheduling_method, thus containing gate time information.

0 commit comments

Comments
 (0)