Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update API dev docs #2422

Merged
merged 1 commit into from
Dec 3, 2024
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 9 additions & 5 deletions docs/api/qiskit-ibm-runtime/dev/fake_provider.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,19 @@ circuit.cx(0,1)
circuit.cx(0,2)
circuit.measure_all()
circuit.draw('mpl', style="iqp")
```

![../\_images/fake\_provider-1.png](/images/api/qiskit-ibm-runtime/dev/fake_provider-1.png)

```python
# Transpile the ideal circuit to a circuit that can be directly executed by the backend
transpiled_circuit = transpile(circuit, backend)
transpiled_circuit.draw('mpl', style="iqp")
```

![../\_images/fake\_provider-2.png](/images/api/qiskit-ibm-runtime/dev/fake_provider-2.png)

```python
# Run the transpiled circuit using the simulated fake backend
sampler = SamplerV2(backend)
job = sampler.run([transpiled_circuit])
Expand All @@ -52,11 +60,7 @@ counts = pub_result.data.meas.get_counts()
plot_histogram(counts)
```

![../\_images/fake\_provider-1\_00.png](/images/api/qiskit-ibm-runtime/dev/fake_provider-1_00.png)

![../\_images/fake\_provider-1\_01.png](/images/api/qiskit-ibm-runtime/dev/fake_provider-1_01.png)

![../\_images/fake\_provider-1\_02.png](/images/api/qiskit-ibm-runtime/dev/fake_provider-1_02.png)
![../\_images/fake\_provider-3.png](/images/api/qiskit-ibm-runtime/dev/fake_provider-3.png)

<Admonition title="Important" type="danger">
Please note that the simulation is done using a noise model generated from system snapshots obtained in the past (sometimes a few years ago) and the results are not representative of the latest behaviours of the real quantum system which the fake backend is mimicking. If you want to run noisy simulations to compare with the real quantum system, you should use the `qiskit_aer` library. After installation, you can follow the steps below to generate a simulator that mimics a real quantum system with the latest calibration results.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ python_api_name: qiskit_ibm_runtime.Batch

**Parameters**

* **backend** ([*BackendV1*](/api/qiskit/qiskit.providers.BackendV1 "(in Qiskit v1.2)") *|*[*BackendV2*](/api/qiskit/qiskit.providers.BackendV2 "(in Qiskit v1.2)") *| None*) – Instance of `Backend` class.
* **backend** ([*BackendV1*](/api/qiskit/qiskit.providers.BackendV1 "(in Qiskit v1.3)") *|*[*BackendV2*](/api/qiskit/qiskit.providers.BackendV2 "(in Qiskit v1.3)") *| None*) – Instance of `Backend` class.
* **max\_time** (*int | str | None*) – Maximum amount of time a runtime session can be open before being forcibly closed. Can be specified as seconds (int) or a string like “2h 30m 40s”. This value must be less than the [system imposed maximum](/guides/max-execution-time).

**Raises**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ python_api_name: qiskit_ibm_runtime.EstimatorV2
# EstimatorV2

<Class id="qiskit_ibm_runtime.EstimatorV2" isDedicatedPage={true} github="https://github.com/Qiskit/qiskit-ibm-runtime/tree/main/qiskit_ibm_runtime/estimator.py#L44-L173" signature="EstimatorV2(mode=None, options=None)" modifiers="class">
Bases: `BasePrimitiveV2`\[[`EstimatorOptions`](qiskit_ibm_runtime.options.EstimatorOptions "qiskit_ibm_runtime.options.estimator_options.EstimatorOptions")], `Estimator`, [`BaseEstimatorV2`](/api/qiskit/qiskit.primitives.BaseEstimatorV2 "(in Qiskit v1.2)")
Bases: `BasePrimitiveV2`\[[`EstimatorOptions`](qiskit_ibm_runtime.options.EstimatorOptions "qiskit_ibm_runtime.options.estimator_options.EstimatorOptions")], `Estimator`, [`BaseEstimatorV2`](/api/qiskit/qiskit.primitives.BaseEstimatorV2 "(in Qiskit v1.3)")

Class for interacting with Qiskit Runtime Estimator primitive service.

Expand All @@ -19,7 +19,7 @@ python_api_name: qiskit_ibm_runtime.EstimatorV2

Following construction, an estimator is used by calling its [`run()`](#qiskit_ibm_runtime.EstimatorV2.run "qiskit_ibm_runtime.EstimatorV2.run") method with a list of PUBs (Primitive Unified Blocs). Each PUB contains four values that, together, define a computation unit of work for the estimator to complete:

* a single [`QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.2)"), possibly parametrized, whose final state we define as $\psi(\theta)$,
* a single [`QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.3)"), possibly parametrized, whose final state we define as $\psi(\theta)$,
* one or more observables (specified as any `ObservablesArrayLike`, including `Pauli`, `SparsePauliOp`, `str`) that specify which expectation values to estimate, denoted $H_j$, and
* a collection parameter value sets to bind the circuit against, $\theta_k$.
* an optional target precision for expectation value estimates.
Expand Down
30 changes: 17 additions & 13 deletions docs/api/qiskit-ibm-runtime/dev/qiskit_ibm_runtime.IBMBackend.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ python_api_name: qiskit_ibm_runtime.IBMBackend
# IBMBackend

<Class id="qiskit_ibm_runtime.IBMBackend" isDedicatedPage={true} github="https://github.com/Qiskit/qiskit-ibm-runtime/tree/main/qiskit_ibm_runtime/ibm_backend.py#L75-L914" signature="IBMBackend(configuration, service, api_client, instance=None)" modifiers="class">
Bases: [`BackendV2`](/api/qiskit/qiskit.providers.BackendV2 "(in Qiskit v1.2)")
Bases: [`BackendV2`](/api/qiskit/qiskit.providers.BackendV2 "(in Qiskit v1.3)")

Backend class interfacing with an IBM Quantum backend.

Expand All @@ -33,7 +33,7 @@ python_api_name: qiskit_ibm_runtime.IBMBackend
>
> * num\_qubits: number of qubits.
>
> * target: A [`qiskit.transpiler.Target`](/api/qiskit/qiskit.transpiler.Target "(in Qiskit v1.2)") object for the backend.
> * target: A [`qiskit.transpiler.Target`](/api/qiskit/qiskit.transpiler.Target "(in Qiskit v1.3)") object for the backend.
>
> * basis\_gates: list of basis gates names on the backend.
>
Expand Down Expand Up @@ -137,7 +137,7 @@ python_api_name: qiskit_ibm_runtime.IBMBackend
### coupling\_map

<Attribute id="qiskit_ibm_runtime.IBMBackend.coupling_map">
Return the [`CouplingMap`](/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v1.2)") object
Return the [`CouplingMap`](/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v1.3)") object
</Attribute>

### dt
Expand Down Expand Up @@ -173,13 +173,17 @@ python_api_name: qiskit_ibm_runtime.IBMBackend
### instruction\_durations

<Attribute id="qiskit_ibm_runtime.IBMBackend.instruction_durations">
Return the [`InstructionDurations`](/api/qiskit/qiskit.transpiler.InstructionDurations "(in Qiskit v1.2)") object.
Return the [`InstructionDurations`](/api/qiskit/qiskit.transpiler.InstructionDurations "(in Qiskit v1.3)") object.
</Attribute>

### instruction\_schedule\_map

<Attribute id="qiskit_ibm_runtime.IBMBackend.instruction_schedule_map">
Return the [`InstructionScheduleMap`](/api/qiskit/qiskit.pulse.InstructionScheduleMap "(in Qiskit v1.2)") for the instructions defined in this backend’s target.
Return the [`InstructionScheduleMap`](/api/qiskit/qiskit.pulse.InstructionScheduleMap "(in Qiskit v1.3)") for the instructions defined in this backend’s target.

<Admonition title="Deprecated since version 1.3" type="danger">
The property `qiskit.providers.backend.BackendV2.instruction_schedule_map` 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](https://github.com/qiskit-community/qiskit-dynamics). Note that once removed, `qiskit.providers.backend.BackendV2.instruction_schedule_map` will have no alternative in Qiskit.
</Admonition>
</Attribute>

### instructions
Expand Down Expand Up @@ -227,7 +231,7 @@ python_api_name: qiskit_ibm_runtime.IBMBackend
### operations

<Attribute id="qiskit_ibm_runtime.IBMBackend.operations">
A list of [`Instruction`](/api/qiskit/qiskit.circuit.Instruction "(in Qiskit v1.2)") instances that the backend supports.
A list of [`Instruction`](/api/qiskit/qiskit.circuit.Instruction "(in Qiskit v1.3)") instances that the backend supports.
</Attribute>

### options
Expand Down Expand Up @@ -275,7 +279,7 @@ python_api_name: qiskit_ibm_runtime.IBMBackend
### target

<Attribute id="qiskit_ibm_runtime.IBMBackend.target">
A [`qiskit.transpiler.Target`](/api/qiskit/qiskit.transpiler.Target "(in Qiskit v1.2)") object for the backend.
A [`qiskit.transpiler.Target`](/api/qiskit/qiskit.transpiler.Target "(in Qiskit v1.3)") object for the backend.

**Returns**

Expand Down Expand Up @@ -357,7 +361,7 @@ python_api_name: qiskit_ibm_runtime.IBMBackend

**Parameters**

**circuit** ([*QuantumCircuit*](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.2)")) – Circuit to check.
**circuit** ([*QuantumCircuit*](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.3)")) – Circuit to check.

**Raises**

Expand Down Expand Up @@ -557,7 +561,7 @@ python_api_name: qiskit_ibm_runtime.IBMBackend

**Return type**

[*QubitProperties*](/api/qiskit/qiskit.providers.QubitProperties "(in Qiskit v1.2)") | *List*\[[*QubitProperties*](/api/qiskit/qiskit.providers.QubitProperties "(in Qiskit v1.2)")]
[*QubitProperties*](/api/qiskit/qiskit.providers.QubitProperties "(in Qiskit v1.3)") | *List*\[[*QubitProperties*](/api/qiskit/qiskit.providers.QubitProperties "(in Qiskit v1.3)")]
</Function>

### refresh
Expand All @@ -577,13 +581,13 @@ python_api_name: qiskit_ibm_runtime.IBMBackend

**Parameters**

* **circuits** ([*QuantumCircuit*](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.2)") *| str | List\[*[*QuantumCircuit*](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.2)") *| str]*) – An individual or a list of `QuantumCircuit`.
* **circuits** ([*QuantumCircuit*](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.3)") *| str | List\[*[*QuantumCircuit*](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.3)") *| str]*) – An individual or a list of `QuantumCircuit`.

* **dynamic** (*bool | None*) – Whether the circuit is dynamic (uses in-circuit conditionals)

* **job\_tags** (*List\[str] | None*) – Tags to be assigned to the job. The tags can subsequently be used as a filter in the `jobs()` function call.

* **init\_circuit** ([*QuantumCircuit*](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.2)") *| None*) – A quantum circuit to execute for initializing qubits before each circuit. If specified, `init_num_resets` is ignored. Applicable only if `dynamic=True` is specified.
* **init\_circuit** ([*QuantumCircuit*](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.3)") *| None*) – A quantum circuit to execute for initializing qubits before each circuit. If specified, `init_num_resets` is ignored. Applicable only if `dynamic=True` is specified.

* **init\_num\_resets** (*int | None*) – The number of qubit resets to insert before each circuit execution.

Expand Down Expand Up @@ -684,7 +688,7 @@ python_api_name: qiskit_ibm_runtime.IBMBackend
### target\_history

<Function id="qiskit_ibm_runtime.IBMBackend.target_history" github="https://github.com/Qiskit/qiskit-ibm-runtime/tree/main/qiskit_ibm_runtime/ibm_backend.py#L322-L334" signature="target_history(datetime=None)">
A [`qiskit.transpiler.Target`](/api/qiskit/qiskit.transpiler.Target "(in Qiskit v1.2)") object for the backend.
A [`qiskit.transpiler.Target`](/api/qiskit/qiskit.transpiler.Target "(in Qiskit v1.3)") object for the backend.

**Returns**

Expand All @@ -696,7 +700,7 @@ python_api_name: qiskit_ibm_runtime.IBMBackend

**Return type**

[*Target*](/api/qiskit/qiskit.transpiler.Target "(in Qiskit v1.2)")
[*Target*](/api/qiskit/qiskit.transpiler.Target "(in Qiskit v1.3)")
</Function>
</Class>

Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ python_api_name: qiskit_ibm_runtime.RuntimeJob
# RuntimeJob

<Class id="qiskit_ibm_runtime.RuntimeJob" isDedicatedPage={true} github="https://github.com/Qiskit/qiskit-ibm-runtime/tree/main/qiskit_ibm_runtime/runtime_job.py#L47-L368" signature="RuntimeJob(backend, api_client, client_params, job_id, program_id, service, creation_date=None, user_callback=None, result_decoder=None, image='', session_id=None, tags=None, version=None)" modifiers="class">
Bases: [`JobV1`](/api/qiskit/qiskit.providers.JobV1 "(in Qiskit v1.2)"), `BaseRuntimeJob`
Bases: [`JobV1`](/api/qiskit/qiskit.providers.JobV1 "(in Qiskit v1.3)"), `BaseRuntimeJob`

Representation of a runtime primitive execution.

A new `RuntimeJob` instance is returned when you call `QiskitRuntimeService.run` to execute a runtime primitive, or [`QiskitRuntimeService.job`](qiskit_ibm_runtime.QiskitRuntimeService#job "qiskit_ibm_runtime.QiskitRuntimeService.job") to retrieve a previously executed job.

If the primitive execution is successful, you can inspect the job’s status by calling [`status()`](#qiskit_ibm_runtime.RuntimeJob.status "qiskit_ibm_runtime.RuntimeJob.status"). Job status can be one of the [`JobStatus`](/api/qiskit/qiskit.providers.JobStatus "(in Qiskit v1.2)") members.
If the primitive execution is successful, you can inspect the job’s status by calling [`status()`](#qiskit_ibm_runtime.RuntimeJob.status "qiskit_ibm_runtime.RuntimeJob.status"). Job status can be one of the [`JobStatus`](/api/qiskit/qiskit.providers.JobStatus "(in Qiskit v1.3)") members.

Some of the methods in this class are blocking, which means control may not be returned immediately. [`result()`](#qiskit_ibm_runtime.RuntimeJob.result "qiskit_ibm_runtime.RuntimeJob.result") is an example of a blocking method:

Expand All @@ -35,7 +35,7 @@ python_api_name: qiskit_ibm_runtime.RuntimeJob

**Parameters**

* **backend** ([*Backend*](/api/qiskit/qiskit.providers.Backend "(in Qiskit v1.2)")) – The backend instance used to run this job.
* **backend** ([*Backend*](/api/qiskit/qiskit.providers.Backend "(in Qiskit v1.3)")) – The backend instance used to run this job.
* **api\_client** (*RuntimeClient*) – Object for connecting to the server.
* **client\_params** (*ClientParameters*) – Parameters used for server connection.
* **job\_id** (*str*) – Job ID.
Expand Down Expand Up @@ -156,7 +156,7 @@ python_api_name: qiskit_ibm_runtime.RuntimeJob

**Return type**

[*Backend*](/api/qiskit/qiskit.providers.Backend "(in Qiskit v1.2)") | None
[*Backend*](/api/qiskit/qiskit.providers.Backend "(in Qiskit v1.3)") | None
</Function>

### cancel
Expand Down Expand Up @@ -398,7 +398,7 @@ python_api_name: qiskit_ibm_runtime.RuntimeJob

**Return type**

[*JobStatus*](/api/qiskit/qiskit.providers.JobStatus "(in Qiskit v1.2)")
[*JobStatus*](/api/qiskit/qiskit.providers.JobStatus "(in Qiskit v1.3)")
</Function>

### submit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ python_api_name: qiskit_ibm_runtime.RuntimeJobV2
# RuntimeJobV2

<Class id="qiskit_ibm_runtime.RuntimeJobV2" isDedicatedPage={true} github="https://github.com/Qiskit/qiskit-ibm-runtime/tree/main/qiskit_ibm_runtime/runtime_job_v2.py#L53-L273" signature="RuntimeJobV2(backend, api_client, client_params, job_id, program_id, service, creation_date=None, user_callback=None, result_decoder=None, image='', session_id=None, tags=None, version=None)" modifiers="class">
Bases: [`BasePrimitiveJob`](/api/qiskit/qiskit.primitives.BasePrimitiveJob "(in Qiskit v1.2)")\[[`PrimitiveResult`](/api/qiskit/qiskit.primitives.PrimitiveResult "(in Qiskit v1.2)"), `Literal`\[‘INITIALIZING’, ‘QUEUED’, ‘RUNNING’, ‘CANCELLED’, ‘DONE’, ‘ERROR’]], `BaseRuntimeJob`
Bases: [`BasePrimitiveJob`](/api/qiskit/qiskit.primitives.BasePrimitiveJob "(in Qiskit v1.3)")\[[`PrimitiveResult`](/api/qiskit/qiskit.primitives.PrimitiveResult "(in Qiskit v1.3)"), `Literal`\[‘INITIALIZING’, ‘QUEUED’, ‘RUNNING’, ‘CANCELLED’, ‘DONE’, ‘ERROR’]], `BaseRuntimeJob`

Representation of a runtime V2 primitive exeuction.

RuntimeJob constructor.

**Parameters**

* **backend** ([*Backend*](/api/qiskit/qiskit.providers.Backend "(in Qiskit v1.2)")) – The backend instance used to run this job.
* **backend** ([*Backend*](/api/qiskit/qiskit.providers.Backend "(in Qiskit v1.3)")) – The backend instance used to run this job.
* **api\_client** (*RuntimeClient*) – Object for connecting to the server.
* **client\_params** (*ClientParameters*) – Parameters used for server connection.
* **job\_id** (*str*) – Job ID.
Expand Down Expand Up @@ -134,7 +134,7 @@ python_api_name: qiskit_ibm_runtime.RuntimeJobV2

**Return type**

[*Backend*](/api/qiskit/qiskit.providers.Backend "(in Qiskit v1.2)") | None
[*Backend*](/api/qiskit/qiskit.providers.Backend "(in Qiskit v1.3)") | None
</Function>

### cancel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ python_api_name: qiskit_ibm_runtime.SamplerV2
# SamplerV2

<Class id="qiskit_ibm_runtime.SamplerV2" isDedicatedPage={true} github="https://github.com/Qiskit/qiskit-ibm-runtime/tree/main/qiskit_ibm_runtime/sampler.py#L44-L124" signature="SamplerV2(mode=None, options=None)" modifiers="class">
Bases: `BasePrimitiveV2`\[[`SamplerOptions`](qiskit_ibm_runtime.options.SamplerOptions "qiskit_ibm_runtime.options.sampler_options.SamplerOptions")], `Sampler`, [`BaseSamplerV2`](/api/qiskit/qiskit.primitives.BaseSamplerV2 "(in Qiskit v1.2)")
Bases: `BasePrimitiveV2`\[[`SamplerOptions`](qiskit_ibm_runtime.options.SamplerOptions "qiskit_ibm_runtime.options.sampler_options.SamplerOptions")], `Sampler`, [`BaseSamplerV2`](/api/qiskit/qiskit.primitives.BaseSamplerV2 "(in Qiskit v1.3)")

Class for interacting with Qiskit Runtime Sampler primitive service.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ python_api_name: qiskit_ibm_runtime.debug_tools.Neat

**Return type**

[*BackendV2*](/api/qiskit/qiskit.providers.BackendV2 "(in Qiskit v1.2)")
[*BackendV2*](/api/qiskit/qiskit.providers.BackendV2 "(in Qiskit v1.3)")
</Function>

### ideal\_sim
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ python_api_name: qiskit_ibm_runtime.debug_tools.NeatPubResult
<Function id="qiskit_ibm_runtime.debug_tools.NeatPubResult.__mul__" github="https://github.com/Qiskit/qiskit-ibm-runtime/tree/main/qiskit_ibm_runtime/debug_tools/neat_results.py#L90-L91" signature="__mul__(other)">
**Parameters**

**other** (*int | float |* [*NeatPubResult*](#qiskit_ibm_runtime.debug_tools.NeatPubResult "qiskit_ibm_runtime.debug_tools.neat_results.NeatPubResult") *|*[*PubResult*](/api/qiskit/qiskit.primitives.PubResult "(in Qiskit v1.2)") *|*[*DataBin*](/api/qiskit/qiskit.primitives.DataBin "(in Qiskit v1.2)"))
**other** (*int | float |* [*NeatPubResult*](#qiskit_ibm_runtime.debug_tools.NeatPubResult "qiskit_ibm_runtime.debug_tools.neat_results.NeatPubResult") *|*[*PubResult*](/api/qiskit/qiskit.primitives.PubResult "(in Qiskit v1.3)") *|*[*DataBin*](/api/qiskit/qiskit.primitives.DataBin "(in Qiskit v1.3)"))

**Return type**

Expand Down
Loading
Loading