qiskit-documentation/docs/api/qiskit/0.25/qiskit.providers.BackendV1.mdx

182 lines
9.6 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: BackendV1
description: API reference for qiskit.providers.BackendV1
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.providers.BackendV1
---
# qiskit.providers.BackendV1
<Class id="qiskit.providers.BackendV1" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.17/qiskit/providers/backend.py" signature="BackendV1(configuration, provider=None, **fields)" modifiers="class">
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`](qiskit.providers.models.BackendProperties "qiskit.providers.models.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`](qiskit.providers.models.BackendProperties "qiskit.providers.models.BackendProperties") and [`BackendConfiguration`](qiskit.providers.models.BackendConfiguration "qiskit.providers.models.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
**Parameters**
* **configuration** ([*BackendConfiguration*](qiskit.providers.models.BackendConfiguration "qiskit.providers.models.BackendConfiguration")) A backend configuration object for the backend object.
* **provider** ([*qiskit.providers.Provider*](qiskit.providers.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.
**Raises**
**AttributeError** if input field not a valid options
### \_\_init\_\_
<Function id="qiskit.providers.BackendV1.__init__" signature="__init__(configuration, provider=None, **fields)">
Initialize a backend class
**Parameters**
* **configuration** ([*BackendConfiguration*](qiskit.providers.models.BackendConfiguration "qiskit.providers.models.BackendConfiguration")) A backend configuration object for the backend object.
* **provider** ([*qiskit.providers.Provider*](qiskit.providers.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.
**Raises**
**AttributeError** if input field not a valid options
</Function>
## Methods
| | |
| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------- |
| [`__init__`](#qiskit.providers.BackendV1.__init__ "qiskit.providers.BackendV1.__init__")(configuration\[, provider]) | Initialize a backend class |
| [`configuration`](#qiskit.providers.BackendV1.configuration "qiskit.providers.BackendV1.configuration")() | Return the backend configuration. |
| [`name`](#qiskit.providers.BackendV1.name "qiskit.providers.BackendV1.name")() | Return the backend name. |
| [`properties`](#qiskit.providers.BackendV1.properties "qiskit.providers.BackendV1.properties")() | Return the backend properties. |
| [`provider`](#qiskit.providers.BackendV1.provider "qiskit.providers.BackendV1.provider")() | Return the backend Provider. |
| [`run`](#qiskit.providers.BackendV1.run "qiskit.providers.BackendV1.run")(run\_input, \*\*options) | Run on the backend. |
| [`set_options`](#qiskit.providers.BackendV1.set_options "qiskit.providers.BackendV1.set_options")(\*\*fields) | Set the options fields for the backend |
| [`status`](#qiskit.providers.BackendV1.status "qiskit.providers.BackendV1.status")() | Return the backend status. |
## Attributes
| | |
| ------------------------------------------------------------------------------------- | ---------------------------------- |
| [`options`](#qiskit.providers.BackendV1.options "qiskit.providers.BackendV1.options") | Return the options for the backend |
| `version` | |
### configuration
<Function id="qiskit.providers.BackendV1.configuration" signature="configuration()">
Return the backend configuration.
**Returns**
the configuration for the backend.
**Return type**
[BackendConfiguration](qiskit.providers.models.BackendConfiguration "qiskit.providers.models.BackendConfiguration")
</Function>
### name
<Function id="qiskit.providers.BackendV1.name" signature="name()">
Return the backend name.
**Returns**
the name of the backend.
**Return type**
str
</Function>
### options
<Attribute id="qiskit.providers.BackendV1.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()`](#qiskit.providers.BackendV1.run "qiskit.providers.BackendV1.run") method.
</Attribute>
### properties
<Function id="qiskit.providers.BackendV1.properties" signature="properties()">
Return the backend properties.
**Returns**
the configuration for the backend. If the backend does not support properties, it returns `None`.
**Return type**
[BackendProperties](qiskit.providers.models.BackendProperties "qiskit.providers.models.BackendProperties")
</Function>
### provider
<Function id="qiskit.providers.BackendV1.provider" signature="provider()">
Return the backend Provider.
**Returns**
the Provider responsible for the backend.
**Return type**
[Provider](qiskit.providers.Provider "qiskit.providers.Provider")
</Function>
### run
<Function id="qiskit.providers.BackendV1.run" signature="run(run_input, **options)" modifiers="abstract">
Run on the backend.
This method that will return a [`Job`](qiskit.providers.Job "qiskit.providers.Job") object that run circuits. Depending on the backend this may be either an async or sync call. It is 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.
**Parameters**
* **run\_input** ([*QuantumCircuit*](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") *or*[*Schedule*](qiskit.pulse.Schedule "qiskit.pulse.Schedule") *or list*) An individual or a list of `QuantumCircuit` or [`Schedule`](qiskit.pulse.Schedule "qiskit.pulse.Schedule") objects to run on the backend. For legacy providers migrating to the new versioned providers, provider interface a [`QasmQobj`](qiskit.qobj.QasmQobj "qiskit.qobj.QasmQobj") or [`PulseQobj`](qiskit.qobj.PulseQobj "qiskit.qobj.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`](qobj#module-qiskit.qobj "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 whats set in the options object.
**Returns**
The job object for the run
**Return type**
[Job](qiskit.providers.Job "qiskit.providers.Job")
</Function>
### set\_options
<Function id="qiskit.providers.BackendV1.set_options" signature="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
</Function>
### status
<Function id="qiskit.providers.BackendV1.status" signature="status()">
Return the backend status.
**Returns**
the status of the backend.
**Return type**
[BackendStatus](qiskit.providers.models.BackendStatus "qiskit.providers.models.BackendStatus")
</Function>
</Class>