InstructionScheduleMap#

class qiskit.pulse.InstructionScheduleMap[código fonte]#

Bases: object

Mapping from QuantumCircuit qiskit.circuit.Instruction names and qubits to Schedule s. In particular, the mapping is formatted as type:

Dict[str, Dict[Tuple[int], Schedule]]

where the first key is the name of a circuit instruction (e.g. 'u1', 'measure'), the second key is a tuple of qubit indices, and the final value is a Schedule implementing the requested instruction.

These can usually be seen as gate calibrations.

Initialize a circuit instruction to schedule mapper instance.

Attributes

instructions#

Return all instructions which have definitions.

By default, these are typically the basis gates along with other instructions such as measure and reset.

Retorno:

The names of all the circuit instructions which have Schedule definitions in this.

Methods

add(instruction, qubits, schedule, arguments=None)[código fonte]#

Add a new known instruction for the given qubits and its mapping to a pulse schedule.

Parâmetros:
  • instruction (str | Instruction) – The name of the instruction to add.

  • qubits (int | Iterable[int]) – The qubits which the instruction applies to.

  • schedule (Schedule | ScheduleBlock | Callable[[...], Schedule | ScheduleBlock]) – The Schedule that implements the given instruction.

  • arguments (List[str] | None) – List of parameter names to create a parameter-bound schedule from the associated gate instruction. If get() is called with arguments rather than keyword arguments, this parameter list is used to map the input arguments to parameter objects stored in the target schedule.

Levanta:

PulseError – If the qubits are provided as an empty iterable.

assert_has(instruction, qubits)[código fonte]#

Error if the given instruction is not defined.

Parâmetros:
  • instruction (str | Instruction) – The instruction for which to look.

  • qubits (int | Iterable[int]) – The specific qubits for the instruction.

Levanta:

PulseError – If the instruction is not defined on the qubits.

get(instruction, qubits, *params, **kwparams)[código fonte]#

Return the defined Schedule or ScheduleBlock for the given instruction on the given qubits.

If all keys are not specified this method returns schedule with unbound parameters.

Parâmetros:
Retorno:

The Schedule defined for the input.

Tipo de retorno:

Schedule | ScheduleBlock

get_parameters(instruction, qubits)[código fonte]#

Return the list of parameters taken by the given instruction on the given qubits.

Parâmetros:
Retorno:

The names of the parameters required by the instruction.

Tipo de retorno:

Tuple[str]

has(instruction, qubits)[código fonte]#

Is the instruction defined for the given qubits?

Parâmetros:
  • instruction (str | Instruction) – The instruction for which to look.

  • qubits (int | Iterable[int]) – The specific qubits for the instruction.

Retorno:

True iff the instruction is defined.

Tipo de retorno:

bool

has_custom_gate()[código fonte]#

Return True if the map has user provided instruction.

Tipo de retorno:

bool

pop(instruction, qubits, *params, **kwparams)[código fonte]#

Remove and return the defined schedule for the given instruction on the given qubits.

Parâmetros:
Retorno:

The Schedule defined for the input.

Tipo de retorno:

Schedule | ScheduleBlock

qubit_instructions(qubits)[código fonte]#

Return a list of the instruction names that are defined by the backend for the given qubit or qubits.

Parâmetros:

qubits (int | Iterable[int]) – A qubit index, or a list or tuple of indices.

Retorno:

All the instructions which are defined on the qubits.

For 1 qubit, all the 1Q instructions defined. For multiple qubits, all the instructions which apply to that whole set of qubits (e.g. qubits=[0, 1] may return ['cx']).

Tipo de retorno:

List[str]

qubits_with_instruction(instruction)[código fonte]#

Return a list of the qubits for which the given instruction is defined. Single qubit instructions return a flat list, and multiqubit instructions return a list of ordered tuples.

Parâmetros:

instruction (str | Instruction) – The name of the circuit instruction.

Retorno:

Qubit indices which have the given instruction defined. This is a list of tuples if the instruction has an arity greater than 1, or a flat list of ints otherwise.

Levanta:

PulseError – If the instruction is not found.

Tipo de retorno:

List[int | Tuple[int]]

remove(instruction, qubits)[código fonte]#

Remove the given instruction from the listing of instructions defined in self.

Parâmetros:
  • instruction (str | Instruction) – The name of the instruction to add.

  • qubits (int | Iterable[int]) – The qubits which the instruction applies to.