PulseBackend

class PulseBackend(static_hamiltonian, hamiltonian_operators, static_dissipators=None, dt=1.0000000000000002e-10, solver_method='RK23', seed=0, atol=None, rtol=None, **kwargs)[source]

Abstract base class for pulse simulation backends in Qiskit Experiments.

This backend is designed for the tests in Qiskit Experiments as well as for the tutorials in Qiskit Experiments. The backend has a Qiskit Dynamics pulse simulator which allows it to simulate pulse schedules that are included in the calibrations attached to quantum circuits. In addition, sub-classes should implement a set of default schedules so that circuits that do not provide calibrations can also run, much like the hardware backends. In addition, the backends are also capable of simulating level- one (IQ data) and level-two (counts) data. Subclasses of these backends can have an optional discriminator so that they can produce counts based on sampled IQ data. If a discriminator is not provided then the counts will be produced from a statevector or density matrix.

Warning

Some of the functionality in this backend may move to Qiskit Dynamics and/or be refactored. These backends are not intended as a general pulse-simulator backend but rather to test the experiments and write short tutorials to demonstrate an experiment without having to run on hardware.

Initialize a backend with model information.

Parameters:
  • static_hamiltonian (ndarray) – Time-independent term in the Hamiltonian.

  • hamiltonian_operators (ndarray) – List of time-dependent operators

  • static_dissipators (ndarray | None) – Constant dissipation operators. Defaults to None.

  • dt (float) – Sample rate for simulating pulse schedules. Defaults to 0.1*1e-9.

  • solver_method – Numerical solver method to use. Check qiskit_dynamics for available methods. Defaults to “RK23”.

  • seed (int) – An optional seed given to the random number generator. If this argument is not set then the seed defaults to 0.

  • atol (float) – Absolute tolerance during solving.

  • rtol (float) – Relative tolerance during solving.

Attributes

coupling_map

Return the CouplingMap object

default_pulse_unitaries

Return the default unitary matrices of the backend.

discriminator

Return the discriminator for the IQ data.

dt

Return the system time resolution of input signals

This is required to be implemented if the backend supports Pulse scheduling.

Returns:

The input signal timestep in seconds. If the backend doesn’t define dt, None will be returned.

dtm

Return the system time resolution of output signals

Returns:

The output signal timestep in seconds.

Raises:

NotImplementedError – if the backend doesn’t support querying the output signal timestep

instruction_durations

Return the InstructionDurations object.

instruction_schedule_map

Return the InstructionScheduleMap for the instructions defined in this backend’s target.

instructions

A list of Instruction tuples on the backend of the form (instruction, (qubits)

max_circuits
meas_map

Return the grouping of measurements which are multiplexed

This is required to be implemented if the backend supports Pulse scheduling.

Returns:

The grouping of measurements which are multiplexed

Raises:

NotImplementedError – if the backend doesn’t support querying the measurement mapping

num_qubits

Return the number of qubits the backend has.

operation_names

A list of instruction names that the backend supports.

operations

A list of Instruction instances that the backend supports.

options

Return the options for the backend

The options of a backend are the dynamic parameters defining how the backend is used. These are used to control the run() method.

provider

Return the backend Provider.

Returns:

the Provider responsible for the backend.

Return type:

Provider

target

Contains information for circuit transpilation.

version = 2
description

Optional human-readable description.

online_date

Date that the backend came online.

backend_version

Version of the backend being provided. This is not the same as BackendV2.version, which is the version of the Backend abstract interface.

Methods

acquire_channel(qubit)

Return the acquisition channel for the given qubit.

This is required to be implemented if the backend supports Pulse scheduling.

Returns:

The Qubit measurement acquisition line.

Return type:

AcquireChannel

Raises:

NotImplementedError – if the backend doesn’t support querying the measurement mapping

control_channel(qubits)

Return the secondary drive channel for the given qubit

This is typically utilized for controlling multiqubit interactions. This channel is derived from other channels.

This is required to be implemented if the backend supports Pulse scheduling.

Parameters:

qubits (Iterable[int]) – Tuple or list of qubits of the form (control_qubit, target_qubit).

Returns:

The multi qubit control line.

Return type:

List[ControlChannel]

Raises:

NotImplementedError – if the backend doesn’t support querying the measurement mapping

defaults()[source]

return backend pulse defaults

drive_channel(qubit)

Return the drive channel for the given qubit.

This is required to be implemented if the backend supports Pulse scheduling.

Returns:

The Qubit drive channel

Return type:

DriveChannel

Raises:

NotImplementedError – if the backend doesn’t support querying the measurement mapping

measure_channel(qubit)

Return the measure stimulus channel for the given qubit.

This is required to be implemented if the backend supports Pulse scheduling.

Returns:

The Qubit measurement stimulus line

Return type:

MeasureChannel

Raises:

NotImplementedError – if the backend doesn’t support querying the measurement mapping

qubit_properties(qubit)

Return QubitProperties for a given qubit.

If there are no defined or the backend doesn’t support querying these details this method does not need to be implemented.

Parameters:

qubit (int | List[int]) – The qubit to get the QubitProperties object for. This can be a single integer for 1 qubit or a list of qubits and a list of QubitProperties objects will be returned in the same order

Returns:

The QubitProperties object for the specified qubit. If a list of qubits is provided a list will be returned. If properties are missing for a qubit this can be None.

Raises:

NotImplementedError – if the backend doesn’t support querying the qubit properties

Return type:

QubitProperties | List[QubitProperties]

run(run_input, **run_options)[source]

Run method takes circuits as input and returns FakeJob with IQ data or counts.

Parameters:
  • run_input (QuantumCircuit | List[QuantumCircuit]) – Circuits to run.

  • run_options – Any option that affects the way that the circuits are run. The options that are currently supported are shots, meas_level, meas_return, and memory.

Returns:

FakeJob with simulation data.

Return type:

FakeJob

set_options(**fields)

Set the options fields for the backend

This method is used to update the options of a backend. If you need to change any of the options prior to running just pass in the kwarg with the new value for the options.

Parameters:

fields – The fields to update the options

Raises:

AttributeError – If the field passed in is not part of the options

solve(schedule, qubits)[source]

Solves for qubit dynamics under the action of a pulse instruction

Parameters:
  • schedule (ScheduleBlock | Schedule) – Pulse signal

  • qubits (Tuple[int]) – (remove after multi-qubit gates is implemented)

Returns:

Time-evolution unitary operator

Return type:

ndarray