---
title: Target (latest version)
description: API reference for qiskit.transpiler.Target in the latest version of qiskit
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/qiskit/qiskit.transpiler.Target
---

# Target

*class* `qiskit.transpiler.Target(description=None, num_qubits=0, dt=None, granularity=1, min_length=1, pulse_alignment=1, acquire_alignment=1, qubit_properties=None, concurrent_measurements=None, **_subclass_kwargs)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/transpiler/target.py#L87-L950)

Bases: `BaseTarget`

The intent of the `Target` object is to inform Qiskit’s compiler about the constraints of a particular backend so the compiler can compile an input circuit to something that works and is optimized for a device. It currently contains a description of instructions on a backend and their properties as well as some timing information. However, this exact interface may evolve over time as the needs of the compiler change. These changes will be done in a backwards compatible and controlled manner when they are made (either through versioning, subclassing, or mixins) to add on to the set of information exposed by a target.

As a basic example, let’s assume a backend has two qubits, supports [`UGate`](/docs/api/qiskit/qiskit.circuit.library.UGate "qiskit.circuit.library.UGate") on both qubits and [`CXGate`](/docs/api/qiskit/qiskit.circuit.library.CXGate "qiskit.circuit.library.CXGate") in both directions. To model this you would create the target like:

```python
from qiskit.transpiler import Target, InstructionProperties
from qiskit.circuit.library import UGate, CXGate
from qiskit.circuit import Parameter

gmap = Target()
theta = Parameter('theta')
phi = Parameter('phi')
lam = Parameter('lambda')
u_props = {
    (0,): InstructionProperties(duration=5.23e-8, error=0.00038115),
    (1,): InstructionProperties(duration=4.52e-8, error=0.00032115),
}
gmap.add_instruction(UGate(theta, phi, lam), u_props)
cx_props = {
    (0,1): InstructionProperties(duration=5.23e-7, error=0.00098115),
    (1,0): InstructionProperties(duration=4.52e-7, error=0.00132115),
}
gmap.add_instruction(CXGate(), cx_props)
```

Each instruction in the `Target` is indexed by a unique string name that uniquely identifies that instance of an [`Instruction`](/docs/api/qiskit/qiskit.circuit.Instruction "qiskit.circuit.Instruction") object in the Target. There is a 1:1 mapping between a name and an [`Instruction`](/docs/api/qiskit/qiskit.circuit.Instruction "qiskit.circuit.Instruction") instance in the target and each name must be unique. By default, the name is the [`name`](/docs/api/qiskit/qiskit.circuit.Instruction#name "qiskit.circuit.Instruction.name") attribute of the instruction, but can be set to anything. This lets a single target have multiple instances of the same instruction class with different parameters. For example, if a backend target has two instances of an [`RXGate`](/docs/api/qiskit/qiskit.circuit.library.RXGate "qiskit.circuit.library.RXGate") one is parameterized over any theta while the other is tuned up for a theta of pi/6 you can add these by doing something like:

```python
import math

from qiskit.transpiler import Target, InstructionProperties
from qiskit.circuit.library import RXGate
from qiskit.circuit import Parameter

