azure-quantum 1.1.2.dev0__tar.gz → 1.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/PKG-INFO +1 -1
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/_client/_version.py +1 -1
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/_workspace_connection_params.py +1 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/job/__init__.py +4 -2
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/job/job.py +5 -2
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/job/job_failed_with_results_error.py +12 -4
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/qiskit/__init__.py +2 -1
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/qiskit/backends/__init__.py +6 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/qiskit/backends/backend.py +2 -1
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/qiskit/backends/quantinuum.py +3 -2
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/qiskit/provider.py +14 -12
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/target/microsoft/elements/dft/job.py +4 -2
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/target/pasqal/result.py +4 -4
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/target/pasqal/target.py +26 -1
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/target/rigetti/result.py +15 -10
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/target/rigetti/target.py +19 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/target/target.py +1 -1
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/version.py +1 -1
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/workspace.py +286 -111
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure_quantum.egg-info/PKG-INFO +1 -1
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure_quantum.egg-info/requires.txt +5 -5
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/requirements-qiskit.txt +1 -1
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/requirements.txt +3 -3
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/README.md +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/__init__.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/_authentication/__init__.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/_authentication/_chained.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/_authentication/_default.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/_authentication/_token.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/_client/__init__.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/_client/_client.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/_client/_configuration.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/_client/_patch.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/_client/_serialization.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/_client/_vendor.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/_client/models/__init__.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/_client/models/_enums.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/_client/models/_models.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/_client/models/_patch.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/_client/operations/__init__.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/_client/operations/_operations.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/_client/operations/_patch.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/_constants.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/argument_types/__init__.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/argument_types/types.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/chemistry/__init__.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/cirq/__init__.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/cirq/job.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/cirq/service.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/cirq/targets/__init__.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/cirq/targets/ionq.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/cirq/targets/quantinuum.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/cirq/targets/target.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/job/base_job.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/job/filtered_job.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/job/session.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/job/workspace_item.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/job/workspace_item_factory.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/qiskit/backends/ionq.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/qiskit/backends/microsoft.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/qiskit/backends/qci.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/qiskit/backends/rigetti.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/qiskit/job.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/qiskit/results/__init__.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/qiskit/results/resource_estimator.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/storage.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/target/__init__.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/target/ionq.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/target/microsoft/__init__.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/target/microsoft/elements/__init__.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/target/microsoft/elements/dft/__init__.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/target/microsoft/elements/dft/target.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/target/microsoft/job.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/target/microsoft/result.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/target/microsoft/target.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/target/params.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/target/pasqal/__init__.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/target/quantinuum.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/target/rigetti/__init__.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/target/target_factory.py +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure_quantum.egg-info/SOURCES.txt +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure_quantum.egg-info/dependency_links.txt +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure_quantum.egg-info/top_level.txt +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/requirements-cirq.txt +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/requirements-dev.txt +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/requirements-qsharp.txt +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/requirements-quil.txt +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/setup.cfg +0 -0
- {azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/setup.py +0 -0
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
from azure.quantum._client.models import JobDetails
|
|
9
9
|
from .base_job import BaseJob
|
|
10
10
|
from .filtered_job import FilteredJob
|
|
11
|
-
from .job import Job
|
|
11
|
+
from .job import Job, ContentType
|
|
12
12
|
from .job_failed_with_results_error import JobFailedWithResultsError
|
|
13
13
|
from .workspace_item import WorkspaceItem
|
|
14
14
|
from .workspace_item_factory import WorkspaceItemFactory
|
|
@@ -17,6 +17,7 @@ from .session import Session, SessionHost, SessionDetails, SessionStatus, Sessio
|
|
|
17
17
|
__all__ = [
|
|
18
18
|
"Job",
|
|
19
19
|
"JobDetails",
|
|
20
|
+
"ContentType",
|
|
20
21
|
"BaseJob",
|
|
21
22
|
"FilteredJob",
|
|
22
23
|
"WorkspaceItem",
|
|
@@ -24,5 +25,6 @@ __all__ = [
|
|
|
24
25
|
"SessionHost",
|
|
25
26
|
"SessionDetails",
|
|
26
27
|
"SessionStatus",
|
|
27
|
-
"SessionJobFailurePolicy"
|
|
28
|
+
"SessionJobFailurePolicy",
|
|
29
|
+
"JobFailedWithResultsError"
|
|
28
30
|
]
|
|
@@ -105,13 +105,16 @@ class Job(BaseJob, FilteredJob):
|
|
|
105
105
|
def get_results(self, timeout_secs: float = DEFAULT_TIMEOUT):
|
|
106
106
|
"""Get job results by downloading the results blob from the
|
|
107
107
|
storage container linked via the workspace.
|
|
108
|
-
|
|
108
|
+
|
|
109
109
|
Raises :class:`RuntimeError` if job execution fails.
|
|
110
|
+
|
|
111
|
+
Raises :class:`azure.quantum.job.JobFailedWithResultsError` if job execution fails,
|
|
112
|
+
but failure results could still be retrieved (e.g. for jobs submitted against "microsoft.dft" target).
|
|
110
113
|
|
|
111
114
|
:param timeout_secs: Timeout in seconds, defaults to 300
|
|
112
115
|
:type timeout_secs: float
|
|
113
116
|
:return: Results dictionary with histogram shots, or raw results if not a json object.
|
|
114
|
-
:rtype: Any
|
|
117
|
+
:rtype: typing.Any
|
|
115
118
|
"""
|
|
116
119
|
if self.results is not None:
|
|
117
120
|
return self.results
|
{azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/job/job_failed_with_results_error.py
RENAMED
|
@@ -2,14 +2,22 @@ import json
|
|
|
2
2
|
from typing import Any, Dict, Union
|
|
3
3
|
|
|
4
4
|
class JobFailedWithResultsError(RuntimeError):
|
|
5
|
-
"""
|
|
6
|
-
Error produced when Job completes with status "Failed" and the Job
|
|
5
|
+
"""Error produced when Job completes with status "Failed" and the Job
|
|
7
6
|
supports producing failure results.
|
|
8
7
|
|
|
9
|
-
The failure results can be accessed with get_failure_results() method
|
|
8
|
+
The failure results can be accessed with get_failure_results() method.
|
|
10
9
|
"""
|
|
11
|
-
|
|
10
|
+
|
|
12
11
|
def __init__(self, message: str, failure_results: Any, *args: object) -> None:
|
|
12
|
+
"""Initializes error produced when Job completes with status "Failed" and the Job
|
|
13
|
+
supports producing failure results.
|
|
14
|
+
|
|
15
|
+
:param message: Error message.
|
|
16
|
+
:type message: str
|
|
17
|
+
:param failure_results: Failure results produced by the job.
|
|
18
|
+
:type failure_results: Any
|
|
19
|
+
"""
|
|
20
|
+
|
|
13
21
|
self._set_error_details(message, failure_results)
|
|
14
22
|
super().__init__(message, *args)
|
|
15
23
|
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
"""Azure Quantum Qiskit Provider"""
|
|
7
7
|
|
|
8
|
-
from .provider import AzureQuantumProvider
|
|
8
|
+
from .provider import AzureQuantumProvider, AzureQuantumJob
|
|
9
9
|
from azure.quantum import __version__
|
|
10
10
|
|
|
11
11
|
__all__ = [
|
|
12
12
|
"AzureQuantumProvider",
|
|
13
|
+
"AzureQuantumJob",
|
|
13
14
|
"__version__"
|
|
14
15
|
]
|
|
@@ -129,6 +129,7 @@ class AzureBackendBase(Backend, SessionHost):
|
|
|
129
129
|
if self._can_send_shots_input_param():
|
|
130
130
|
options_shots = options.pop(self.__class__._SHOTS_PARAM_NAME, None)
|
|
131
131
|
|
|
132
|
+
final_shots = None
|
|
132
133
|
# First we check for the explicitly specified 'shots' parameter, then for a provider-specific
|
|
133
134
|
# field in options, then for a backend's default value.
|
|
134
135
|
|
|
@@ -142,7 +143,7 @@ class AzureBackendBase(Backend, SessionHost):
|
|
|
142
143
|
|
|
143
144
|
elif shots is not None:
|
|
144
145
|
final_shots = shots
|
|
145
|
-
|
|
146
|
+
elif options_shots is not None:
|
|
146
147
|
warnings.warn(
|
|
147
148
|
f"Parameter '{self.__class__._SHOTS_PARAM_NAME}' is subject to change in future versions. "
|
|
148
149
|
"Please, use 'shots' parameter instead."
|
{azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/qiskit/backends/quantinuum.py
RENAMED
|
@@ -14,6 +14,7 @@ from qiskit import QuantumCircuit
|
|
|
14
14
|
from qiskit.providers.models import BackendConfiguration
|
|
15
15
|
from qiskit.providers import Options
|
|
16
16
|
from qiskit.providers import Provider
|
|
17
|
+
from qiskit.qasm2 import dumps
|
|
17
18
|
|
|
18
19
|
import logging
|
|
19
20
|
|
|
@@ -243,7 +244,7 @@ class QuantinuumBackend(AzureBackend):
|
|
|
243
244
|
|
|
244
245
|
def _translate_input(self, circuit):
|
|
245
246
|
"""Translates the input values to the format expected by the AzureBackend."""
|
|
246
|
-
return circuit
|
|
247
|
+
return dumps(circuit)
|
|
247
248
|
|
|
248
249
|
def estimate_cost(
|
|
249
250
|
self, circuit: QuantumCircuit, shots: int = None, count: int = None
|
|
@@ -267,7 +268,7 @@ class QuantinuumBackend(AzureBackend):
|
|
|
267
268
|
if shots is None:
|
|
268
269
|
raise ValueError("Missing input argument 'shots'.")
|
|
269
270
|
|
|
270
|
-
input_data = circuit
|
|
271
|
+
input_data = dumps(circuit)
|
|
271
272
|
workspace = self.provider().get_workspace()
|
|
272
273
|
target = workspace.get_targets(self.name())
|
|
273
274
|
return target.estimate_cost(input_data, shots=shots)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import warnings
|
|
7
7
|
import inspect
|
|
8
8
|
from itertools import groupby
|
|
9
|
-
from typing import Dict, List, Tuple, Type
|
|
9
|
+
from typing import Dict, List, Optional, Tuple, Type
|
|
10
10
|
from azure.quantum import Workspace
|
|
11
11
|
|
|
12
12
|
try:
|
|
@@ -24,17 +24,13 @@ from azure.quantum.qiskit.backends.backend import AzureBackendBase
|
|
|
24
24
|
from azure.quantum.qiskit.job import AzureQuantumJob
|
|
25
25
|
from azure.quantum.qiskit.backends import *
|
|
26
26
|
|
|
27
|
-
|
|
28
27
|
QISKIT_USER_AGENT = "azure-quantum-qiskit"
|
|
29
28
|
|
|
30
|
-
|
|
31
29
|
class AzureQuantumProvider(Provider):
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
def __init__(self, workspace: Workspace=None, **kwargs):
|
|
37
|
-
"""AzureQuantumService class
|
|
30
|
+
|
|
31
|
+
def __init__(self, workspace: Optional[Workspace]=None, **kwargs):
|
|
32
|
+
"""Class for interfacing with the Azure Quantum service
|
|
33
|
+
using Qiskit quantum circuits.
|
|
38
34
|
|
|
39
35
|
:param workspace: Azure Quantum workspace. If missing it will create a new Workspace passing `kwargs` to the constructor. Defaults to None.
|
|
40
36
|
:type workspace: Workspace
|
|
@@ -66,7 +62,7 @@ class AzureQuantumProvider(Provider):
|
|
|
66
62
|
name (str): name of the backend.
|
|
67
63
|
**kwargs: dict used for filtering.
|
|
68
64
|
Returns:
|
|
69
|
-
|
|
65
|
+
azure.quantum.qiskit.backends.AzureBackendBase: a backend matching the filtering.
|
|
70
66
|
Raises:
|
|
71
67
|
QiskitBackendNotFoundError: if no backend could be found or
|
|
72
68
|
more than one backend matches the filtering criteria.
|
|
@@ -110,7 +106,7 @@ see https://aka.ms/AQ/Docs/AddProvider"
|
|
|
110
106
|
name (str): name of the backend.
|
|
111
107
|
**kwargs: dict used for filtering.
|
|
112
108
|
Returns:
|
|
113
|
-
typing.List[qiskit.
|
|
109
|
+
typing.List[azure.quantum.qiskit.backends.AzureBackendBase]: a list of Backends that match the filtering
|
|
114
110
|
criteria.
|
|
115
111
|
"""
|
|
116
112
|
|
|
@@ -143,7 +139,13 @@ see https://aka.ms/AQ/Docs/AddProvider"
|
|
|
143
139
|
return backends
|
|
144
140
|
|
|
145
141
|
def get_job(self, job_id) -> AzureQuantumJob:
|
|
146
|
-
"""Returns the Job instance associated with the given id.
|
|
142
|
+
"""Returns the Job instance associated with the given id.
|
|
143
|
+
|
|
144
|
+
Args:
|
|
145
|
+
job_id (str): Id of the Job to return.
|
|
146
|
+
Returns:
|
|
147
|
+
AzureQuantumJob: Job instance.
|
|
148
|
+
"""
|
|
147
149
|
azure_job = self._workspace.get_job(job_id)
|
|
148
150
|
backend = self.get_backend(azure_job.details.target)
|
|
149
151
|
return AzureQuantumJob(backend, azure_job)
|
{azure-quantum-1.1.2.dev0 → azure-quantum-1.2.1}/azure/quantum/target/microsoft/elements/dft/job.py
RENAMED
|
@@ -27,8 +27,10 @@ class MicrosoftElementsDftJob(Job):
|
|
|
27
27
|
|
|
28
28
|
:param timeout_secs: Timeout in seconds, defaults to 300
|
|
29
29
|
:type timeout_secs: float
|
|
30
|
-
:raises: :class:`RuntimeError`
|
|
31
|
-
:
|
|
30
|
+
:raises: :class:`RuntimeError` if job execution failed.
|
|
31
|
+
:raises: :class:`azure.quantum.job.JobFailedWithResultsError` if job execution failed,
|
|
32
|
+
but failure results could still be retrieved.
|
|
33
|
+
:return: Results dictionary.
|
|
32
34
|
"""
|
|
33
35
|
|
|
34
36
|
try:
|
|
@@ -26,16 +26,16 @@ class Result:
|
|
|
26
26
|
job = Job(...) # This job should come from a Pasqal target
|
|
27
27
|
job.wait_until_completed()
|
|
28
28
|
result = Result(job)
|
|
29
|
-
|
|
30
29
|
"""
|
|
31
30
|
|
|
32
31
|
def __init__(self, job: Job) -> None:
|
|
33
32
|
"""
|
|
34
33
|
Decode the results of a Job with output type of "pasqal.pulser-results.v1"
|
|
35
34
|
|
|
36
|
-
:
|
|
37
|
-
|
|
38
|
-
:
|
|
35
|
+
Args:
|
|
36
|
+
job (Job): Azure Quantum job
|
|
37
|
+
Raises:
|
|
38
|
+
RuntimeError: if the job has not completed successfully
|
|
39
39
|
"""
|
|
40
40
|
|
|
41
41
|
if job.details.status != "Succeeded":
|
|
@@ -25,6 +25,8 @@ class PasqalTarget(str, Enum):
|
|
|
25
25
|
"""
|
|
26
26
|
|
|
27
27
|
SIM_EMU_TN = "pasqal.sim.emu-tn"
|
|
28
|
+
"""pasqal.sim.emu-tn target"""
|
|
29
|
+
|
|
28
30
|
QPU_FRESNEL = "pasqal.qpu.fresnel"
|
|
29
31
|
"""A simulator target for Quil. See https://github.com/quil-lang/qvm for more info."""
|
|
30
32
|
|
|
@@ -52,7 +54,11 @@ class PasqalTarget(str, Enum):
|
|
|
52
54
|
|
|
53
55
|
@dataclass
|
|
54
56
|
class InputParams:
|
|
55
|
-
"""Input parameters
|
|
57
|
+
"""Input parameters
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
runs (int): The number of times to run the experiment.
|
|
61
|
+
"""
|
|
56
62
|
|
|
57
63
|
runs: int = 1
|
|
58
64
|
"""The number of times to run the experiment."""
|
|
@@ -79,6 +85,25 @@ class Pasqal(Target):
|
|
|
79
85
|
encoding: str = "",
|
|
80
86
|
**kwargs,
|
|
81
87
|
):
|
|
88
|
+
"""
|
|
89
|
+
Initializes a new target.
|
|
90
|
+
|
|
91
|
+
:param workspace: Associated workspace
|
|
92
|
+
:type workspace: Workspace
|
|
93
|
+
:param name: Target name
|
|
94
|
+
:type name: str
|
|
95
|
+
:param input_data_format: Format of input data (ex. "pasqal.pulser.v1")
|
|
96
|
+
:type input_data_format: str
|
|
97
|
+
:param output_data_format: Format of output data (ex. "pasqal.pulser-results.v1")
|
|
98
|
+
:type output_data_format: str
|
|
99
|
+
:param capability: QIR capability
|
|
100
|
+
:type capability: str
|
|
101
|
+
:param provider_id: Id of provider (ex. "pasqal")
|
|
102
|
+
:type provider_id: str
|
|
103
|
+
:param encoding: "Content-Encoding" attribute value to set on input blob (ex. "gzip")
|
|
104
|
+
:type encoding: str
|
|
105
|
+
"""
|
|
106
|
+
|
|
82
107
|
super().__init__(
|
|
83
108
|
workspace=workspace,
|
|
84
109
|
name=name,
|
|
@@ -21,22 +21,26 @@ RawData = Union[int, float, List[float]]
|
|
|
21
21
|
class Result:
|
|
22
22
|
"""Downloads the data of a completed Job and extracts the ``Readout`` for each register.
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
.. highlight:: python
|
|
25
|
+
.. code-block::
|
|
26
|
+
|
|
27
|
+
from azure.quantum.job import Job
|
|
28
|
+
from azure.quantum.target.rigetti import Result
|
|
29
|
+
job = Job(...) # This job should come from a Rigetti target
|
|
30
|
+
job.wait_until_completed()
|
|
31
|
+
result = Result(job)
|
|
32
|
+
ro_data = result["ro"]
|
|
33
|
+
first_shot_data = ro_data[0]
|
|
31
34
|
"""
|
|
32
35
|
|
|
33
36
|
def __init__(self, job: Job) -> None:
|
|
34
37
|
"""
|
|
35
38
|
Decode the results of a Job with output type of "rigetti.quil-results.v1"
|
|
36
39
|
|
|
37
|
-
:
|
|
38
|
-
|
|
39
|
-
:
|
|
40
|
+
Args:
|
|
41
|
+
job (Job): Azure Quantum job
|
|
42
|
+
Raises:
|
|
43
|
+
RuntimeError: if the job has not completed successfully
|
|
40
44
|
"""
|
|
41
45
|
|
|
42
46
|
if job.details.status != "Succeeded":
|
|
@@ -53,6 +57,7 @@ class Result:
|
|
|
53
57
|
|
|
54
58
|
|
|
55
59
|
T = TypeVar("T", bound=Union[int, float, complex])
|
|
60
|
+
|
|
56
61
|
Readout = List[List[T]]
|
|
57
62
|
"""Contains the data of a declared "readout" memory region, usually the ``ro`` register.
|
|
58
63
|
|
|
@@ -146,6 +146,25 @@ class Rigetti(Target):
|
|
|
146
146
|
encoding: str = "",
|
|
147
147
|
**kwargs,
|
|
148
148
|
):
|
|
149
|
+
"""
|
|
150
|
+
Initializes a new target.
|
|
151
|
+
|
|
152
|
+
:param workspace: Associated workspace
|
|
153
|
+
:type workspace: Workspace
|
|
154
|
+
:param name: Target name
|
|
155
|
+
:type name: str
|
|
156
|
+
:param input_data_format: Format of input data (ex. "rigetti.quil.v1")
|
|
157
|
+
:type input_data_format: str
|
|
158
|
+
:param output_data_format: Format of output data (ex. "rigetti.quil-results.v1")
|
|
159
|
+
:type output_data_format: str
|
|
160
|
+
:param capability: QIR capability
|
|
161
|
+
:type capability: str
|
|
162
|
+
:param provider_id: Id of provider (ex. "rigetti")
|
|
163
|
+
:type provider_id: str
|
|
164
|
+
:param encoding: "Content-Encoding" attribute value to set on input blob (ex. "gzip")
|
|
165
|
+
:type encoding: str
|
|
166
|
+
"""
|
|
167
|
+
|
|
149
168
|
super().__init__(
|
|
150
169
|
workspace=workspace,
|
|
151
170
|
name=name,
|
|
@@ -77,7 +77,7 @@ class Target(abc.ABC, SessionHost):
|
|
|
77
77
|
:param provider_id: Id of provider (ex. "microsoft-qc")
|
|
78
78
|
:type provider_id: str
|
|
79
79
|
:param content_type: "Content-Type" attribute value to set on input blob (ex. "application/json")
|
|
80
|
-
:type content_type: ContentType
|
|
80
|
+
:type content_type: azure.quantum.job.ContentType
|
|
81
81
|
:param encoding: "Content-Encoding" attribute value to set on input blob (ex. "gzip")
|
|
82
82
|
:type encoding: str
|
|
83
83
|
:param average_queue_time: Set average queue time (for internal use)
|