Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions qiskit/providers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@
deprecation is to give providers enough time to do their own deprecation of a
potential end user impacting change in a user facing part of the interface
prior to bumping their version. For example, let's say we changed the signature
to ``Backend.run()`` in ``BackendV34`` in a backwards incompatible way, before
Aer could update its :class:`~qiskit.providers.aer.aerbackend.AerBackend` class
to use version 34 they'd need to deprecate the old signature prior to switching
to ``Backend.run()`` in ``BackendV34`` in a backwards incompatible way. Before
Aer could update its :class:`~qiskit_aer.AerSimulator` class
to be based on version 34 they'd need to deprecate the old signature prior to switching
over. The changeover for Aer is not guaranteed to be lockstep with Terra so we
need to ensure there is a sufficient amount of time for Aer to complete its
deprecation cycle prior to removing version 33 (ie making version 34
Expand Down Expand Up @@ -734,13 +734,13 @@ def status(self):
-
* - ``backend.properties().readout_error(0)``
- ``backend.target["measure"][(0,)].error``
- In :obj:`~BackendV2` the error rate for the :class:`~qiskit.circuit.Measure`
- In :obj:`~BackendV2` the error rate for the :class:`~qiskit.circuit.library.Measure`
operation on a given qubit is used to model the readout error. However a
:obj:`~BackendV2` can implement multiple measurement types and list them
separately in a :class:`~qiskit.transpiler.Target`.
* - ``backend.properties().readout_length(0)``
- ``backend.target["measure"][(0,)].duration``
- In :obj:`~BackendV2` the duration for the :class:`~qiskit.circuit.Measure`
- In :obj:`~BackendV2` the duration for the :class:`~qiskit.circuit.library.Measure`
operation on a given qubit is used to model the readout length. However, a
:obj:`~BackendV2` can implement multiple measurement types and list them
separately in a :class:`~qiskit.transpiler.Target`.
Expand Down
47 changes: 31 additions & 16 deletions qiskit/providers/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ class BackendV1(Backend, ABC):
ease the transition for users and provider maintainers to the new versioned providers.
Expect, future versions of this abstract class to change the data model and
interface.

Subclasses of this should override the public method :meth:`run` and the internal
:meth:`_default_options`:

.. automethod:: _default_options
"""

version = 1
Expand Down Expand Up @@ -113,7 +118,6 @@ def _default_options(cls):
qiskit.providers.Options: A options object with
default values set
"""
pass

def set_options(self, **fields):
"""Set the options fields for the backend
Expand Down Expand Up @@ -217,7 +221,7 @@ class can handle either situation.

Args:
run_input (QuantumCircuit or Schedule or list): An individual or a
list of :class:`~qiskit.circuits.QuantumCircuit` or
list of :class:`~qiskit.circuit.QuantumCircuit` or
:class:`~qiskit.pulse.Schedule` objects to run on the backend.
For legacy providers migrating to the new versioned providers,
provider interface a :class:`~qiskit.qobj.QasmQobj` or
Expand Down Expand Up @@ -251,7 +255,7 @@ class QubitProperties:
__slots__ = ("t1", "t2", "frequency")

def __init__(self, t1=None, t2=None, frequency=None):
"""Create a new ``QubitProperties`` object
"""Create a new :class:`QubitProperties` object.

Args:
t1: The T1 time for a qubit in seconds
Expand Down Expand Up @@ -282,8 +286,8 @@ class BackendV2(Backend, ABC):
something like a ``shots`` field for a backend that runs experiments which
would contain an int for how many shots to execute.

If migrating a provider from :class:`~qiskit.providers.BackendV1` or
:class:`~qiskit.providers.BaseBackend` one thing to keep in mind is for
If migrating a provider from :class:`~qiskit.providers.BackendV1`
one thing to keep in mind is for
backwards compatibility you might need to add a configuration method that
will build a :class:`~qiskit.providers.models.BackendConfiguration` object
and :class:`~qiskit.providers.models.BackendProperties` from the attributes
Expand All @@ -308,6 +312,11 @@ class BackendV2(Backend, ABC):
that contains the custom compilation passes and then for the hook methods on
the backend object to return the plugin name so that :func:`~.transpile` will
use it by default when targetting the backend.

Subclasses of this should override the public method :meth:`run` and the internal
:meth:`_default_options`:

.. automethod:: _default_options
"""

version = 2
Expand Down Expand Up @@ -352,9 +361,15 @@ def __init__(
raise AttributeError("Options field %s is not valid for this backend" % field)
self._options.update_config(**fields)
self.name = name
"""Name of the backend."""
self.description = description
"""Optional human-readable description."""
self.online_date = online_date
"""Date that the backend came online."""
self.backend_version = backend_version
"""Version of the backend being provided. This is not the same as
:attr:`.BackendV2.version`, which is the version of the :class:`~.providers.Backend`
abstract interface."""
self._coupling_map = None

@property
Expand Down Expand Up @@ -432,8 +447,8 @@ def dt(self) -> Union[float, None]:
scheduling.

Returns:
dt: The input signal timestep in seconds. If the backend doesn't
define ``dt`` ``None`` will be returned
The input signal timestep in seconds. If the backend doesn't define ``dt``, ``None`` will
be returned.
"""
return self.target.dt

Expand All @@ -442,7 +457,7 @@ def dtm(self) -> float:
"""Return the system time resolution of output signals

Returns:
dtm: The output signal timestep in seconds.
The output signal timestep in seconds.

Raises:
NotImplementedError: if the backend doesn't support querying the
Expand All @@ -458,7 +473,7 @@ def meas_map(self) -> List[List[int]]:
scheduling.

Returns:
meas_map: The grouping of measurements which are multiplexed
The grouping of measurements which are multiplexed

Raises:
NotImplementedError: if the backend doesn't support querying the
Expand All @@ -482,12 +497,12 @@ def qubit_properties(

Args:
qubit: The qubit to get the
:class:`~qiskit.provider.QubitProperties` object for. This can
:class:`.QubitProperties` object for. This can
be a single integer for 1 qubit or a list of qubits and a list
of :class:`~qiskit.provider.QubitProperties` objects will be
of :class:`.QubitProperties` objects will be
returned in the same order
Returns:
qubit_properties: The :class:`~.QubitProperties` object for the
The :class:`~.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``.
Expand Down Expand Up @@ -623,15 +638,15 @@ class can handle either situation.

Args:
run_input (QuantumCircuit or Schedule or ScheduleBlock or list): An
individual or a list of
:class:`~qiskit.circuits.QuantumCircuit,
:class:`~qiskit.pulse.ScheduleBlock`, or
:class:`~qiskit.pulse.Schedule` objects to run on the backend.
individual or a list of :class:`.QuantumCircuit`,
:class:`~qiskit.pulse.ScheduleBlock`, or :class:`~qiskit.pulse.Schedule` objects to
run on the backend.
options: Any kwarg options to pass to the backend for running the
config. If a key is also present in the options
attribute/object then the expectation is that the value
specified will be used instead of what's set in the options
object.

Returns:
Job: The job object for the run
"""
Expand Down
2 changes: 1 addition & 1 deletion qiskit/providers/basicaer/basicaerjob.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def result(self, timeout=None):
"""Get job result .

Returns:
qiskit.Result: Result object
qiskit.result.Result: Result object
"""
if timeout is not None:
warnings.warn(
Expand Down
4 changes: 2 additions & 2 deletions qiskit/providers/basicaer/qasm_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ def _validate_measure_sampling(self, experiment):
"""Determine if measure sampling is allowed for an experiment

Args:
experiment (QobjExperiment): a qobj experiment.
experiment (QasmQobjExperiment): a qobj experiment.
"""
# If shots=1 we should disable measure sampling.
# This is also required for statevector simulator to return the
Expand Down Expand Up @@ -461,7 +461,7 @@ def run_experiment(self, experiment):
"""Run an experiment (circuit) and return a single experiment result.

Args:
experiment (QobjExperiment): experiment from qobj experiments list
experiment (QasmQobjExperiment): experiment from qobj experiments list

Returns:
dict: A result dictionary which looks something like::
Expand Down
6 changes: 3 additions & 3 deletions qiskit/providers/basicaer/unitary_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def run_experiment(self, experiment):
"""Run an experiment (circuit) and return a single experiment result.

Args:
experiment (QobjExperiment): experiment from qobj experiments list
experiment (QasmQobjExperiment): experiment from qobj experiments list

Returns:
dict: A result dictionary which looks something like::
Expand All @@ -312,8 +312,8 @@ def run_experiment(self, experiment):
}

Raises:
BasicAerError: if the number of qubits in the circuit is greater than 24.
Note that the practical qubit limit is much lower than 24.
BasicAerError: if the number of qubits in the circuit is greater than 24. Note that the
practical qubit limit is much lower than 24.
"""
start = time.time()
self._number_of_qubits = experiment.header.n_qubits
Expand Down
16 changes: 15 additions & 1 deletion qiskit/providers/fake_provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@
----------------

Fake V2 backends are fake backends with IBM Quantum systems snapshots implemented with
:mod:`~qiskit.providers.backend.BackendV2` interface.
:mod:`~qiskit.providers.backend.BackendV2` interface. They are all subclasses of
:class:`FakeBackendV2`.

.. autosummary::
:toctree: ../stubs/
Expand Down Expand Up @@ -224,13 +225,26 @@
FakeMumbaiFractionalCX
ConfigurableFakeBackend

Fake Backend Base Classes
=========================

The fake backends based on IBM hardware are based on a set of base classes:

.. currentmodule:: qiskit.providers.fake_provider.fake_backend
.. autoclass:: qiskit.providers.fake_provider.fake_backend.FakeBackendV2

.. currentmodule:: qiskit.providers.fake_provider
.. autoclass:: FakeBackend
.. autoclass:: FakeQasmBackend
.. autoclass:: FakePulseBackend
"""

# Fake job and qobj classes
from .fake_job import FakeJob
from .fake_qobj import FakeQobj

# Base classes for fake backends
from . import fake_backend
from .fake_backend import FakeBackend
from .fake_qasm_backend import FakeQasmBackend
from .fake_pulse_backend import FakePulseBackend
Expand Down
11 changes: 6 additions & 5 deletions qiskit/providers/fake_provider/fake_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def dtm(self) -> float:
"""Return the system time resolution of output signals

Returns:
dtm: The output signal timestep in seconds.
The output signal timestep in seconds.
"""
dtm = self._conf_dict.get("dtm")
if dtm is not None:
Expand All @@ -227,7 +227,7 @@ def meas_map(self) -> List[List[int]]:
scheduling.

Returns:
meas_map: The grouping of measurements which are multiplexed
The grouping of measurements which are multiplexed
"""
return self._conf_dict.get("meas_map")

Expand Down Expand Up @@ -316,19 +316,20 @@ def run(self, run_input, **options):
Args:
run_input (QuantumCircuit or Schedule or ScheduleBlock or list): An
individual or a list of
:class:`~qiskit.circuits.QuantumCircuit,
:class:`~qiskit.circuit.QuantumCircuit`,
:class:`~qiskit.pulse.ScheduleBlock`, or
:class:`~qiskit.pulse.Schedule` objects to run on the backend.
options: Any kwarg options to pass to the backend for running the
config. If a key is also present in the options
attribute/object then the expectation is that the value
specified will be used instead of what's set in the options
object.

Returns:
Job: The job object for the run

Raises:
QiskitError: If a pulse job is supplied and qiskit-aer is not
installed.
QiskitError: If a pulse job is supplied and qiskit-aer is not installed.
"""
circuits = run_input
pulse_job = None
Expand Down
4 changes: 3 additions & 1 deletion qiskit/providers/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
PulseDefaults
Command
JobStatus
GateProperties
Nduv
"""

from .backendconfiguration import (
Expand All @@ -44,7 +46,7 @@
UchannelLO,
GateConfig,
)
from .backendproperties import BackendProperties
from .backendproperties import BackendProperties, GateProperties, Nduv
from .backendstatus import BackendStatus
from .jobstatus import JobStatus
from .pulsedefaults import PulseDefaults, Command
4 changes: 2 additions & 2 deletions qiskit/providers/models/backendconfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def __init__(
backend is a simulator
credits_required (bool): True if backend requires credits to run a
job.
online_date (datetime): The date that the device went online
online_date (datetime.datetime): The date that the device went online
display_name (str): Alternate name field for the backend
description (str): A description for the backend
tags (list): A list of string tags to describe the backend
Expand Down Expand Up @@ -593,7 +593,7 @@ def __init__(
backend is a simulator
credits_required (bool): True if backend requires credits to run a
job.
online_date (datetime): The date that the device went online
online_date (datetime.datetime): The date that the device went online
display_name (str): Alternate name field for the backend
description (str): A description for the backend
tags (list): A list of string tags to describe the backend
Expand Down
Loading