Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add documentation about instruction duration #13592

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
10 changes: 8 additions & 2 deletions qiskit/circuit/instruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,20 @@ class Instruction(Operation):
def __init__(self, name, num_qubits, num_clbits, params, duration=None, unit="dt", label=None):
"""Create a new instruction.

.. deprecated:: 1.3
The parameters ``duration`` and ``unit`` are deprecated since
Qiskit 1.3, and they will be removed in 2.0 or more later.
An instruction's duration is defined in a backend's Target object.

Args:
name (str): instruction name
num_qubits (int): instruction's qubit width
num_clbits (int): instruction's clbit width
params (list[int|float|complex|str|ndarray|list|ParameterExpression]):
list of parameters
duration (int or float): instruction's duration. it must be integer if ``unit`` is 'dt'
unit (str): time unit of duration
duration (int|float): (DEPRECATED) instruction's duration. it must be
integer if ``unit`` is ``'dt'``
unit (str): (DEPRECATED) time unit of duration
label (str or None): An optional label for identifying the instruction.

Raises:
Expand Down
2 changes: 1 addition & 1 deletion qiskit/pulse/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def format_parameter_value(
decimal: Number of digit to round returned value.

Returns:
Value casted to non-parameter data type, when possible.
Value cast to non-parameter data type, when possible.
"""
if isinstance(operand, ParameterExpression):
try:
Expand Down
8 changes: 8 additions & 0 deletions qiskit/visualization/timeline/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,14 @@ def add_data(self, data: drawings.ElementaryData):
def load_program(self, program: circuit.QuantumCircuit, target: Target | None = None):
"""Load quantum circuit and create drawing..

.. deprecated:: 1.3
Visualizing un-scheduled circuit with timeline drawer has been deprecated in Qiskit 1.3.
This circuit should be transpiled with scheduler though it consists of
instructions with explicit durations.

.. deprecated:: 1.3
Target with duration-less operations are going to error in Qiskit 2.0.

Args:
program: Scheduled circuit object to draw.
target: The target the circuit is scheduled for. This contains backend information
Expand Down
6 changes: 5 additions & 1 deletion qiskit/visualization/timeline/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ def draw(
):
r"""Generate visualization data for scheduled circuit programs.

.. deprecated:: 1.3
The ``target`` parameter needs to be specified in Qiskit 2.0 in order get the duration of
the instructions.

Args:
program: Program to visualize. This program should be a `QuantumCircuit` which is
transpiled with a scheduling_method, thus containing gate time information.
Expand Down Expand Up @@ -292,7 +296,7 @@ def draw(

Examples:
To visualize a scheduled circuit program, you can call this function with set of
control arguments. Most of appearance of the output image can be controlled by the
control arguments. Most of the appearance of the output image can be controlled by the
stylesheet.

Drawing with the default stylesheet.
Expand Down
Loading