Skip to main contentIBM Quantum Documentation
This page is from the dev version of Qiskit SDK. Go to the stable version

InstructionScheduleMap

class qiskit.pulse.InstructionScheduleMap

GitHub

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.

Deprecated since version 1.3

The class qiskit.pulse.instruction_schedule_map.InstructionScheduleMap is deprecated as of Qiskit 1.3. It will be removed in Qiskit 2.0. The entire Qiskit Pulse package is being deprecated and will be moved to the Qiskit Dynamics repository: https://github.com/qiskit-community/qiskit-dynamics


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.

Returns

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


Methods

add

add(instruction, qubits, schedule, arguments=None)

GitHub

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

Parameters

  • instruction (str |circuit.instruction.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.

Raises

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

Return type

None

assert_has

assert_has(instruction, qubits)

GitHub

Error if the given instruction is not defined.

Parameters

Raises

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

Return type

None

get

get(instruction, qubits, *params, **kwparams)

GitHub

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.

Parameters

Returns

The Schedule defined for the input.

Return type

Schedule | ScheduleBlock

get_parameters

get_parameters(instruction, qubits)

GitHub

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

Parameters

Returns

The names of the parameters required by the instruction.

Return type

tuple[str, …]

has

has(instruction, qubits)

GitHub

Is the instruction defined for the given qubits?

Parameters

Returns

True iff the instruction is defined.

Return type

bool

has_custom_gate

has_custom_gate()

GitHub

Return True if the map has user provided instruction.

Return type

bool

pop

pop(instruction, qubits, *params, **kwparams)

GitHub

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

Parameters

Returns

The Schedule defined for the input.

Return type

Schedule | ScheduleBlock

qubit_instructions

qubit_instructions(qubits)

GitHub

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

Parameters

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

Returns

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']).

Return type

list[str]

qubits_with_instruction

qubits_with_instruction(instruction)

GitHub

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.

Parameters

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

Returns

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.

Raises

PulseError – If the instruction is not found.

Return type

list[int | tuple[int, …]]

remove

remove(instruction, qubits)

GitHub

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

Parameters

Return type

None

Was this page helpful?
Report a bug or request content on GitHub.