target = Target()
theta = Parameter('theta')
rx_props = {
    (0,): InstructionProperties(duration=5.23e-8, error=0.00038115),
}
target.add_instruction(RXGate(theta), rx_props)
rx_30_props = {
    (0,): InstructionProperties(duration=1.74e-6, error=.00012)
}
target.add_instruction(RXGate(math.pi / 6), rx_30_props, name='rx_30')
```

Then in the `target` object accessing by `rx_30` will get the fixed angle [`RXGate`](/docs/api/qiskit/qiskit.circuit.library.RXGate "qiskit.circuit.library.RXGate") while `rx` will get the parameterized [`RXGate`](/docs/api/qiskit/qiskit.circuit.library.RXGate "qiskit.circuit.library.RXGate").

You can optionally specify a bound on valid values on a gate in the target by using the `angle_bounds` keyword argument when calling the [`add_instruction()`](#qiskit.transpiler.Target.add_instruction "qiskit.transpiler.Target.add_instruction") method. Bounds are set on operations not individual instructions, so when you call [`add_instruction()`](#qiskit.transpiler.Target.add_instruction "qiskit.transpiler.Target.add_instruction") the bounds are applied for all qargs that it is defined on. The bounds are specified of a list of 2-tuples of floats where the first float is the lower bound and the second float is the upper bound. For example, if you specified an angle bound:

```python
[(0.0, 3.14), (-3.14, 3.14), (0.0, 1.0)]
```

this indicates the angle bounds for a 3 parameter gate where the first parameter accepts angles between 0 and 3.14, the second between -3.14 and 3.14, and the third parameter between 0 and 1. All bounds are set inclusively as well. A bound can also be specified with `None` instead of a 2-tuple which indicates that parameter has no constraints. For example:

```python
[(0.0, 3.14), None, None]
```

indicates an angle bound for a 3 parameter gate where only the first parameter is restricted to angles between 0.0 and 3.14 and the other parameters accept any value.

You can check if any operations in the target have angle bounds set with, [`has_angle_bounds()`](#qiskit.transpiler.Target.has_angle_bounds "qiskit.transpiler.Target.has_angle_bounds") and also if a specific name in the target has angle bounds set with [`gate_has_angle_bounds()`](#qiskit.transpiler.Target.gate_has_angle_bounds "qiskit.transpiler.Target.gate_has_angle_bounds"). Whether a particular set of parameter values conforms to the angle bounds can be checked with [`supported_angle_bound()`](#qiskit.transpiler.Target.supported_angle_bound "qiskit.transpiler.Target.supported_angle_bound"). In the preset pass managers the [`WrapAngles`](/docs/api/qiskit/qiskit.transpiler.passes.WrapAngles "qiskit.transpiler.passes.WrapAngles") pass is used to enforce the angle bounds, for this to work you need to provide a function to the [`WrapAngleRegistry`](/docs/api/qiskit/qiskit.transpiler.WrapAngleRegistry "qiskit.transpiler.WrapAngleRegistry") used by the pass. You can see more details on this in: [Angle bounds on Gates](/docs/api/qiskit/providers#angle-bounds-on-gates).

This class can be queried via the mapping protocol, using the instruction’s name as a key. You can modify any property for an instruction via the [`update_instruction_properties()`](#qiskit.transpiler.Target.update_instruction_properties "qiskit.transpiler.Target.update_instruction_properties") method. Modification via the mapping protocol or mutating the attributes of a [`InstructionProperties`](/docs/api/qiskit/qiskit.transpiler.InstructionProperties "qiskit.transpiler.InstructionProperties") object is **not** supported and doing so will invalidate the internal state of the object.

> **Note**
>
> This class assumes that qubit indices start at 0 and are a contiguous set if you want a submapping the bits will need to be reindexed in a new [`Target`](#qiskit.transpiler.Target "qiskit.transpiler.Target") object.

> **Note**
>
> This class only supports additions of gates, qargs, and properties. If you need to remove one of these the best option is to iterate over an existing object and create a new subset (or use one of the methods to do this). The object internally caches different views and these would potentially be invalidated by removals.

## Subclassing

While it is technically possible to subclass [`Target`](#qiskit.transpiler.Target "qiskit.transpiler.Target"), beware that the majority of the built-in information is in Rust and is queried from Rust in built-in transpiler passes. Python-space overrides are not visible to Rust, and you should not rely on these to change the behavior of Qiskit’s built-in transpiler passes. [`Target`](#qiskit.transpiler.Target "qiskit.transpiler.Target") is largely supposed to be a representation of a QPU that has specialized *constructors*, not specialized subclasses; the usual API for constructing a [`Target`](#qiskit.transpiler.Target "qiskit.transpiler.Target") should be a function that returns a base [`Target`](#qiskit.transpiler.Target "qiskit.transpiler.Target"), not a subclass with a custom initializer.

You may use subclassing to add *additional* Python-space properties to your [`Target`](#qiskit.transpiler.Target "qiskit.transpiler.Target"), for example to then interpret in custom backend-specific transpiler stages; the [`Target`](#qiskit.transpiler.Target "qiskit.transpiler.Target") is passed to stage-plugin constructors.

You should not subclass [`Target`](#qiskit.transpiler.Target "qiskit.transpiler.Target") to attempt to modify the behavior of Qiskit’s built-in passes; the Python-space subclassing will not be seen by passes written in Rust.

Further, as the core of [`Target`](#qiskit.transpiler.Target "qiskit.transpiler.Target") is written in Rust, it uses [`__new__()`](https://docs.python.org/3/reference/datamodel.html#object.__new__) as its initializer, and you must ensure that the correct arguments are passed through to the underlying implementation. If you override the signature of the [`__init__()`](https://docs.python.org/3/reference/datamodel.html#object.__init__) method, you must also include an override of [`__new__()`](https://docs.python.org/3/reference/datamodel.html#object.__new__) with the same signature, which calls `super().__new__()` in a correct manner.

Create a new [`Target`](#qiskit.transpiler.Target "qiskit.transpiler.Target") object.

**param description**

An optional string to describe the Target.

**type description**

str

**param num\_qubits**

An optional int to specify the number of qubits the backend target has. This is not a hard limit on the construction; any call to [`add_instruction()`](#qiskit.transpiler.Target.add_instruction "qiskit.transpiler.Target.add_instruction") will cause the set num\_qubits to update to accommodate any concrete `qargs` in the given properties.

This can be explicitly set to `None` to indicate a [`Target`](#qiskit.transpiler.Target "qiskit.transpiler.Target") representing a simulator or other abstract machine that imposes no limits on the number of qubits. In this case, all instructions added to the target should be global (with `properties=None` or `properties={None: None}`).

**type num\_qubits**

int

**param dt**

The system time resolution of input signals in seconds

**type dt**

float

**param granularity**

An integer value representing minimum pulse gate resolution in units of `dt`. A user-defined pulse gate should have duration of a multiple of this granularity value.

**type granularity**

int

**param min\_length**

An integer value representing minimum pulse gate length in units of `dt`. A user-defined pulse gate should be longer than this length.

**type min\_length**

int

**param pulse\_alignment**

An integer value representing a time resolution of gate instruction starting time. Gate instruction should start at time which is a multiple of the alignment value.

**type pulse\_alignment**

int

**param acquire\_alignment**

An integer value representing a time resolution of measure instruction starting time. Measure instruction should start at time which is a multiple of the alignment value.

**type acquire\_alignment**

int

**param qubit\_properties**

A list of [`QubitProperties`](/docs/api/qiskit/qiskit.providers.QubitProperties "qiskit.providers.QubitProperties") objects defining the characteristics of each qubit on the target device. If specified the length of this list must match the number of qubits in the target, where the index in the list matches the qubit number the properties are defined for. If some qubits don’t have properties available you can set that entry to `None`

**type qubit\_properties**

list

**param concurrent\_measurements**

A list of sets of qubits that must be measured together. This must be provided as a nested list like `[[0, 1], [2, 3, 4]]`.

**type concurrent\_measurements**

list

**raises ValueError**

If both `num_qubits` and `qubit_properties` are both defined and the value of `num_qubits` differs from the length of `qubit_properties`.

## Attributes

### acquire\_alignment

### concurrent\_measurements

### description

### dt

Return dt.

### granularity

### instructions

Get the list of tuples ([`Instruction`](/docs/api/qiskit/qiskit.circuit.Instruction "qiskit.circuit.Instruction"), (qargs)) for the target

For globally defined variable width operations the tuple will be of the form `(class, None)` where class is the actual operation class that is globally defined.

### min\_length

### num\_qubits

### operation\_names

Get the operation names in the target.

### operations

Get the operation objects in the target.

### physical\_qubits

Returns a sorted list of physical qubits.

### pulse\_alignment

### qargs

The set of qargs in the target.

### qubit\_properties

## Methods

### add\_instruction

`add_instruction(instruction, properties=None, name=None, *, angle_bounds=None)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/transpiler/target.py#L363-L463)

