qiskit.transpiler.Target.from_configuration¶
- classmethod Target.from_configuration(basis_gates, num_qubits=None, coupling_map=None, inst_map=None, backend_properties=None, instruction_durations=None, dt=None, timing_constraints=None, custom_name_mapping=None)[source]¶
Create a target object from the individual global configuration
Prior to the creation of the
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 theTarget
. This function provides a simple interface to convert those separate objects to aTarget
.This constructor will use the input from
basis_gates
,num_qubits
, andcoupling_map
to build a base model of the backend and theinstruction_durations
,backend_properties
, andinst_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 ininstruction_durations
,backend_properties
, orinst_map
will be ignored.- Parameters
basis_gates (List[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 :func:~.get_standard_gate_name_mapping` or present in the specified
custom_name_mapping
argument.num_qubits (Optional[int]) – The number of qubits supported on the backend.
coupling_map (Optional[CouplingMap]) – 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).inst_map (Optional[InstructionScheduleMap]) – The instruction schedule map representing the pulse
Schedule
definitions for each instruction. If this is specifiedcoupling_map
must be specified. Thecoupling_map
is used as the source of truth for connectivity and ifinst_map
is used the schedule is looked up based on the instuctions from the pair ofbasis_gates
andcoupling_map
. If you want to define a custom gate for a particular qubit or qubit pair, you can manually buildTarget
.backend_properties (Optional[BackendProperties]) – The
BackendProperties
object which is used for instruction properties and qubit properties. If specified and instruction properties are intended to be used then thecoupling_map
argument must be specified. This is only used to lookup error rates and durations (unlessinstruction_durations
is specified which would take precedence) for instructions specified viacoupling_map
andbasis_gates
.instruction_durations (Optional[InstructionDurations]) – Optional instruction durations for instructions. If specified it will take priority for setting the
duration
field in theInstructionProperties
objects for the instructions in the target.dt (Optional[float]) – The system time resolution of input signals in seconds
timing_constraints (Optional[TimingConstraints]) – Optional timing constraints to include in the
Target
custom_name_mapping (Optional[Dict[str, Any]]) – An optional dictionary that maps custom gate/operation names in
basis_gates
to anOperation
object representing that gate/operation. By default most standard gates names are mapped to the standard gate object fromqiskit.circuit.library
this only needs to be specified if the inputbasis_gates
defines gates in names outside that set.
- Returns
the target built from the input configuration
- Return type
- Raises
TranspilerError – If the input basis gates contain > 2 qubits and
coupling_map
isspecified. –
KeyError – If no mappign is available for a specified
basis_gate
.