295 lines
14 KiB
Plaintext
295 lines
14 KiB
Plaintext
---
|
||
title: PulseSimulator
|
||
description: API reference for qiskit.providers.aer.PulseSimulator
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: class
|
||
python_api_name: qiskit.providers.aer.PulseSimulator
|
||
---
|
||
|
||
<span id="qiskit-providers-aer-pulsesimulator" />
|
||
|
||
# qiskit.providers.aer.PulseSimulator
|
||
|
||
<Class id="qiskit.providers.aer.PulseSimulator" isDedicatedPage={true} github="https://github.com/qiskit/qiskit-aer/tree/stable/0.7/qiskit/providers/aer/backends/pulse_simulator.py" signature="PulseSimulator(configuration=None, properties=None, defaults=None, provider=None, **backend_options)" modifiers="class">
|
||
Pulse schedule simulator backend.
|
||
|
||
The `PulseSimulator` simulates continuous time Hamiltonian dynamics of a quantum system, with controls specified by pulse `Schedule` objects, and the model of the physical system specified by [`PulseSystemModel`](qiskit.providers.aer.pulse.PulseSystemModel "qiskit.providers.aer.pulse.PulseSystemModel") objects. Results are returned in the same format as when jobs are submitted to actual devices.
|
||
|
||
**Examples**
|
||
|
||
The minimal information a `PulseSimulator` needs to simulate is a [`PulseSystemModel`](qiskit.providers.aer.pulse.PulseSystemModel "qiskit.providers.aer.pulse.PulseSystemModel"), which can be supplied either by setting the backend option before calling `run`, e.g.:
|
||
|
||
```python
|
||
backend_sim = qiskit.providers.aer.PulseSimulator()
|
||
|
||
# Set the pulse system model for the simulator
|
||
backend_sim.set_options(system_model=system_model)
|
||
|
||
# Assemble schedules using PulseSimulator as the backend
|
||
pulse_qobj = assemble(schedules, backend=backend_sim)
|
||
|
||
# Run simulation
|
||
results = backend_sim.run(pulse_qobj)
|
||
```
|
||
|
||
or by supplying the system model at runtime, e.g.:
|
||
|
||
```python
|
||
backend_sim = qiskit.providers.aer.PulseSimulator()
|
||
|
||
# Assemble schedules using PulseSimulator as the backend
|
||
pulse_qobj = assemble(schedules, backend=backend_sim)
|
||
|
||
# Run simulation on a PulseSystemModel object
|
||
results = backend_sim.run(pulse_qobj, system_model=system_model)
|
||
```
|
||
|
||
Alternatively, an instance of the `PulseSimulator` may be further configured to contain more information present in a real backend. The simplest way to do this is to instantiate the `PulseSimulator` from a real backend:
|
||
|
||
```python
|
||
armonk_sim = qiskit.providers.aer.PulseSimulator.from_backend(FakeArmonk())
|
||
pulse_qobj = assemble(schedules, backend=armonk_sim)
|
||
armonk_sim.run(pulse_qobj)
|
||
```
|
||
|
||
In the above example, the `PulseSimulator` copies all configuration and default data from `FakeArmonk()`, and as such has the same affect as `FakeArmonk()` when passed as an argument to `assemble`. Furthermore it constructs a [`PulseSystemModel`](qiskit.providers.aer.pulse.PulseSystemModel "qiskit.providers.aer.pulse.PulseSystemModel") from the model details in the supplied backend, which is then used in simulation.
|
||
|
||
**Supported PulseQobj parameters**
|
||
|
||
* `qubit_lo_freq`: Local oscillator frequencies for each `DriveChannel`. Defaults to either the value given in the [`PulseSystemModel`](qiskit.providers.aer.pulse.PulseSystemModel "qiskit.providers.aer.pulse.PulseSystemModel"), or is calculated directly from the Hamiltonian.
|
||
* `meas_level`: Type of desired measurement output, in `[1, 2]`. `1` gives complex numbers (IQ values), and `2` gives discriminated states `|0>` and `|1>`. Defaults to `2`.
|
||
* `meas_return`: Measurement type, `'single'` or `'avg'`. Defaults to `'avg'`.
|
||
* `shots`: Number of shots per experiment. Defaults to `1024`.
|
||
|
||
**Simulation details**
|
||
|
||
The simulator uses the `zvode` differential equation solver method through `scipy`. Simulation is performed in the rotating frame of the diagonal of the drift Hamiltonian contained in the [`PulseSystemModel`](qiskit.providers.aer.pulse.PulseSystemModel "qiskit.providers.aer.pulse.PulseSystemModel"). Measurements are performed in the dressed basis of the drift Hamiltonian.
|
||
|
||
**Other options**
|
||
|
||
Additional valid keyword arguments for `run()`:
|
||
|
||
* `'solver_options'`: A `dict` for solver options. Accepted keys are `'atol'`, `'rtol'`, `'nsteps'`, `'max_step'`, `'num_cpus'`, `'norm_tol'`, and `'norm_steps'`.
|
||
|
||
Aer class for backends.
|
||
|
||
This method should initialize the module and its configuration, and raise an exception if a component of the module is not available.
|
||
|
||
**Parameters**
|
||
|
||
* **configuration** ([*BackendConfiguration*](qiskit.providers.models.BackendConfiguration "qiskit.providers.models.BackendConfiguration")) – backend configuration.
|
||
* **properties** ([*BackendProperties*](qiskit.providers.models.BackendProperties "qiskit.providers.models.BackendProperties") *or None*) – Optional, backend properties.
|
||
* **defaults** ([*PulseDefaults*](qiskit.providers.models.PulseDefaults "qiskit.providers.models.PulseDefaults") *or None*) – Optional, backend pulse defaults.
|
||
* **available\_methods** (*list or None*) – Optional, the available simulation methods if backend supports multiple methods.
|
||
* **provider** ([*BaseProvider*](qiskit.providers.BaseProvider "qiskit.providers.BaseProvider")) – Optional, provider responsible for this backend.
|
||
* **backend\_options** (*dict or None*) – Optional set custom backend options.
|
||
|
||
**Raises**
|
||
|
||
[**AerError**](qiskit.providers.aer.AerError "qiskit.providers.aer.AerError") – if there is no name in the configuration
|
||
|
||
### \_\_init\_\_
|
||
|
||
<Function id="qiskit.providers.aer.PulseSimulator.__init__" signature="__init__(configuration=None, properties=None, defaults=None, provider=None, **backend_options)">
|
||
Aer class for backends.
|
||
|
||
This method should initialize the module and its configuration, and raise an exception if a component of the module is not available.
|
||
|
||
**Parameters**
|
||
|
||
* **configuration** ([*BackendConfiguration*](qiskit.providers.models.BackendConfiguration "qiskit.providers.models.BackendConfiguration")) – backend configuration.
|
||
* **properties** ([*BackendProperties*](qiskit.providers.models.BackendProperties "qiskit.providers.models.BackendProperties") *or None*) – Optional, backend properties.
|
||
* **defaults** ([*PulseDefaults*](qiskit.providers.models.PulseDefaults "qiskit.providers.models.PulseDefaults") *or None*) – Optional, backend pulse defaults.
|
||
* **available\_methods** (*list or None*) – Optional, the available simulation methods if backend supports multiple methods.
|
||
* **provider** ([*BaseProvider*](qiskit.providers.BaseProvider "qiskit.providers.BaseProvider")) – Optional, provider responsible for this backend.
|
||
* **backend\_options** (*dict or None*) – Optional set custom backend options.
|
||
|
||
**Raises**
|
||
|
||
[**AerError**](qiskit.providers.aer.AerError "qiskit.providers.aer.AerError") – if there is no name in the configuration
|
||
</Function>
|
||
|
||
## Methods
|
||
|
||
| | |
|
||
| -------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
|
||
| [`__init__`](#qiskit.providers.aer.PulseSimulator.__init__ "qiskit.providers.aer.PulseSimulator.__init__")(\[configuration, properties, …]) | Aer class for backends. |
|
||
| [`available_methods`](#qiskit.providers.aer.PulseSimulator.available_methods "qiskit.providers.aer.PulseSimulator.available_methods")() | Return the available simulation methods. |
|
||
| [`clear_options`](#qiskit.providers.aer.PulseSimulator.clear_options "qiskit.providers.aer.PulseSimulator.clear_options")() | Reset the simulator options to default values. |
|
||
| [`configuration`](#qiskit.providers.aer.PulseSimulator.configuration "qiskit.providers.aer.PulseSimulator.configuration")() | Return the simulator backend configuration. |
|
||
| [`defaults`](#qiskit.providers.aer.PulseSimulator.defaults "qiskit.providers.aer.PulseSimulator.defaults")() | Return the simulator backend pulse defaults. |
|
||
| [`from_backend`](#qiskit.providers.aer.PulseSimulator.from_backend "qiskit.providers.aer.PulseSimulator.from_backend")(backend, \*\*options) | Initialize simulator from backend. |
|
||
| [`name`](#qiskit.providers.aer.PulseSimulator.name "qiskit.providers.aer.PulseSimulator.name")() | Return the backend name. |
|
||
| [`properties`](#qiskit.providers.aer.PulseSimulator.properties "qiskit.providers.aer.PulseSimulator.properties")() | Return the simulator backend properties if set. |
|
||
| [`provider`](#qiskit.providers.aer.PulseSimulator.provider "qiskit.providers.aer.PulseSimulator.provider")() | Return the backend Provider. |
|
||
| [`run`](#qiskit.providers.aer.PulseSimulator.run "qiskit.providers.aer.PulseSimulator.run")(qobj, \*args\[, backend\_options, validate]) | Run a qobj on the backend. |
|
||
| [`set_options`](#qiskit.providers.aer.PulseSimulator.set_options "qiskit.providers.aer.PulseSimulator.set_options")(\*\*backend\_options) | Set the simulator options |
|
||
| [`status`](#qiskit.providers.aer.PulseSimulator.status "qiskit.providers.aer.PulseSimulator.status")() | Return backend status. |
|
||
| [`version`](#qiskit.providers.aer.PulseSimulator.version "qiskit.providers.aer.PulseSimulator.version")() | Return the backend version. |
|
||
|
||
## Attributes
|
||
|
||
| | |
|
||
| ------------------------------------------------------------------------------------------------------- | ------------------------------------ |
|
||
| [`options`](#qiskit.providers.aer.PulseSimulator.options "qiskit.providers.aer.PulseSimulator.options") | Return the current simulator options |
|
||
|
||
### available\_methods
|
||
|
||
<Function id="qiskit.providers.aer.PulseSimulator.available_methods" signature="available_methods()">
|
||
Return the available simulation methods.
|
||
</Function>
|
||
|
||
### clear\_options
|
||
|
||
<Function id="qiskit.providers.aer.PulseSimulator.clear_options" signature="clear_options()">
|
||
Reset the simulator options to default values.
|
||
</Function>
|
||
|
||
### configuration
|
||
|
||
<Function id="qiskit.providers.aer.PulseSimulator.configuration" signature="configuration()">
|
||
Return the simulator backend configuration.
|
||
|
||
**Returns**
|
||
|
||
the configuration for the backend.
|
||
|
||
**Return type**
|
||
|
||
[BackendConfiguration](qiskit.providers.models.BackendConfiguration "qiskit.providers.models.BackendConfiguration")
|
||
</Function>
|
||
|
||
### defaults
|
||
|
||
<Function id="qiskit.providers.aer.PulseSimulator.defaults" signature="defaults()">
|
||
Return the simulator backend pulse defaults.
|
||
|
||
**Returns**
|
||
|
||
**The backend pulse defaults or `None` if the**
|
||
|
||
backend does not support pulse.
|
||
|
||
**Return type**
|
||
|
||
[PulseDefaults](qiskit.providers.models.PulseDefaults "qiskit.providers.models.PulseDefaults")
|
||
</Function>
|
||
|
||
### from\_backend
|
||
|
||
<Function id="qiskit.providers.aer.PulseSimulator.from_backend" signature="from_backend(backend, **options)" modifiers="classmethod">
|
||
Initialize simulator from backend.
|
||
</Function>
|
||
|
||
### name
|
||
|
||
<Function id="qiskit.providers.aer.PulseSimulator.name" signature="name()">
|
||
Return the backend name.
|
||
|
||
**Returns**
|
||
|
||
the name of the backend.
|
||
|
||
**Return type**
|
||
|
||
str
|
||
</Function>
|
||
|
||
### options
|
||
|
||
<Attribute id="qiskit.providers.aer.PulseSimulator.options">
|
||
Return the current simulator options
|
||
</Attribute>
|
||
|
||
### properties
|
||
|
||
<Function id="qiskit.providers.aer.PulseSimulator.properties" signature="properties()">
|
||
Return the simulator backend properties if set.
|
||
|
||
**Returns**
|
||
|
||
**The backend properties or `None` if the**
|
||
|
||
backend does not have properties set.
|
||
|
||
**Return type**
|
||
|
||
[BackendProperties](qiskit.providers.models.BackendProperties "qiskit.providers.models.BackendProperties")
|
||
</Function>
|
||
|
||
### provider
|
||
|
||
<Function id="qiskit.providers.aer.PulseSimulator.provider" signature="provider()">
|
||
Return the backend Provider.
|
||
|
||
**Returns**
|
||
|
||
the Provider responsible for the backend.
|
||
|
||
**Return type**
|
||
|
||
[BaseProvider](qiskit.providers.BaseProvider "qiskit.providers.BaseProvider")
|
||
</Function>
|
||
|
||
### run
|
||
|
||
<Function id="qiskit.providers.aer.PulseSimulator.run" signature="run(qobj, *args, backend_options=None, validate=True, **run_options)">
|
||
Run a qobj on the backend.
|
||
|
||
**Parameters**
|
||
|
||
* **qobj** ([*QasmQobj*](qiskit.qobj.QasmQobj "qiskit.qobj.QasmQobj")) – The Qobj to be executed.
|
||
* **backend\_options** (*dict or None*) – DEPRECATED dictionary of backend options for the execution (default: None).
|
||
* **validate** (*bool*) – validate the Qobj before running (default: True).
|
||
* **run\_options** (*kwargs*) – additional run time backend options.
|
||
|
||
**Returns**
|
||
|
||
The simulation job.
|
||
|
||
**Return type**
|
||
|
||
[AerJob](qiskit.providers.aer.AerJob "qiskit.providers.aer.AerJob")
|
||
|
||
**Additional Information:**
|
||
|
||
* kwarg options specified in `run_options` will override options of the same kwarg specified in the simulator options, the `backend_options` and the `Qobj.config`.
|
||
* The entries in the `backend_options` will be combined with the `Qobj.config` dictionary with the values of entries in `backend_options` taking precedence. This kwarg is deprecated and direct kwarg’s should be used for options to pass them to `run_options`.
|
||
</Function>
|
||
|
||
### set\_options
|
||
|
||
<Function id="qiskit.providers.aer.PulseSimulator.set_options" signature="set_options(**backend_options)">
|
||
Set the simulator options
|
||
</Function>
|
||
|
||
### status
|
||
|
||
<Function id="qiskit.providers.aer.PulseSimulator.status" signature="status()">
|
||
Return backend status.
|
||
|
||
**Returns**
|
||
|
||
the status of the backend.
|
||
|
||
**Return type**
|
||
|
||
[BackendStatus](qiskit.providers.models.BackendStatus "qiskit.providers.models.BackendStatus")
|
||
</Function>
|
||
|
||
### version
|
||
|
||
<Function id="qiskit.providers.aer.PulseSimulator.version" signature="version()">
|
||
Return the backend version.
|
||
|
||
**Returns**
|
||
|
||
the X.X.X version of the backend.
|
||
|
||
**Return type**
|
||
|
||
str
|
||
</Function>
|
||
</Class>
|
||
|