BackendV1#

class qiskit.providers.BackendV1(configuration, provider=None, **fields)[ソース]#

ベースクラス: Backend, ABC

Abstract class for Backends

This abstract class is to be used for all Backend objects created by a provider. There are several classes of information contained in a Backend. The first are the attributes of the class itself. These should be used to defined the immutable characteristics of the backend. The options attribute of the backend is used to contain the dynamic user configurable options of the backend. It should be used more for runtime options that configure how the backend is used. For example, something like a shots field for a backend that runs experiments which would contain an int for how many shots to execute. The properties attribute is optionally defined BackendProperties object and is used to return measured properties, or properties of a backend that may change over time. The simplest example of this would be a version string, which will change as a backend is updated, but also could be something like noise parameters for backends that run experiments.

This first version of the Backend abstract class is written to be mostly backwards compatible with the legacy providers interface. This includes reusing the model objects BackendProperties and BackendConfiguration. This was done to 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.

Initialize a backend class

パラメータ:
  • configuration (BackendConfiguration) – A backend configuration object for the backend object.

  • provider (qiskit.providers.Provider) – Optionally, the provider object that this Backend comes from.

  • fields – kwargs for the values to use to override the default options.

例外:

AttributeError – if input field not a valid options

In addition to the public abstract methods, subclasses should also implement the following private methods:

abstract classmethod _default_options()[ソース]

Return the default options

This method will return a qiskit.providers.Options subclass object that will be used for the default options. These should be the default parameters to use for the options of the backend.

戻り値:

A options object with

default values set

戻り値の型:

qiskit.providers.Options

Attributes

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.

version = 1#

Methods

configuration()[ソース]#

Return the backend configuration.

戻り値:

the configuration for the backend.

戻り値の型:

BackendConfiguration

name()[ソース]#

Return the backend name.

戻り値:

the name of the backend.

戻り値の型:

str

properties()[ソース]#

Return the backend properties.

戻り値:

the configuration for the backend. If the backend does not support properties, it returns None.

戻り値の型:

BackendProperties

provider()[ソース]#

Return the backend Provider.

戻り値:

the Provider responsible for the backend.

戻り値の型:

Provider

abstract run(run_input, **options)[ソース]#

Run on the backend.

This method returns a Job object that runs circuits. Depending on the backend this may be either an async or sync call. It is at the discretion of the provider to decide whether running should block until the execution is finished or not: the Job class can handle either situation.

パラメータ:
  • run_input (QuantumCircuit or Schedule or list) – An individual or a list of QuantumCircuit or Schedule objects to run on the backend. For legacy providers migrating to the new versioned providers, provider interface a QasmQobj or PulseQobj objects should probably be supported too (but deprecated) for backwards compatibility. Be sure to update the docstrings of subclasses implementing this method to document that. New provider implementations should not do this though as qiskit.qobj will be deprecated and removed along with the legacy providers interface.

  • 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.

戻り値:

The job object for the run

戻り値の型:

Job

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.

パラメータ:

fields – The fields to update the options

例外:

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

status()[ソース]#

Return the backend status.

戻り値:

the status of the backend.

戻り値の型:

BackendStatus