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

Merged
merged 8 commits into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from 7 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 @@ -63,14 +63,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 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
an 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
Visualization of unscheduled circuits with the timeline drawer has been deprecated in Qiskit 1.3.
This circuit should be transpiled with a scheduler, despite having instructions
with explicit durations.

.. deprecated:: 1.3
Targets 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
4 changes: 4 additions & 0 deletions 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 to get the
instruction durations.

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
Loading