API documentation#
Backends for processing pytket circuits with AQT devices.
- class pytket.extensions.aqt.AQTBackend(aqt_workspace_id: str = 'default', aqt_resource_id: str = 'offline_simulator_no_noise', access_token: str | None = None, label: str = '', machine_debug: bool = False)#
Interface to an AQT device or simulator.
- __init__(aqt_workspace_id: str = 'default', aqt_resource_id: str = 'offline_simulator_no_noise', access_token: str | None = None, label: str = '', machine_debug: bool = False)#
Construct a new AQT backend.
Requires a valid API key/access token, this can either be provided as a parameter or set in config using
pytket.extensions.aqt.set_aqt_config()
- Parameters:
aqt_workspace_id (string) – the aqt workspace
aqt_resource_id (string) – the aqt resource id
access_token (string) – AQT access token, default None
label (bool) – label to apply to submitted jobs
machine_debug – If true, use mock aqt API (for debug/testing purposes)
- classmethod available_devices(access_token: str | None = None, **kwargs: Any) list[BackendInfo] #
See
pytket.backends.Backend.available_devices()
. Supported kwargs: none.The access token will be resolved by the AQTAccessToken class
- Parameters:
access_token (string) – optional access token override
- circuit_status(handle: ResultHandle) CircuitStatus #
Return a CircuitStatus reporting the status of the circuit execution corresponding to the ResultHandle
- default_compilation_pass(optimisation_level: int = 2) BasePass #
A suggested compilation pass that will will, if possible, produce an equivalent circuit suitable for running on this backend.
At a minimum it will ensure that compatible gates are used and that all two- qubit interactions are compatible with the backend’s qubit architecture. At higher optimisation levels, further optimisations may be applied.
This is a an abstract method which is implemented in the backend itself, and so is tailored to the backend’s requirements.
- Parameters:
optimisation_level (int, optional) –
The level of optimisation to perform during compilation.
Level 0 does the minimum required to solves the device constraints, without any optimisation.
Level 1 additionally performs some light optimisations.
Level 2 (the default) adds more computationally intensive optimisations that should give the best results from execution.
- Returns:
Compilation pass guaranteeing required predicates.
- Return type:
- get_result(handle: ResultHandle, **kwargs: Any) BackendResult #
See
pytket.backends.Backend.get_result()
. Supported kwargs: timeout, wait.
- classmethod print_device_table(access_token: str | None = None) None #
Print AQT devices available for the configured access token
The access token will be resolved by the AQTAccessToken class
- Parameters:
access_token (string) – optional access token override
- process_circuits(circuits: Sequence[Circuit], n_shots: None | int | Sequence[int | None] = None, valid_check: bool = True, **kwargs: Any) list[ResultHandle] #
See
pytket.backends.Backend.process_circuits()
.Supported kwargs: - postprocess: apply end-of-circuit simplifications and classical
postprocessing to improve fidelity of results (bool, default False)
simplify_initial: apply the pytket
SimplifyInitial
pass to improve fidelity of results assuming all qubits initialized to zero (bool, default False)
- rebase_pass() BasePass #
A single compilation pass that when run converts all gates in a Circuit to an OpType supported by the Backend (ignoring architecture constraints).
- Returns:
Compilation pass that converts gates to primitives supported by Backend.
- Return type:
- property backend_info: BackendInfo | None#
Retrieve all Backend properties in a BackendInfo object, including device architecture, supported gate set, gate errors and other hardware-specific information.
- Returns:
The BackendInfo describing this backend if it exists.
- Return type:
Optional[BackendInfo]
AQT config.
- class pytket.extensions.aqt.backends.config.AQTAccessToken#
Holds the aqt access token in memory.
- classmethod resolve(access_token: str | None = None) str #
Resolve access token by looking in several locations
If access_token is set, use it and store in memory for later. If not, look first in memory and then in the pytket config file for an access token. If none available prompt user to input access token.