Add a new instruction to the [`Target`](#qiskit.transpiler.Target "qiskit.transpiler.Target")

As `Target` objects are strictly additive this is the primary method for modifying a `Target`. Typically, you will use this to fully populate a `Target` before using it in [`BackendV2`](/docs/api/qiskit/qiskit.providers.BackendV2 "qiskit.providers.BackendV2"). For example:

```python
from qiskit.circuit.library import CXGate
from qiskit.transpiler import Target, InstructionProperties

target = Target()
cx_properties = {
    (0, 1): None,
    (1, 0): None,
    (0, 2): None,
    (2, 0): None,
    (0, 3): None,
    (2, 3): None,
    (3, 0): None,
    (3, 2): None
}
target.add_instruction(CXGate(), cx_properties)
```

Will add a [`CXGate`](/docs/api/qiskit/qiskit.circuit.library.CXGate "qiskit.circuit.library.CXGate") to the target with no properties (duration, error, etc) with the coupling edge list: `(0, 1), (1, 0), (0, 2), (2, 0), (0, 3), (2, 3), (3, 0), (3, 2)`. If there are properties available for the instruction you can replace the `None` value in the properties dictionary with an [`InstructionProperties`](/docs/api/qiskit/qiskit.transpiler.InstructionProperties "qiskit.transpiler.InstructionProperties") object. This pattern is repeated for each [`Instruction`](/docs/api/qiskit/qiskit.circuit.Instruction "qiskit.circuit.Instruction") the target supports.

**Parameters**

- **instruction** (*Union\[*[*qiskit.circuit.Instruction*](/docs/api/qiskit/qiskit.circuit.Instruction "qiskit.circuit.Instruction")*,* [*Type*](/docs/api/qiskit/circuit_classical#qiskit.circuit.classical.types.Type "qiskit.circuit.classical.types.Type")*\[*[*qiskit.circuit.Instruction*](/docs/api/qiskit/qiskit.circuit.Instruction "qiskit.circuit.Instruction")*]]*) – The operation object to add to the map. If it’s parameterized any value of the parameter can be set. Optionally for variable width instructions (such as control flow operations such as `ForLoop` or `MCXGate`) you can specify the class. If the class is specified then the `name` argument must be specified. When a class is used the gate is treated as global and not having any properties set.
- **properties** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict)) – A dictionary of qarg entries to an [`InstructionProperties`](/docs/api/qiskit/qiskit.transpiler.InstructionProperties "qiskit.transpiler.InstructionProperties") object for that instruction implementation on the backend. Properties are optional for any instruction implementation, if there are no [`InstructionProperties`](/docs/api/qiskit/qiskit.transpiler.InstructionProperties "qiskit.transpiler.InstructionProperties") available for the backend the value can be None. If there are no constraints on the instruction (as in a noiseless/ideal simulation) this can be set to `{None, None}` which will indicate it runs on all qubits (or all available permutations of qubits for multi-qubit gates). The first `None` indicates it applies to all qubits and the second `None` indicates there are no [`InstructionProperties`](/docs/api/qiskit/qiskit.transpiler.InstructionProperties "qiskit.transpiler.InstructionProperties") for the instruction. By default, if properties is not set it is equivalent to passing `{None: None}`.
- **name** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) – An optional name to use for identifying the instruction. If not specified the [`name`](/docs/api/qiskit/qiskit.circuit.Instruction#name "qiskit.circuit.Instruction.name") attribute of `gate` will be used. All gates in the `Target` need unique names. Backends can differentiate between different parameterization of a single gate by providing a unique name for each (e.g. “rx30”, “rx60”, \`”rx90”\`\` similar to the example in the documentation for the [`Target`](#qiskit.transpiler.Target "qiskit.transpiler.Target") class).
- **angle\_bounds** ([*list*](https://docs.python.org/3/library/stdtypes.html#list)) – The bounds on the parameters for a given gate. This is specified by a list of tuples (low, high) which represent the low and high bound (inclusively) on what float values are allowed for the parameter in that position. If a parameter doesn’t have an angle bound you can use `None` to represent that. For example if a 3 parameter gate only had a bound on the second parameter you would represent that with: `[None, [0, 3.14], None]` which means the first and third parameter allow any value but the second parameter only accepts values between 0 and 3.14.

**Raises**

- [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError) – If gate is already in map
- [**TranspilerError**](/docs/api/qiskit/transpiler#qiskit.transpiler.TranspilerError "qiskit.transpiler.TranspilerError") – If an operation class is passed in for `instruction` and no name is specified or `properties` is set.

### build\_coupling\_map

`build_coupling_map(two_q_gate=None, filter_idle_qubits=False)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/transpiler/target.py#L615-L681)

Get a [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "qiskit.transpiler.CouplingMap") from this target.

If there is a mix of two qubit operations that have a connectivity constraint and those that are globally defined this will also return `None` because the global connectivity means there is no constraint on the target. If you wish to see the constraints of the two qubit operations that have constraints you should use the `two_q_gate` argument to limit the output to the gates which have a constraint.

**Parameters**

- **two\_q\_gate** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) – An optional gate name for a two qubit gate in the `Target` to generate the coupling map for. If specified the output coupling map will only have edges between qubits where this gate is present.
- **filter\_idle\_qubits** ([*bool*](https://docs.python.org/3/library/functions.html#bool)) – If set to `True` the output [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "qiskit.transpiler.CouplingMap") will remove any qubits that don’t have any operations defined in the target. Note that using this argument will result in an output [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "qiskit.transpiler.CouplingMap") object which has holes in its indices which might differ from the assumptions of the class. The typical use case of this argument is to be paired with [`CouplingMap.connected_components()`](/docs/api/qiskit/qiskit.transpiler.CouplingMap#connected_components "qiskit.transpiler.CouplingMap.connected_components") which will handle the holes as expected.

**Returns**

**The [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "qiskit.transpiler.CouplingMap") object**

for this target. If there are no connectivity constraints in the target this will return `None`.

**Return type**

[CouplingMap](/docs/api/qiskit/qiskit.transpiler.CouplingMap "qiskit.transpiler.CouplingMap")

**Raises**

- [**ValueError**](https://docs.python.org/3/library/exceptions.html#ValueError) – If a non-two qubit gate is passed in for `two_q_gate`.
- [**IndexError**](https://docs.python.org/3/library/exceptions.html#IndexError) – If an Instruction not in the `Target` is passed in for `two_q_gate`.

### durations

`durations()`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/transpiler/target.py#L498-L513)

Get an InstructionDurations object from the target

**Returns**

**The instruction duration represented in the**

target

**Return type**

[InstructionDurations](/docs/api/qiskit/qiskit.transpiler.InstructionDurations "qiskit.transpiler.InstructionDurations")

### from\_configuration

*classmethod* `from_configuration(basis_gates, num_qubits=None, coupling_map=None, instruction_durations=None, concurrent_measurements=None, dt=None, timing_constraints=None, custom_name_mapping=None)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/transpiler/target.py#L783-L950)

Create a target object from the individual global configuration

Prior to the creation of the [`Target`](#qiskit.transpiler.Target "qiskit.transpiler.Target") class, the constraints of a backend were represented by a collection of different objects which combined represent a subset of the information contained in the [`Target`](#qiskit.transpiler.Target "qiskit.transpiler.Target"). This function provides a simple interface to convert those separate objects to a [`Target`](#qiskit.transpiler.Target "qiskit.transpiler.Target").

This constructor will use the input from `basis_gates`, `num_qubits`, and `coupling_map` to build a base model of the backend and the `instruction_durations`, `backend_properties`, and `inst_map` inputs are then queried (in that order) based on that model to look up the properties of each instruction and qubit. If there is an inconsistency between the inputs any extra or conflicting information present in `instruction_durations`, `backend_properties`, or `inst_map` will be ignored.

**Parameters**

- **basis\_gates** ([*list*](https://docs.python.org/3/library/stdtypes.html#list)*\[*[*str*](https://docs.python.org/3/library/stdtypes.html#str)*]*) – The list of basis gate names for the backend. For the target to be created these names must either be in the output from [`get_standard_gate_name_mapping()`](/docs/api/qiskit/circuit_library#qiskit.circuit.library.get_standard_gate_name_mapping "qiskit.circuit.library.get_standard_gate_name_mapping") or present in the specified `custom_name_mapping` argument.
- **num\_qubits** ([*int*](https://docs.python.org/3/library/functions.html#int) *| None*) – The number of qubits supported on the backend.
- **coupling\_map** ([*CouplingMap*](/docs/api/qiskit/qiskit.transpiler.CouplingMap "qiskit.transpiler.coupling.CouplingMap") *| None*) – The coupling map representing connectivity constraints on the backend. If specified all gates from `basis_gates` will be supported on all qubits (or pairs of qubits).
- **instruction\_durations** ([*InstructionDurations*](/docs/api/qiskit/qiskit.transpiler.InstructionDurations "qiskit.transpiler.instruction_durations.InstructionDurations") *| None*) – Optional instruction durations for instructions. If specified it will take priority for setting the `duration` field in the [`InstructionProperties`](/docs/api/qiskit/qiskit.transpiler.InstructionProperties "qiskit.transpiler.InstructionProperties") objects for the instructions in the target.
- **concurrent\_measurements** ([*list*](https://docs.python.org/3/library/stdtypes.html#list)) – A list of sets of qubits that must be measured together. This must be provided as a nested list like `[[0, 1], [2, 3, 4]]`.
- **dt** ([*float*](https://docs.python.org/3/library/functions.html#float) *| None*) – The system time resolution of input signals in seconds
- **timing\_constraints** (*TimingConstraints | None*) – Optional timing constraints to include in the [`Target`](#qiskit.transpiler.Target "qiskit.transpiler.Target")
- **custom\_name\_mapping** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict)*\[*[*str*](https://docs.python.org/3/library/stdtypes.html#str)*,* [*Any*](https://docs.python.org/3/library/typing.html#typing.Any)*] | None*) – An optional dictionary that maps custom gate/operation names in `basis_gates` to an [`Operation`](/docs/api/qiskit/qiskit.circuit.Operation "qiskit.circuit.Operation") object representing that gate/operation. By default, most standard gates names are mapped to the standard gate object from [`qiskit.circuit.library`](/docs/api/qiskit/circuit_library#module-qiskit.circuit.library "qiskit.circuit.library") this only needs to be specified if the input `basis_gates` defines gates in names outside that set.

**Returns**

the target built from the input configuration

**Return type**

[Target](#qiskit.transpiler.Target "qiskit.transpiler.Target")

**Raises**

- [**TranspilerError**](/docs/api/qiskit/transpiler#qiskit.transpiler.TranspilerError "qiskit.transpiler.TranspilerError") – If the input basis gates contain > 2 qubits and `coupling_map` is
- **specified.** –
- [**KeyError**](https://docs.python.org/3/library/exceptions.html#KeyError) – If no mapping is available for a specified `basis_gate`.

### gate\_has\_angle\_bounds

`gate_has_angle_bounds(name)`

Check if a specific gate gate has an angle bound set

**Parameters**

**name** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) – The instruction name to check if it has an angle bound set

**Returns**

This will return `True` if the gate is in the target and has angle bounds defined. It will return `False` if the gate does not have angle bounds defined or is not in the target.

**Return type**

[bool](https://docs.python.org/3/library/functions.html#bool)

### get

`get(key, default=None)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/transpiler/target.py#L697-L702)

Gets an item from the Target. If not found return a provided default or None.

### get\_non\_global\_operation\_names

`get_non_global_operation_names(strict_direction=False)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/transpiler/target.py#L323-L350)

Return the non-global operation names for the target

The non-global operations are those in the target which don’t apply on all qubits (for single qubit operations) or all multi-qubit qargs (for multi-qubit operations).

**Parameters**

**strict\_direction** ([*bool*](https://docs.python.org/3/library/functions.html#bool)) – If set to `True` the multi-qubit operations considered as non-global respect the strict direction (or order of qubits in the qargs is significant). For example, if `cx` is defined on `(0, 1)` and `ecr` is defined over `(1, 0)` by default neither would be considered non-global, but if `strict_direction` is set `True` both `cx` and `ecr` would be returned.

**Returns**

A list of operation names for operations that aren’t global in this target

**Return type**

List\[[str](https://docs.python.org/3/library/stdtypes.html#str)]

### has\_angle\_bounds

`has_angle_bounds()`

Check if there are any angle bounds set in the target

**Returns**

This will return `True` if there are angle bounds set on any instructions in the circuit

**Return type**

[bool](https://docs.python.org/3/library/functions.html#bool)

### instruction\_properties

`instruction_properties(index)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/transpiler/target.py#L545-L583)

Get the instruction properties for a specific instruction tuple

This method is to be used in conjunction with the [`instructions`](#qiskit.transpiler.Target.instructions "qiskit.transpiler.Target.instructions") attribute of a [`Target`](#qiskit.transpiler.Target "qiskit.transpiler.Target") object. You can use this method to quickly get the instruction properties for an element of [`instructions`](#qiskit.transpiler.Target.instructions "qiskit.transpiler.Target.instructions") by using the index in that list. However, if you’re not working with [`instructions`](#qiskit.transpiler.Target.instructions "qiskit.transpiler.Target.instructions") directly it is likely more efficient to access the target directly via the name and qubits to get the instruction properties. For example, if [`instructions`](#qiskit.transpiler.Target.instructions "qiskit.transpiler.Target.instructions") returned:

```python
[(XGate(), (0,)), (XGate(), (1,))]
```

you could get the properties of the `XGate` on qubit 1 with:

```python
props = target.instruction_properties(1)
```

but just accessing it directly via the name would be more efficient:

```python
props = target['x'][(1,)]
```

(assuming the `XGate`’s canonical name in the target is `'x'`) This is especially true for larger targets as this will scale worse with the number of instruction tuples in a target.

**Parameters**

**index** ([*int*](https://docs.python.org/3/library/functions.html#int)) – The index of the instruction tuple from the [`instructions`](#qiskit.transpiler.Target.instructions "qiskit.transpiler.Target.instructions") attribute. For, example if you want the properties from the third element in [`instructions`](#qiskit.transpiler.Target.instructions "qiskit.transpiler.Target.instructions") you would set this to be `2`.

**Returns**

The instruction properties for the specified instruction tuple

**Return type**

[InstructionProperties](/docs/api/qiskit/qiskit.transpiler.InstructionProperties "qiskit.transpiler.InstructionProperties")

### instruction\_supported

`instruction_supported(operation_name=None, qargs=Ellipsis, operation_class=None, parameters=None, check_angle_bounds=True)`

Return whether the instruction (operation + qubits) is supported by the target

**Parameters**

- **operation\_name** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) – The name of the operation for the instruction. Either this or `operation_class` must be specified, if both are specified `operation_class` will take priority and this argument will be ignored.

- **qargs** ([*tuple*](https://docs.python.org/3/library/stdtypes.html#tuple)) – The tuple of qubit indices for the instruction. If this is not specified then this method will return `True` if the specified operation is supported on any qubits. The typical application will always have this set (otherwise it’s the same as just checking if the target contains the operation). Normally you would not set this argument if you wanted to check more generally that the target supports an operation with the `parameters` on any qubits.

- **operation\_class** ([*Type*](/docs/api/qiskit/circuit_classical#qiskit.circuit.classical.types.Type "qiskit.circuit.classical.types.Type")*\[*[*qiskit.circuit.Instruction*](/docs/api/qiskit/qiskit.circuit.Instruction "qiskit.circuit.Instruction")*]*) – The operation class to check whether the target supports a particular operation by class rather than by name. This lookup is more expensive as it needs to iterate over all operations in the target instead of just a single lookup. If this is specified it will supersede the `operation_name` argument. The typical use case for this operation is to check whether a specific variant of an operation is supported on the backend. For example, if you wanted to check whether a [`RXGate`](/docs/api/qiskit/qiskit.circuit.library.RXGate "qiskit.circuit.library.RXGate") was supported on a specific qubit with a fixed angle. That fixed angle variant will typically have a name different from the object’s [`name`](/docs/api/qiskit/qiskit.circuit.Instruction#name "qiskit.circuit.Instruction.name") attribute (`"rx"`) in the target. This can be used to check if any instances of the class are available in such a case.

- **parameters** ([*list*](https://docs.python.org/3/library/stdtypes.html#list)) –

  A list of parameters to check if the target supports them on the specified qubits. If the instruction supports the parameter values specified in the list on the operation and qargs specified this will return `True` but if the parameters are not supported on the specified instruction it will return `False`. If this argument is not specified this method will return `True` if the instruction is supported independent of the instruction parameters. If specified with any [`Parameter`](/docs/api/qiskit/qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the list, that entry will be treated as supporting any value, however parameter names will not be checked (for example if an operation in the target is listed as parameterized with `"theta"` and `"phi"` is passed into this function that will return `True`). For example, if called with:

  ```python
  parameters = [Parameter("theta")]
  target.instruction_supported("rx", (0,), parameters=parameters)
  ```

  will return `True` if an [`RXGate`](/docs/api/qiskit/qiskit.circuit.library.RXGate "qiskit.circuit.library.RXGate") is supported on qubit 0 that will accept any parameter. If you need to check for a fixed numeric value parameter this argument is typically paired with the `operation_class` argument. For example:

  ```python
  target.instruction_supported("rx", (0,), RXGate, parameters=[pi / 4])
  ```

  will return `True` if an RXGate(pi/4) exists on qubit 0.

- **check\_angle\_bounds** ([*bool*](https://docs.python.org/3/library/functions.html#bool)) – If set to True (the default) the value of `parameters` will be validated against any angle bounds set in the target. If any of the values in `parameters` are set to be [`ParameterExpression`](/docs/api/qiskit/qiskit.circuit.ParameterExpression "qiskit.circuit.ParameterExpression") instances this flag will have no effect as angle bounds only impact non-parameterized operations in the circuit.

**Returns**

Returns `True` if the instruction is supported and `False` if it isn’t.

**Return type**

[bool](https://docs.python.org/3/library/functions.html#bool)

### items

`items()`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/transpiler/target.py#L718-L720)

Returns pairs of Gate names and its property map (str, dict\[tuple, InstructionProperties])

### keys

`keys()`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/transpiler/target.py#L710-L712)

Return the keys (operation\_names) of the Target

### operation\_from\_name

`operation_from_name(instruction)`

Get the operation class object for a given name

**Parameters**

**instruction** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) – The instruction name to get the [`Instruction`](/docs/api/qiskit/qiskit.circuit.Instruction "qiskit.circuit.Instruction") instance for

**Returns**

The Instruction instance corresponding to the name. This also can also be the class for globally defined variable with operations.

**Return type**

[qiskit.circuit.Instruction](/docs/api/qiskit/qiskit.circuit.Instruction "qiskit.circuit.Instruction")

### operation\_names\_for\_qargs

`operation_names_for_qargs(qargs, /)`

Get the operation names for a specified qargs tuple

**Parameters**

**qargs** ([*tuple*](https://docs.python.org/3/library/stdtypes.html#tuple)) – A `qargs` tuple of the qubits to get the gates that apply to it. For example, `(0,)` will return the set of all instructions that apply to qubit 0. If set to `None` this will return the names for any globally defined operations in the target.

**Returns**

The set of operation names that apply to the specified `qargs`.

**Return type**

[set](https://docs.python.org/3/library/stdtypes.html#set)

**Raises**

[**KeyError**](https://docs.python.org/3/library/exceptions.html#KeyError) – If `qargs` is not in target

### operations\_for\_qargs

`operations_for_qargs(qargs, /)`

Get the operation class object for a specified qargs tuple

**Parameters**

**qargs** ([*tuple*](https://docs.python.org/3/library/stdtypes.html#tuple)) – A qargs tuple of the qubits to get the gates that apply to it. For example, `(0,)` will return the set of all instructions that apply to qubit 0. If set to `None` this will return any globally defined operations in the target.

**Returns**

The list of [`Instruction`](/docs/api/qiskit/qiskit.circuit.Instruction "qiskit.circuit.Instruction") instances that apply to the specified qarg. This may also be a class if a variable width operation is globally defined.

**Return type**

[list](https://docs.python.org/3/library/stdtypes.html#list)

**Raises**

[**KeyError**](https://docs.python.org/3/library/exceptions.html#KeyError) – If qargs is not in target

### qargs\_for\_operation\_name

`qargs_for_operation_name(operation)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/transpiler/target.py#L486-L496)

Get the qargs for a given operation name

**Parameters**

**operation** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) – The operation name to get qargs for

**Returns**

The set of qargs the gate instance applies to.

**Return type**

[set](https://docs.python.org/3/library/stdtypes.html#set)

### seconds\_to\_dt

`seconds_to_dt(duration)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/transpiler/target.py#L771-L781)

Convert a given duration in seconds to units of dt

**Parameters**

**duration** ([*float*](https://docs.python.org/3/library/functions.html#float)) – The duration in seconds, such as in an [`InstructionProperties`](/docs/api/qiskit/qiskit.transpiler.InstructionProperties "qiskit.transpiler.InstructionProperties") field for an instruction in the target.

**Return type**

[int](https://docs.python.org/3/library/functions.html#int)

**Returns**

duration: The duration in units of dt

### supported\_angle\_bound

`supported_angle_bound(name, angles)`

Check that parameters on a specific gate conform to the angle bounds

**Parameters**

- **name** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) – The instruction name to check the angle bounds of
- **angles** ([*list*](https://docs.python.org/3/library/stdtypes.html#list)) – A list of float parameter values for `name` to see if they conform to the defined angle bounds.

**Returns**

Returns `True` if the parameter values specified are compatible with the angle bounds. `False` is returned if the any of the parameters are outside the defined bounds.

**Return type**

[bool](https://docs.python.org/3/library/functions.html#bool)

**Raises**

- [**TranspilerError**](/docs/api/qiskit/transpiler#qiskit.transpiler.TranspilerError "qiskit.transpiler.TranspilerError") – If `name` is not in the target or does not
- **have angle bounds defined.** –

### timing\_constraints

`timing_constraints()`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/transpiler/target.py#L515-L523)

Get an `TimingConstraints` object from the target

**Returns**

The timing constraints represented in the `Target`

**Return type**

TimingConstraints

### update\_instruction\_properties

`update_instruction_properties(instruction, qargs, properties)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/transpiler/target.py#L465-L484)

Update the property object for an instruction qarg pair already in the Target.

For ease of access, a user is able to obtain the mapping between an instruction’s applicable qargs and its instruction properties via the mapping protocol (using `__getitem__`), with the instruction’s name as the key. This method is the only way to modify/update the properties of an instruction in the `Target`. Usage of the mapping protocol for modifications is not supported.

**Parameters**

- **instruction** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) – The instruction name to update
- **qargs** ([*tuple*](https://docs.python.org/3/library/stdtypes.html#tuple)) – The qargs to update the properties of
- **properties** ([*InstructionProperties*](/docs/api/qiskit/qiskit.transpiler.InstructionProperties "qiskit.transpiler.InstructionProperties")) – The properties to set for this instruction

**Raises**

[**KeyError**](https://docs.python.org/3/library/exceptions.html#KeyError) – If `instruction` or `qarg` are not in the target

### values

`values()`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/transpiler/target.py#L714-L716)

Return the Property Map (qargs -> InstructionProperties) of every instruction in the Target

**Parameters**

- **description** ([*str*](https://docs.python.org/3/library/stdtypes.html#str) *| None*)
- **num\_qubits** ([*int*](https://docs.python.org/3/library/functions.html#int) *| None*)
- **dt** ([*float*](https://docs.python.org/3/library/functions.html#float) *| None*)
- **granularity** ([*int*](https://docs.python.org/3/library/functions.html#int))
- **min\_length** ([*int*](https://docs.python.org/3/library/functions.html#int))
- **pulse\_alignment** ([*int*](https://docs.python.org/3/library/functions.html#int))
- **acquire\_alignment** ([*int*](https://docs.python.org/3/library/functions.html#int))
- **qubit\_properties** ([*list*](https://docs.python.org/3/library/stdtypes.html#list) *| None*)
- **concurrent\_measurements** ([*list*](https://docs.python.org/3/library/stdtypes.html#list) *| None*)
