backend

Backend tools for Qurry. (qurry.tools.backend)

backend_manager

Backend Wrapper (qurry.tools.backend.backend_manager)

qurry.tools.backend.backend_manager.BackendCallSignDict

The dictionary of backend callsign.

alias of dict[Literal[‘real’, ‘sim’, ‘fake’, ‘extra’] | str, dict[str, str]]

qurry.tools.backend.backend_manager.BackendDict

The dictionary of backends.

alias of dict[Literal[‘real’, ‘sim’, ‘fake’, ‘extra’] | str, dict[str, Backend]]

class qurry.tools.backend.backend_manager.BackendWrapper[source]

A wrapper for qiskit.providers.Backend to provide more convenient way to use.

add_backend(name: str, backend: Backend, callsign: str | None = None) None[source]

Add a backend to backend wrapper.

Parameters:
  • name (str) – The name of backend.

  • backend (Backend) – The backend.

  • callsign (Optional[str], optional) – The callsign of backend. Defaults to None.

property available_aer: list[str]

The available aer backends.

property available_aer_callsign: list[str]

The available aer backends callsign.

property available_backends: dict[Literal['real', 'sim', 'fake', 'extra'] | str, dict[str, Backend]]

The available backends.

property available_backends_callsign: dict[Literal['real', 'sim', 'fake', 'extra'] | str, dict[str, str]]

The available backends callsign.

property available_fake: list[str]

The available fake backends.

property available_fake_callsign: list[str]

The available fake backends callsign.

property available_ibmq: list[str]

The available ibmq/ibm backends.

property available_ibmq_callsign: list[str]

The available ibmq/ibm backends callsign.

make_callsign(sign: str = 'Galm 2', who: str = 'solo_wing_pixy') None[source]

Make a callsign for backend.

Parameters:
  • sign (str, optional) – The callsign.

  • who (str, optional) – The backend.

Raises:
statesheet()[source]

The statesheet of backend wrapper.

qurry.tools.backend.backend_manager.random() x in the interval [0, 1).

env_check

Backend Environment Check (qurry.tools.backend.env_check)

For qiskit-aer has been divided into two packages since qiskit some version, So it needs to be imported differently by trying to import qiskit-aer first.

And qiskit-ibmq-provider has been deprecated, but for some user may still need to use it, so it needs to be imported also differently by trying to import qiskit-ibm-provider first.

So this file is used to unify the import point of AerProvider, IBMProvider/IBMQProvider. Avoiding the import error occurs on different parts of Qurry.

qurry.tools.backend.env_check.version_check()[source]

Version check to remind user to update qiskit if needed.

import_fake

Import Fake (qurry.tools.backend.import_fake)

This file is used to unify the import point of FakeProvider, FakeBackend/FakeBackendV2 from qiskit.providers.fake_provider and qiskit_ibm_runtime.fake_provider. Avoiding the import error occurs on different parts of Qurry.

qurry.tools.backend.import_fake.fack_backend_loader() tuple[dict[str, str], dict[str, Backend]][source]
qurry.tools.backend.import_fake.fack_backend_loader() tuple[dict[str, str], dict[str, Backend]]

Load the fake backend.

Parameters:
  • version (str, optional) – The version of fake backend. Defaults to None.

  • FakeProvider ("v1" for)

  • FakeProviderForBackendV2. ("v2" for)

Returns:

The callsign of fake backend, the fake backend dict, the fake provider.

Return type:

tuple[dict[str, str], dict[str, Backend]]

qurry.tools.backend.import_fake.get_default_fake_provider() Literal['qiskit_ibm_runtime.fake_provider', 'qiskit.providers.fake_provider'] | None[source]

Get the default fake provider.

Returns:

The default fake provider.

Return type:

ImportPointType

import_simulator

This module provides the default simulator for Qurry. For the simulator, the following sources are considered:

  • qiskit_aer

  • qiskit.providers.aer

  • qiskit.providers.basicaer

  • qiskit.providers.basic_provider

which are used in different qiskit, qiskit-aer version, and ordered by priority.

Import Simulator (qurry.tools.backend.import_simulator)

This module provides the default simulator for Qurry. For the simulator, the following sources are considered:

  • qiskit_aer

  • qiskit.providers.aer

  • qiskit.providers.basicaer

  • qiskit.providers.basic_provider

which are used in different qiskit, qiskit-aer version, and ordered by priority.

class qurry.tools.backend.import_simulator.GeneralBackend(configuration, properties=None, provider=None, target=None, backend_options=None)[source]

The abstract class of default simulator.

class qurry.tools.backend.import_simulator.GeneralSimulator(configuration=None, properties=None, provider=None, target=None, **backend_options)[source]

Default simulator.

qurry.tools.backend.import_simulator.get_default_sim_source() Literal['qiskit_aer', 'qiskit.providers.aer', 'qiskit.providers.basicaer', 'qiskit.providers.basic_provider'][source]

Get the default source for the simulator.

Returns:

The default source for the simulator.

Return type:

ImportPointType

Raises:

ImportError – If no available simulator source is found.

utils

Backend Utils (qurry.tools.backend.utils)

For qiskit-aer has been divided into two packages since qiskit some version, So it needs to be imported differently by trying to import qiskit-aer first.

And qiskit-ibmq-provider has been deprecated, but for some user may still need to use it, so it needs to be imported also differently by trying to import qiskit-ibm-provider first.

So this file is used to unify the import point of AerProvider, IBMProvider/IBMQProvider. Avoiding the import error occurs on different parts of Qurry.

qurry.tools.backend.utils.backendName(back)

Get the name of backend.

Parameters:

back (Union[BackendV2, Backend]) – The backend instance.

Returns:

The name of backend.

Return type:

str

qurry.tools.backend.utils.backend_name_getter(back: BackendV2 | Backend | str) str[source]

Get the name of backend.

Parameters:

back (Union[BackendV1, BackendV2, Backend, str]) – The backend instance.

Returns:

The name of backend.

Return type:

str

qurry.tools.backend.utils.shorten_name(name: str, drop: list[str] | None = None, exclude: list[str] | None = None) str[source]

Shorten the name of backend.

Parameters:
  • name (str) – The name of backend.

  • drop (list[str], optional) – The strings to drop from the name. Defaults to [].

  • exclude (list[str], optional) – The strings to exclude from the name. Defaults to [].

Returns:

The shortened name of backend.

Return type:

str