boulder-opal-scale-up-sdk 1.0.4__py3-none-any.whl → 1.0.6__py3-none-any.whl
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.
- {boulder_opal_scale_up_sdk-1.0.4.dist-info → boulder_opal_scale_up_sdk-1.0.6.dist-info}/METADATA +1 -1
- boulder_opal_scale_up_sdk-1.0.6.dist-info/RECORD +79 -0
- boulderopalscaleupsdk/agent/worker.py +36 -4
- boulderopalscaleupsdk/common/dtypes.py +41 -2
- boulderopalscaleupsdk/{stubs/__init__.py → constants.py} +3 -0
- boulderopalscaleupsdk/device/controller/qblox.py +94 -26
- boulderopalscaleupsdk/device/controller/quantum_machines.py +86 -17
- boulderopalscaleupsdk/device/device.py +5 -1
- boulderopalscaleupsdk/device/processor/common.py +3 -3
- boulderopalscaleupsdk/device/processor/superconducting_processor.py +23 -3
- boulderopalscaleupsdk/errors.py +21 -0
- boulderopalscaleupsdk/experiments/__init__.py +16 -2
- boulderopalscaleupsdk/experiments/chi01_scan.py +9 -7
- boulderopalscaleupsdk/experiments/cz_spectroscopy_by_bias.py +84 -0
- boulderopalscaleupsdk/experiments/drag_leakage_calibration.py +66 -0
- boulderopalscaleupsdk/experiments/fine_amplitude_calibration.py +54 -0
- boulderopalscaleupsdk/experiments/power_rabi.py +10 -7
- boulderopalscaleupsdk/experiments/power_rabi_ef.py +10 -9
- boulderopalscaleupsdk/experiments/ramsey.py +9 -7
- boulderopalscaleupsdk/experiments/ramsey_ef.py +62 -0
- boulderopalscaleupsdk/experiments/{readout_classifier_calibration.py → readout_classifier.py} +16 -6
- boulderopalscaleupsdk/experiments/readout_optimization.py +57 -0
- boulderopalscaleupsdk/experiments/resonator_spectroscopy.py +9 -7
- boulderopalscaleupsdk/experiments/resonator_spectroscopy_by_bias.py +12 -11
- boulderopalscaleupsdk/experiments/resonator_spectroscopy_by_power.py +10 -9
- boulderopalscaleupsdk/experiments/t1.py +8 -6
- boulderopalscaleupsdk/experiments/t2.py +12 -10
- boulderopalscaleupsdk/experiments/t2_echo.py +12 -10
- boulderopalscaleupsdk/experiments/transmon_anharmonicity.py +13 -12
- boulderopalscaleupsdk/experiments/transmon_spectroscopy.py +10 -8
- boulderopalscaleupsdk/experiments/voltage_bias_fine_tune.py +58 -0
- boulderopalscaleupsdk/experiments/zz_ramsey.py +59 -0
- boulderopalscaleupsdk/grpc_interceptors/error.py +318 -0
- boulderopalscaleupsdk/plotting/dtypes.py +10 -8
- boulderopalscaleupsdk/protobuf/v1/agent_pb2.py +9 -3
- boulderopalscaleupsdk/protobuf/v1/agent_pb2.pyi +14 -0
- boulderopalscaleupsdk/protobuf/v1/agent_pb2_grpc.py +34 -0
- boulderopalscaleupsdk/protobuf/v1/device_pb2.py +57 -49
- boulderopalscaleupsdk/protobuf/v1/device_pb2.pyi +67 -41
- boulderopalscaleupsdk/protobuf/v1/device_pb2_grpc.py +100 -66
- boulderopalscaleupsdk/protobuf/v1/job_pb2.py +47 -0
- boulderopalscaleupsdk/protobuf/v1/job_pb2.pyi +54 -0
- boulderopalscaleupsdk/protobuf/v1/job_pb2_grpc.py +138 -0
- boulderopalscaleupsdk/routines/__init__.py +10 -1
- boulderopalscaleupsdk/routines/one_qubit_calibration.py +36 -0
- boulderopalscaleupsdk/routines/resonator_mapping.py +1 -1
- boulderopalscaleupsdk/routines/transmon_coherence.py +34 -0
- boulderopalscaleupsdk/routines/transmon_discovery.py +5 -9
- boulderopalscaleupsdk/routines/transmon_retuning.py +13 -3
- boulderopalscaleupsdk/third_party/quantum_machines/__init__.py +1 -1
- boulderopalscaleupsdk/third_party/quantum_machines/config.py +51 -48
- boulder_opal_scale_up_sdk-1.0.4.dist-info/RECORD +0 -67
- boulderopalscaleupsdk/stubs/dtypes.py +0 -47
- boulderopalscaleupsdk/stubs/maps.py +0 -18
- {boulder_opal_scale_up_sdk-1.0.4.dist-info → boulder_opal_scale_up_sdk-1.0.6.dist-info}/LICENSE +0 -0
- {boulder_opal_scale_up_sdk-1.0.4.dist-info → boulder_opal_scale_up_sdk-1.0.6.dist-info}/WHEEL +0 -0
@@ -0,0 +1,318 @@
|
|
1
|
+
# Copyright 2025 Q-CTRL. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Q-CTRL Terms of service (the "License"). Unauthorized
|
4
|
+
# copying or use of this file, via any medium, is strictly prohibited.
|
5
|
+
# Proprietary and confidential. You may not use this file except in compliance
|
6
|
+
# with the License. You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# https://q-ctrl.com/terms
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS. See the
|
12
|
+
# License for the specific language.
|
13
|
+
|
14
|
+
from __future__ import annotations
|
15
|
+
|
16
|
+
import inspect
|
17
|
+
import re
|
18
|
+
from typing import TYPE_CHECKING, Any
|
19
|
+
|
20
|
+
import grpc
|
21
|
+
import grpc.aio
|
22
|
+
|
23
|
+
from boulderopalscaleupsdk.errors import ScaleUpServerError
|
24
|
+
|
25
|
+
if TYPE_CHECKING:
|
26
|
+
from collections.abc import AsyncIterable, AsyncIterator
|
27
|
+
|
28
|
+
# ------------------------
|
29
|
+
# Helpers
|
30
|
+
# ------------------------
|
31
|
+
|
32
|
+
_GRPC_MESSAGE_RE = re.compile(r'grpc_message:"([^"]+)"')
|
33
|
+
|
34
|
+
|
35
|
+
def _extract_peer_message(err: grpc.RpcError) -> str | None:
|
36
|
+
dbg = getattr(err, "debug_error_string", None)
|
37
|
+
if callable(dbg):
|
38
|
+
try:
|
39
|
+
s = dbg()
|
40
|
+
except (AttributeError, TypeError, RuntimeError):
|
41
|
+
return None
|
42
|
+
if isinstance(s, str):
|
43
|
+
m = _GRPC_MESSAGE_RE.search(s)
|
44
|
+
if m:
|
45
|
+
return m.group(1)
|
46
|
+
return None
|
47
|
+
|
48
|
+
|
49
|
+
def _concise_error(err: grpc.RpcError, *, include_code: bool = False) -> str:
|
50
|
+
msg = _extract_peer_message(err) or (err.details() or "An unknown error occurred.")
|
51
|
+
if include_code:
|
52
|
+
try:
|
53
|
+
return f"{err.code().name}: {msg}"
|
54
|
+
except (AttributeError, ValueError):
|
55
|
+
pass
|
56
|
+
return msg
|
57
|
+
|
58
|
+
|
59
|
+
# ------------------------
|
60
|
+
# SYNC wrappers
|
61
|
+
# ------------------------
|
62
|
+
|
63
|
+
|
64
|
+
class _UnaryUnaryCallWrapper:
|
65
|
+
"""Proxy that prettifies errors when .result() is called (sync)."""
|
66
|
+
|
67
|
+
def __init__(self, inner: Any, include_code: bool) -> None:
|
68
|
+
self._inner = inner
|
69
|
+
self._include_code = include_code
|
70
|
+
|
71
|
+
def result(self, timeout: float | None = None) -> Any:
|
72
|
+
try:
|
73
|
+
return self._inner.result(timeout)
|
74
|
+
except grpc.RpcError as e:
|
75
|
+
raise ScaleUpServerError(_concise_error(e, include_code=self._include_code)) from None
|
76
|
+
|
77
|
+
def __getattr__(self, name: str) -> Any:
|
78
|
+
return getattr(self._inner, name)
|
79
|
+
|
80
|
+
def __bool__(self) -> bool:
|
81
|
+
return bool(self._inner)
|
82
|
+
|
83
|
+
|
84
|
+
class _SyncRespIterWrapper:
|
85
|
+
"""Wrap response-stream iterator to prettify RpcError during iteration (sync)."""
|
86
|
+
|
87
|
+
def __init__(self, inner: Any, include_code: bool) -> None:
|
88
|
+
self._inner = inner
|
89
|
+
self._include_code = include_code
|
90
|
+
|
91
|
+
def __iter__(self):
|
92
|
+
try:
|
93
|
+
yield from self._inner
|
94
|
+
except grpc.RpcError as e:
|
95
|
+
raise ScaleUpServerError(_concise_error(e, include_code=self._include_code)) from None
|
96
|
+
|
97
|
+
def __getattr__(self, name: str) -> Any:
|
98
|
+
return getattr(self._inner, name)
|
99
|
+
|
100
|
+
|
101
|
+
class _SyncReqIterWrapper:
|
102
|
+
"""Wrap request-stream iterator to prettify RpcError while producing items (sync)."""
|
103
|
+
|
104
|
+
def __init__(self, inner: Any, include_code: bool) -> None:
|
105
|
+
self._inner = inner
|
106
|
+
self._include_code = include_code
|
107
|
+
|
108
|
+
def __iter__(self):
|
109
|
+
try:
|
110
|
+
yield from self._inner
|
111
|
+
except grpc.RpcError as e:
|
112
|
+
raise ScaleUpServerError(_concise_error(e, include_code=self._include_code)) from None
|
113
|
+
|
114
|
+
def __getattr__(self, name: str) -> Any:
|
115
|
+
return getattr(self._inner, name)
|
116
|
+
|
117
|
+
|
118
|
+
# ------------------------
|
119
|
+
# ASYNC wrappers
|
120
|
+
# ------------------------
|
121
|
+
|
122
|
+
|
123
|
+
class _AioRespAsyncIterWrapper:
|
124
|
+
"""
|
125
|
+
Async iterator proxy that prettifies errors from response streams (async).
|
126
|
+
Accepts the Call object (UnaryStreamCall or StreamStreamCall).
|
127
|
+
"""
|
128
|
+
|
129
|
+
def __init__(self, inner: Any, include_code: bool) -> None:
|
130
|
+
self._inner = inner
|
131
|
+
self._include_code = include_code
|
132
|
+
|
133
|
+
def __aiter__(self) -> AsyncIterator[Any]:
|
134
|
+
async def gen() -> AsyncIterator[Any]:
|
135
|
+
try:
|
136
|
+
async for item in self._inner:
|
137
|
+
yield item
|
138
|
+
except grpc.RpcError as e:
|
139
|
+
raise ScaleUpServerError(
|
140
|
+
_concise_error(e, include_code=self._include_code),
|
141
|
+
) from None
|
142
|
+
|
143
|
+
return gen()
|
144
|
+
|
145
|
+
async def initial_metadata(self) -> Any:
|
146
|
+
try:
|
147
|
+
return await self._inner.initial_metadata()
|
148
|
+
except grpc.RpcError as e:
|
149
|
+
raise ScaleUpServerError(_concise_error(e, include_code=self._include_code)) from None
|
150
|
+
|
151
|
+
async def trailing_metadata(self) -> Any:
|
152
|
+
try:
|
153
|
+
return await self._inner.trailing_metadata()
|
154
|
+
except grpc.RpcError as e:
|
155
|
+
raise ScaleUpServerError(_concise_error(e, include_code=self._include_code)) from None
|
156
|
+
|
157
|
+
def cancel(self) -> None:
|
158
|
+
return self._inner.cancel()
|
159
|
+
|
160
|
+
def code(self) -> Any:
|
161
|
+
return self._inner.code()
|
162
|
+
|
163
|
+
def details(self) -> str:
|
164
|
+
return self._inner.details()
|
165
|
+
|
166
|
+
def __getattr__(self, name: str) -> Any:
|
167
|
+
return getattr(self._inner, name)
|
168
|
+
|
169
|
+
|
170
|
+
class _AioReqAsyncIterWrapper:
|
171
|
+
"""
|
172
|
+
Async request iterator wrapper that prettifies errors when producing request items.
|
173
|
+
Takes any AsyncIterable (not necessarily an AsyncIterator).
|
174
|
+
"""
|
175
|
+
|
176
|
+
def __init__(self, inner: AsyncIterable[Any], include_code: bool) -> None:
|
177
|
+
self._inner = inner
|
178
|
+
self._include_code = include_code
|
179
|
+
|
180
|
+
def __aiter__(self) -> AsyncIterator[Any]:
|
181
|
+
async def gen() -> AsyncIterator[Any]:
|
182
|
+
try:
|
183
|
+
async for item in self._inner:
|
184
|
+
yield item
|
185
|
+
except grpc.RpcError as e:
|
186
|
+
raise ScaleUpServerError(
|
187
|
+
_concise_error(e, include_code=self._include_code),
|
188
|
+
) from None
|
189
|
+
|
190
|
+
return gen()
|
191
|
+
|
192
|
+
|
193
|
+
# ------------------------
|
194
|
+
# Unified interceptor (sync + aio)
|
195
|
+
# ------------------------
|
196
|
+
|
197
|
+
|
198
|
+
class ErrorFormatterInterceptor(
|
199
|
+
# sync interfaces
|
200
|
+
grpc.UnaryUnaryClientInterceptor,
|
201
|
+
grpc.UnaryStreamClientInterceptor,
|
202
|
+
grpc.StreamUnaryClientInterceptor,
|
203
|
+
grpc.StreamStreamClientInterceptor,
|
204
|
+
# aio interfaces
|
205
|
+
grpc.aio.UnaryUnaryClientInterceptor,
|
206
|
+
grpc.aio.UnaryStreamClientInterceptor,
|
207
|
+
grpc.aio.StreamUnaryClientInterceptor,
|
208
|
+
grpc.aio.StreamStreamClientInterceptor,
|
209
|
+
):
|
210
|
+
"""
|
211
|
+
Prettifies gRPC errors raised by the server into ScaleUpServerError.
|
212
|
+
|
213
|
+
Works with both sync (grpc) and async (grpc.aio) channels.
|
214
|
+
|
215
|
+
- Detects whether `continuation` is a coroutine function.
|
216
|
+
- In async case, returns a coroutine that yields wrapped awaitable/async-iterable calls.
|
217
|
+
- In sync case, returns wrapped blocking call objects/iterators.
|
218
|
+
"""
|
219
|
+
|
220
|
+
def __init__(self, include_code: bool = False) -> None:
|
221
|
+
self._include_code = include_code
|
222
|
+
|
223
|
+
# ---------- UNARY -> UNARY ----------
|
224
|
+
|
225
|
+
async def _async_unary_unary(self, continuation, client_call_details, request) -> Any:
|
226
|
+
try:
|
227
|
+
call = continuation(client_call_details, request) # awaitable call
|
228
|
+
# Await here so callers receive the *message*, mirroring AuthInterceptor.
|
229
|
+
return await call
|
230
|
+
except grpc.RpcError as e:
|
231
|
+
raise ScaleUpServerError(_concise_error(e, include_code=self._include_code)) from None
|
232
|
+
|
233
|
+
def _sync_unary_unary(self, continuation, client_call_details, request) -> Any:
|
234
|
+
try:
|
235
|
+
call = continuation(client_call_details, request) # blocking call
|
236
|
+
except grpc.RpcError as e:
|
237
|
+
raise ScaleUpServerError(_concise_error(e, include_code=self._include_code)) from None
|
238
|
+
return _UnaryUnaryCallWrapper(call, self._include_code)
|
239
|
+
|
240
|
+
def intercept_unary_unary(self, continuation, client_call_details, request): # type: ignore[override]
|
241
|
+
if inspect.iscoroutinefunction(continuation):
|
242
|
+
return self._async_unary_unary(continuation, client_call_details, request)
|
243
|
+
return self._sync_unary_unary(continuation, client_call_details, request)
|
244
|
+
|
245
|
+
# ---------- UNARY -> STREAM ----------
|
246
|
+
|
247
|
+
async def _async_unary_stream(self, continuation, client_call_details, request) -> Any:
|
248
|
+
try:
|
249
|
+
resp_call = continuation(client_call_details, request) # async-iterable call
|
250
|
+
# Do NOT await: return an iterator wrapper that prettifies stream errors.
|
251
|
+
return _AioRespAsyncIterWrapper(resp_call, self._include_code)
|
252
|
+
except grpc.RpcError as e:
|
253
|
+
raise ScaleUpServerError(_concise_error(e, include_code=self._include_code)) from None
|
254
|
+
|
255
|
+
def _sync_unary_stream(self, continuation, client_call_details, request) -> Any:
|
256
|
+
try:
|
257
|
+
resp_iter = continuation(client_call_details, request) # iterator
|
258
|
+
except grpc.RpcError as e:
|
259
|
+
raise ScaleUpServerError(_concise_error(e, include_code=self._include_code)) from None
|
260
|
+
return _SyncRespIterWrapper(resp_iter, self._include_code)
|
261
|
+
|
262
|
+
def intercept_unary_stream(self, continuation, client_call_details, request): # type: ignore[override]
|
263
|
+
if inspect.iscoroutinefunction(continuation):
|
264
|
+
return self._async_unary_stream(continuation, client_call_details, request)
|
265
|
+
return self._sync_unary_stream(continuation, client_call_details, request)
|
266
|
+
|
267
|
+
# ---------- STREAM -> UNARY ----------
|
268
|
+
|
269
|
+
async def _async_stream_unary(self, continuation, client_call_details, request_iterator) -> Any:
|
270
|
+
try:
|
271
|
+
wrapped_req = _AioReqAsyncIterWrapper(request_iterator, self._include_code)
|
272
|
+
call = continuation(client_call_details, wrapped_req) # awaitable call
|
273
|
+
# Await and return the *message*.
|
274
|
+
return await call
|
275
|
+
except grpc.RpcError as e:
|
276
|
+
raise ScaleUpServerError(_concise_error(e, include_code=self._include_code)) from None
|
277
|
+
|
278
|
+
def _sync_stream_unary(self, continuation, client_call_details, request_iterator) -> Any:
|
279
|
+
try:
|
280
|
+
wrapped_req = _SyncReqIterWrapper(request_iterator, self._include_code)
|
281
|
+
call = continuation(client_call_details, wrapped_req) # blocking call
|
282
|
+
except grpc.RpcError as e:
|
283
|
+
raise ScaleUpServerError(_concise_error(e, include_code=self._include_code)) from None
|
284
|
+
return _UnaryUnaryCallWrapper(call, self._include_code)
|
285
|
+
|
286
|
+
def intercept_stream_unary(self, continuation, client_call_details, request_iterator): # type: ignore[override]
|
287
|
+
if inspect.iscoroutinefunction(continuation):
|
288
|
+
return self._async_stream_unary(continuation, client_call_details, request_iterator)
|
289
|
+
return self._sync_stream_unary(continuation, client_call_details, request_iterator)
|
290
|
+
|
291
|
+
# ---------- STREAM -> STREAM ----------
|
292
|
+
|
293
|
+
async def _async_stream_stream(
|
294
|
+
self,
|
295
|
+
continuation,
|
296
|
+
client_call_details,
|
297
|
+
request_iterator,
|
298
|
+
) -> Any:
|
299
|
+
try:
|
300
|
+
wrapped_req = _AioReqAsyncIterWrapper(request_iterator, self._include_code)
|
301
|
+
resp_call = continuation(client_call_details, wrapped_req) # async-iterable call
|
302
|
+
# Return iterator wrapper.
|
303
|
+
return _AioRespAsyncIterWrapper(resp_call, self._include_code)
|
304
|
+
except grpc.RpcError as e:
|
305
|
+
raise ScaleUpServerError(_concise_error(e, include_code=self._include_code)) from None
|
306
|
+
|
307
|
+
def _sync_stream_stream(self, continuation, client_call_details, request_iterator) -> Any:
|
308
|
+
try:
|
309
|
+
wrapped_req = _SyncReqIterWrapper(request_iterator, self._include_code)
|
310
|
+
resp_iter = continuation(client_call_details, wrapped_req) # iterator
|
311
|
+
except grpc.RpcError as e:
|
312
|
+
raise ScaleUpServerError(_concise_error(e, include_code=self._include_code)) from None
|
313
|
+
return _SyncRespIterWrapper(resp_iter, self._include_code)
|
314
|
+
|
315
|
+
def intercept_stream_stream(self, continuation, client_call_details, request_iterator): # type: ignore[override]
|
316
|
+
if inspect.iscoroutinefunction(continuation):
|
317
|
+
return self._async_stream_stream(continuation, client_call_details, request_iterator)
|
318
|
+
return self._sync_stream_stream(continuation, client_call_details, request_iterator)
|
@@ -19,7 +19,6 @@ from pydantic import (
|
|
19
19
|
BaseModel,
|
20
20
|
BeforeValidator,
|
21
21
|
ConfigDict,
|
22
|
-
Field,
|
23
22
|
PlainSerializer,
|
24
23
|
ValidationError,
|
25
24
|
)
|
@@ -28,9 +27,8 @@ from pydantic.dataclasses import dataclass
|
|
28
27
|
|
29
28
|
def _array_validator(value: Any) -> np.ndarray:
|
30
29
|
if isinstance(value, dict):
|
31
|
-
|
32
|
-
|
33
|
-
)
|
30
|
+
shape = [int(s) for s in value["shape"]]
|
31
|
+
array = np.frombuffer(base64.b64decode(value["data"]), dtype=value["dtype"]).reshape(shape)
|
34
32
|
else:
|
35
33
|
array = np.asarray(value, order="C")
|
36
34
|
|
@@ -82,17 +80,19 @@ class PlotConfig(BaseModel):
|
|
82
80
|
x_ticks: Ticks | None = None
|
83
81
|
y_ticks: Ticks | None = None
|
84
82
|
|
83
|
+
axes_ratio: float | None = None
|
85
84
|
reverse_yaxis: bool = False
|
86
85
|
|
87
86
|
report: PlotReport | None = None
|
88
87
|
|
89
88
|
|
90
|
-
@dataclass(config=ConfigDict(arbitrary_types_allowed=True))
|
89
|
+
@dataclass(config=ConfigDict(arbitrary_types_allowed=True, extra="forbid"))
|
91
90
|
class PlotData1D:
|
92
91
|
x: _SerializableArray
|
93
92
|
y: _SerializableArray
|
94
93
|
|
95
94
|
style: Literal["dash", "solid", "scatter"]
|
95
|
+
color_index: int | None = None
|
96
96
|
|
97
97
|
x_error: _SerializableArray | None = None
|
98
98
|
y_error: _SerializableArray | None = None
|
@@ -112,7 +112,7 @@ class PlotData1D:
|
|
112
112
|
raise ValueError("The shapes of y and y_error must match.")
|
113
113
|
|
114
114
|
|
115
|
-
@dataclass(config=ConfigDict(arbitrary_types_allowed=True))
|
115
|
+
@dataclass(config=ConfigDict(arbitrary_types_allowed=True, extra="forbid"))
|
116
116
|
class HeatmapData:
|
117
117
|
x: _SerializableArray
|
118
118
|
y: _SerializableArray
|
@@ -122,6 +122,7 @@ class HeatmapData:
|
|
122
122
|
|
123
123
|
# Whether to display the heatmap values as text.
|
124
124
|
heatmap_text: bool = False
|
125
|
+
color_map: Literal["sequential", "divergent"] = "sequential"
|
125
126
|
|
126
127
|
def __post_init__(self):
|
127
128
|
if self.x.ndim != 1:
|
@@ -157,16 +158,17 @@ class LinePlot(BaseModel):
|
|
157
158
|
|
158
159
|
config: PlotConfig
|
159
160
|
heatmap: HeatmapData | None = None
|
160
|
-
lines:
|
161
|
+
lines: list[PlotData1D] = []
|
161
162
|
markers: list[Marker] = []
|
162
163
|
vlines: list[VLine] = []
|
163
164
|
|
164
165
|
|
165
|
-
@dataclass(config=ConfigDict(arbitrary_types_allowed=True))
|
166
|
+
@dataclass(config=ConfigDict(arbitrary_types_allowed=True, extra="forbid"))
|
166
167
|
class HistogramData:
|
167
168
|
data: _SerializableArray
|
168
169
|
label: str | None = None
|
169
170
|
opacity: float = 0.7
|
171
|
+
color_index: int | None = None
|
170
172
|
|
171
173
|
def __post_init__(self):
|
172
174
|
if self.data.ndim != 1:
|
@@ -17,7 +17,7 @@ from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
|
|
17
17
|
from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2
|
18
18
|
|
19
19
|
|
20
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n-boulderopalscaleupsdk/protobuf/v1/agent.proto\x12!boulderopalscaleupsdk.protobuf.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1cgoogle/protobuf/struct.proto\"\x85\x01\n\x11RunProgramRequest\x12\'\n\x0f\x63ontroller_type\x18\x01 \x01(\tR\x0e\x63ontrollerType\x12\x18\n\x07program\x18\x02 \x01(\tR\x07program\x12-\n\x12\x63\x61librate_elements\x18\x03 \x03(\tR\x11\x63\x61librateElements\"H\n\x12RunProgramResponse\x12\x32\n\x08raw_data\x18\x01 \x01(\x0b\x32\x17.google.protobuf.StructR\x07rawData\"_\n)RunQuantumMachinesMixerCalibrationRequest\x12\x1a\n\x08\x65lements\x18\x01 \x03(\tR\x08\x65lements\x12\x16\n\x06\x63onfig\x18\x02 \x01(\tR\x06\x63onfig\"k\n*RunQuantumMachinesMixerCalibrationResponse\x12\x18\n\x07success\x18\x01 \x01(\x08R\x07success\x12\x19\n\x05\x65rror\x18\x02 \x01(\tH\x00R\x05\x65rror\x88\x01\x01\x42\x08\n\x06_error\"G\n\x15\x44isplayResultsRequest\x12\x18\n\x07message\x18\x01 \x01(\tR\x07message\x12\x14\n\x05plots\x18\x02 \x03(\tR\x05plots\"F\n\x16\x44isplayResultsResponse\x12,\n\x05\x65mpty\x18\x01 \x01(\x0b\x32\x16.google.protobuf.EmptyR\x05\
|
20
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n-boulderopalscaleupsdk/protobuf/v1/agent.proto\x12!boulderopalscaleupsdk.protobuf.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1cgoogle/protobuf/struct.proto\"\x85\x01\n\x11RunProgramRequest\x12\'\n\x0f\x63ontroller_type\x18\x01 \x01(\tR\x0e\x63ontrollerType\x12\x18\n\x07program\x18\x02 \x01(\tR\x07program\x12-\n\x12\x63\x61librate_elements\x18\x03 \x03(\tR\x11\x63\x61librateElements\"H\n\x12RunProgramResponse\x12\x32\n\x08raw_data\x18\x01 \x01(\x0b\x32\x17.google.protobuf.StructR\x07rawData\"_\n)RunQuantumMachinesMixerCalibrationRequest\x12\x1a\n\x08\x65lements\x18\x01 \x03(\tR\x08\x65lements\x12\x16\n\x06\x63onfig\x18\x02 \x01(\tR\x06\x63onfig\"k\n*RunQuantumMachinesMixerCalibrationResponse\x12\x18\n\x07success\x18\x01 \x01(\x08R\x07success\x12\x19\n\x05\x65rror\x18\x02 \x01(\tH\x00R\x05\x65rror\x88\x01\x01\x42\x08\n\x06_error\"G\n\x15\x44isplayResultsRequest\x12\x18\n\x07message\x18\x01 \x01(\tR\x07message\x12\x14\n\x05plots\x18\x02 \x03(\tR\x05plots\"F\n\x16\x44isplayResultsResponse\x12,\n\x05\x65mpty\x18\x01 \x01(\x0b\x32\x16.google.protobuf.EmptyR\x05\x65mpty\"\\\n\nAskRequest\x12\x18\n\x07message\x18\x01 \x01(\tR\x07message\x12\x34\n\x16\x65xpected_response_type\x18\x02 \x01(\tR\x14\x65xpectedResponseType\")\n\x0b\x41skResponse\x12\x1a\n\x08response\x18\x01 \x01(\tR\x08response2\xd0\x05\n\x0c\x41gentService\x12\x9b\x01\n\nRunProgram\x12\x34.boulderopalscaleupsdk.protobuf.v1.RunProgramRequest\x1a\x35.boulderopalscaleupsdk.protobuf.v1.RunProgramResponse\" \x82\xd3\xe4\x93\x02\x1a\"\x15/v1/agent/run_program:\x01*\x12\xf3\x01\n\"RunQuantumMachinesMixerCalibration\x12L.boulderopalscaleupsdk.protobuf.v1.RunQuantumMachinesMixerCalibrationRequest\x1aM.boulderopalscaleupsdk.protobuf.v1.RunQuantumMachinesMixerCalibrationResponse\"0\x82\xd3\xe4\x93\x02*\"%/v1/agent/run_qua_calibration_program:\x01*\x12\xab\x01\n\x0e\x44isplayResults\x12\x38.boulderopalscaleupsdk.protobuf.v1.DisplayResultsRequest\x1a\x39.boulderopalscaleupsdk.protobuf.v1.DisplayResultsResponse\"$\x82\xd3\xe4\x93\x02\x1e\"\x19/v1/agent/display_results:\x01*\x12~\n\x03\x41sk\x12-.boulderopalscaleupsdk.protobuf.v1.AskRequest\x1a..boulderopalscaleupsdk.protobuf.v1.AskResponse\"\x18\x82\xd3\xe4\x93\x02\x12\"\r/v1/agent/ask:\x01*B\xa9\x02\n%com.boulderopalscaleupsdk.protobuf.v1B\nAgentProtoP\x01ZNgithub.com/qctrl/boulder-opal-scale-up/proto/boulderopalscaleupsdk/protobuf/v1\xa2\x02\x03\x42PX\xaa\x02!Boulderopalscaleupsdk.Protobuf.V1\xca\x02!Boulderopalscaleupsdk\\Protobuf\\V1\xe2\x02-Boulderopalscaleupsdk\\Protobuf\\V1\\GPBMetadata\xea\x02#Boulderopalscaleupsdk::Protobuf::V1b\x06proto3')
|
21
21
|
|
22
22
|
_globals = globals()
|
23
23
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
@@ -31,6 +31,8 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
31
31
|
_globals['_AGENTSERVICE'].methods_by_name['RunQuantumMachinesMixerCalibration']._serialized_options = b'\202\323\344\223\002*\"%/v1/agent/run_qua_calibration_program:\001*'
|
32
32
|
_globals['_AGENTSERVICE'].methods_by_name['DisplayResults']._loaded_options = None
|
33
33
|
_globals['_AGENTSERVICE'].methods_by_name['DisplayResults']._serialized_options = b'\202\323\344\223\002\036\"\031/v1/agent/display_results:\001*'
|
34
|
+
_globals['_AGENTSERVICE'].methods_by_name['Ask']._loaded_options = None
|
35
|
+
_globals['_AGENTSERVICE'].methods_by_name['Ask']._serialized_options = b'\202\323\344\223\002\022\"\r/v1/agent/ask:\001*'
|
34
36
|
_globals['_RUNPROGRAMREQUEST']._serialized_start=174
|
35
37
|
_globals['_RUNPROGRAMREQUEST']._serialized_end=307
|
36
38
|
_globals['_RUNPROGRAMRESPONSE']._serialized_start=309
|
@@ -43,6 +45,10 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
43
45
|
_globals['_DISPLAYRESULTSREQUEST']._serialized_end=660
|
44
46
|
_globals['_DISPLAYRESULTSRESPONSE']._serialized_start=662
|
45
47
|
_globals['_DISPLAYRESULTSRESPONSE']._serialized_end=732
|
46
|
-
_globals['
|
47
|
-
_globals['
|
48
|
+
_globals['_ASKREQUEST']._serialized_start=734
|
49
|
+
_globals['_ASKREQUEST']._serialized_end=826
|
50
|
+
_globals['_ASKRESPONSE']._serialized_start=828
|
51
|
+
_globals['_ASKRESPONSE']._serialized_end=869
|
52
|
+
_globals['_AGENTSERVICE']._serialized_start=872
|
53
|
+
_globals['_AGENTSERVICE']._serialized_end=1592
|
48
54
|
# @@protoc_insertion_point(module_scope)
|
@@ -53,3 +53,17 @@ class DisplayResultsResponse(_message.Message):
|
|
53
53
|
EMPTY_FIELD_NUMBER: _ClassVar[int]
|
54
54
|
empty: _empty_pb2.Empty
|
55
55
|
def __init__(self, empty: _Optional[_Union[_empty_pb2.Empty, _Mapping]] = ...) -> None: ...
|
56
|
+
|
57
|
+
class AskRequest(_message.Message):
|
58
|
+
__slots__ = ("message", "expected_response_type")
|
59
|
+
MESSAGE_FIELD_NUMBER: _ClassVar[int]
|
60
|
+
EXPECTED_RESPONSE_TYPE_FIELD_NUMBER: _ClassVar[int]
|
61
|
+
message: str
|
62
|
+
expected_response_type: str
|
63
|
+
def __init__(self, message: _Optional[str] = ..., expected_response_type: _Optional[str] = ...) -> None: ...
|
64
|
+
|
65
|
+
class AskResponse(_message.Message):
|
66
|
+
__slots__ = ("response",)
|
67
|
+
RESPONSE_FIELD_NUMBER: _ClassVar[int]
|
68
|
+
response: str
|
69
|
+
def __init__(self, response: _Optional[str] = ...) -> None: ...
|
@@ -30,6 +30,11 @@ class AgentServiceStub(object):
|
|
30
30
|
request_serializer=boulderopalscaleupsdk_dot_protobuf_dot_v1_dot_agent__pb2.DisplayResultsRequest.SerializeToString,
|
31
31
|
response_deserializer=boulderopalscaleupsdk_dot_protobuf_dot_v1_dot_agent__pb2.DisplayResultsResponse.FromString,
|
32
32
|
)
|
33
|
+
self.Ask = channel.unary_unary(
|
34
|
+
'/boulderopalscaleupsdk.protobuf.v1.AgentService/Ask',
|
35
|
+
request_serializer=boulderopalscaleupsdk_dot_protobuf_dot_v1_dot_agent__pb2.AskRequest.SerializeToString,
|
36
|
+
response_deserializer=boulderopalscaleupsdk_dot_protobuf_dot_v1_dot_agent__pb2.AskResponse.FromString,
|
37
|
+
)
|
33
38
|
|
34
39
|
|
35
40
|
class AgentServiceServicer(object):
|
@@ -57,6 +62,13 @@ class AgentServiceServicer(object):
|
|
57
62
|
context.set_details('Method not implemented!')
|
58
63
|
raise NotImplementedError('Method not implemented!')
|
59
64
|
|
65
|
+
def Ask(self, request, context):
|
66
|
+
"""Ask user for input.
|
67
|
+
"""
|
68
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
69
|
+
context.set_details('Method not implemented!')
|
70
|
+
raise NotImplementedError('Method not implemented!')
|
71
|
+
|
60
72
|
|
61
73
|
def add_AgentServiceServicer_to_server(servicer, server):
|
62
74
|
rpc_method_handlers = {
|
@@ -75,6 +87,11 @@ def add_AgentServiceServicer_to_server(servicer, server):
|
|
75
87
|
request_deserializer=boulderopalscaleupsdk_dot_protobuf_dot_v1_dot_agent__pb2.DisplayResultsRequest.FromString,
|
76
88
|
response_serializer=boulderopalscaleupsdk_dot_protobuf_dot_v1_dot_agent__pb2.DisplayResultsResponse.SerializeToString,
|
77
89
|
),
|
90
|
+
'Ask': grpc.unary_unary_rpc_method_handler(
|
91
|
+
servicer.Ask,
|
92
|
+
request_deserializer=boulderopalscaleupsdk_dot_protobuf_dot_v1_dot_agent__pb2.AskRequest.FromString,
|
93
|
+
response_serializer=boulderopalscaleupsdk_dot_protobuf_dot_v1_dot_agent__pb2.AskResponse.SerializeToString,
|
94
|
+
),
|
78
95
|
}
|
79
96
|
generic_handler = grpc.method_handlers_generic_handler(
|
80
97
|
'boulderopalscaleupsdk.protobuf.v1.AgentService', rpc_method_handlers)
|
@@ -136,3 +153,20 @@ class AgentService(object):
|
|
136
153
|
boulderopalscaleupsdk_dot_protobuf_dot_v1_dot_agent__pb2.DisplayResultsResponse.FromString,
|
137
154
|
options, channel_credentials,
|
138
155
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
156
|
+
|
157
|
+
@staticmethod
|
158
|
+
def Ask(request,
|
159
|
+
target,
|
160
|
+
options=(),
|
161
|
+
channel_credentials=None,
|
162
|
+
call_credentials=None,
|
163
|
+
insecure=False,
|
164
|
+
compression=None,
|
165
|
+
wait_for_ready=None,
|
166
|
+
timeout=None,
|
167
|
+
metadata=None):
|
168
|
+
return grpc.experimental.unary_unary(request, target, '/boulderopalscaleupsdk.protobuf.v1.AgentService/Ask',
|
169
|
+
boulderopalscaleupsdk_dot_protobuf_dot_v1_dot_agent__pb2.AskRequest.SerializeToString,
|
170
|
+
boulderopalscaleupsdk_dot_protobuf_dot_v1_dot_agent__pb2.AskResponse.FromString,
|
171
|
+
options, channel_credentials,
|
172
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|